Beispiel #1
0
static int end_block( void *d )
{
	struct rtp_spook_input *conf = (struct rtp_spook_input *)d;
	int i;

	if( ! conf->output )
	{
		spook_log( SL_ERR, "rtpi: missing output stream name" );
		return -1;
	}
	if( conf->fps < 0 )
	{
		spook_log( SL_ERR,
			"v4l: framerate not specified for webcam" );
		return -1;
	} else if( conf->fps > 0 )
	{
		conf->fincr = 1;
		conf->fbase = conf->fps;
	} 
    else
    {
    	spook_log( SL_INFO, "v4l: must figure out framerate" );
        return -1;
    }
        
	if( rtp_setup( conf ) < 0 ) return -1;
	conf->ex = new_exchanger( conf->fps, get_back_frame1, conf );
	for( i = 0; i < conf->fps; ++i ) 
        exchange_frame( conf->ex, new_frame() );
	pthread_create( &conf->thread, NULL, capture_loop, conf );

	return 0;
}
Beispiel #2
0
static void handle_setup(rtsp_conn_info *conn,
                         rtsp_message *req, rtsp_message *resp) {
    int cport, tport;
    char *hdr = msg_get_header(req, "Transport");
    if (!hdr)
        return;

    char *p;
    p = strstr(hdr, "control_port=");
    if (!p)
        return;
    p = strchr(p, '=') + 1;
    cport = atoi(p);

    p = strstr(hdr, "timing_port=");
    if (!p)
        return;
    p = strchr(p, '=') + 1;
    tport = atoi(p);

    rtsp_take_player();
    int sport = rtp_setup(&conn->remote, cport, tport);
    if (!sport)
        return;

    player_play(&conn->stream);

    char resphdr[128]={0};
    snprintf(resphdr, sizeof(resphdr),
             "RTP/AVP/UDP;unicast;mode=record;server_port=%d;control_port=%d;timing_port=%d",
             sport, sport, sport);
    msg_add_header(resp, "Transport", resphdr);

    msg_add_header(resp, "Session", "1");

    resp->respcode = 200;
}
Beispiel #3
0
static void handle_setup(rtsp_conn_info *conn,
                         rtsp_message *req, rtsp_message *resp) {
    int cport, tport;
    char *hdr = msg_get_header(req, "Transport");
    if (!hdr)
        return;

    char *p;
    p = strstr(hdr, "control_port=");
    if (!p)
        return;
    p = strchr(p, '=') + 1;
    cport = atoi(p);

    p = strstr(hdr, "timing_port=");
    if (!p)
        return;
    p = strchr(p, '=') + 1;
    tport = atoi(p);

    rtsp_take_player();
    int sport = rtp_setup(&conn->remote, cport, tport);
    if (!sport)
        return;

    player_play(&conn->stream);

    char *resphdr = malloc(strlen(hdr) + 20);
    strcpy(resphdr, hdr);
    sprintf(resphdr + strlen(resphdr), ";server_port=%d", sport);
    msg_add_header(resp, "Transport", resphdr);

    msg_add_header(resp, "Session", "1");

    resp->respcode = 200;
}