Ejemplo n.º 1
0
void video_preview_stop(VideoStream *stream){
	ms_ticker_detach(stream->ticker, stream->source);
	ms_filter_unlink(stream->source,0,stream->pixconv,0);
	ms_filter_unlink(stream->pixconv,0,stream->output,0);
	
	video_stream_free(stream);
}
Ejemplo n.º 2
0
void video_stream_recv_only_stop (VideoStream * stream){
	if (stream->ticker!=NULL){
		ms_ticker_detach(stream->ticker, stream->rtprecv);
		rtp_stats_display(rtp_session_get_stats(stream->session),"Video session's RTP statistics");
		ms_filter_unlink(stream->rtprecv, 0, stream->decoder, 0);
		ms_filter_unlink(stream->decoder,0,stream->output,0);
	}
	video_stream_free (stream);
}
Ejemplo n.º 3
0
void video_stream_send_only_stop(VideoStream *stream){
	if (stream->ticker){
		ms_ticker_detach (stream->ticker, stream->source);
		ms_filter_unlink(stream->source,0,stream->pixconv,0);
		ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0);
		ms_filter_unlink (stream->sizeconv, 0, stream->encoder, 0);
		ms_filter_unlink(stream->encoder,0,stream->rtpsend,0);
	}
	video_stream_free(stream);
}
Ejemplo n.º 4
0
void
video_stream_stop (VideoStream * stream)
{
	stream->eventcb = NULL;
	stream->event_pointer = NULL;
	if (stream->ticker){
		if (stream->voidsink) {
			stop_preload_graph(stream);
		} else {
			if (stream->source)
				ms_ticker_detach(stream->ticker,stream->source);
			if (stream->rtprecv)
				ms_ticker_detach(stream->ticker,stream->rtprecv);

			if (stream->ice_check_list != NULL) {
				ice_check_list_print_route(stream->ice_check_list, "Video session's route");
				stream->ice_check_list = NULL;
			}
			rtp_stats_display(rtp_session_get_stats(stream->session),"Video session's RTP statistics");

			if (stream->source){
				ms_filter_unlink(stream->source,0,stream->pixconv,0);
				ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0);
				ms_filter_unlink (stream->sizeconv, 0, stream->tee, 0);
				ms_filter_unlink(stream->tee,0,stream->encoder,0);
				ms_filter_unlink(stream->encoder, 0, stream->rtpsend,0);
				if (stream->output2){
					ms_filter_unlink(stream->tee,1,stream->output2,0);
				}
			}
			if (stream->rtprecv){
				MSConnectionHelper h;
				ms_connection_helper_start (&h);
				ms_connection_helper_unlink (&h,stream->rtprecv,-1,0);
				ms_connection_helper_unlink (&h,stream->decoder,0,0);
				if (stream->tee2){
					ms_connection_helper_unlink (&h,stream->tee2,0,0);
					ms_filter_unlink(stream->tee2,1,stream->jpegwriter,0);
				}
				if(stream->output)
					ms_connection_helper_unlink (&h,stream->output,0,-1);
				if (stream->tee && stream->output && stream->output2==NULL)
					ms_filter_unlink(stream->tee,1,stream->output,1);
			}
		}
	}
	video_stream_free (stream);
}
Ejemplo n.º 5
0
void
video_stream_stop (VideoStream * stream)
{
	if (stream->ticker){
		ms_ticker_detach(stream->ticker,stream->source);
	
		rtp_stats_display(rtp_session_get_stats(stream->session),"Video session's RTP statistics");
		
		ms_filter_unlink(stream->source,0,stream->pixconv,0);
		ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0);
		ms_filter_unlink (stream->sizeconv, 0, stream->tee, 0);
		ms_filter_unlink(stream->tee,0,stream->encoder,0);
		ms_filter_unlink(stream->encoder, 0, stream->rtpsend,0);
		ms_filter_unlink(stream->rtprecv, 0, stream->decoder, 0);
		ms_filter_unlink(stream->decoder,0,stream->output,0);
		ms_filter_unlink(stream->tee,1,stream->output,1);
	}
	video_stream_free (stream);
}
Ejemplo n.º 6
0
void
video_stream_stop (VideoStream * stream)
{
	if (stream->ticker){
		if (stream->source)
			ms_ticker_detach(stream->ticker,stream->source);
		if (stream->rtprecv)
			ms_ticker_detach(stream->ticker,stream->rtprecv);
	
		rtp_stats_display(rtp_session_get_stats(stream->session),"Video session's RTP statistics");

		if (stream->source){
			ms_filter_unlink(stream->source,0,stream->pixconv,0);
			ms_filter_unlink (stream->pixconv, 0, stream->sizeconv, 0);
			ms_filter_unlink (stream->sizeconv, 0, stream->tee, 0);
			ms_filter_unlink(stream->tee,0,stream->encoder,0);
			ms_filter_unlink(stream->encoder, 0, stream->rtpsend,0);
			if (stream->output2){
				ms_filter_unlink(stream->tee,1,stream->output2,0);
			}
		}
		if (stream->rtprecv){
			MSConnectionHelper h;
			ms_connection_helper_start (&h);
			ms_connection_helper_unlink (&h,stream->rtprecv,-1,0);
			ms_connection_helper_unlink (&h,stream->decoder,0,0);
			if (stream->tee2){
				ms_connection_helper_unlink (&h,stream->tee2,0,0);
				ms_filter_unlink(stream->tee2,1,stream->jpegwriter,0);
				if(stream->video_record)
					ms_filter_unlink(stream->tee2,2,stream->video_record,0);
			}
			ms_connection_helper_unlink (&h,stream->output,0,-1);
			if (stream->tee && stream->output2==NULL && ms_filter_get_id(stream->output)!=MS_CONF_ITC_SINK_ID)
				ms_filter_unlink(stream->tee,1,stream->output,1);
		}
	}

	video_stream_free (stream);
}
Ejemplo n.º 7
0
void
video_stream_stop (VideoStream * stream)
{
	stream->eventcb = NULL;
	stream->event_pointer = NULL;
	if (stream->ms.ticker){
		if (stream->prepare_ongoing == TRUE) {
			stop_preload_graph(stream);
		} else {
			if (stream->source)
				ms_ticker_detach(stream->ms.ticker,stream->source);
			if (stream->ms.rtprecv)
				ms_ticker_detach(stream->ms.ticker,stream->ms.rtprecv);

			if (stream->ms.ice_check_list != NULL) {
				ice_check_list_print_route(stream->ms.ice_check_list, "Video session's route");
				stream->ms.ice_check_list = NULL;
			}
			rtp_stats_display(rtp_session_get_stats(stream->ms.session),
				"             VIDEO SESSION'S RTP STATISTICS                ");

			if (stream->source){
				MSConnectionHelper ch;
				ms_connection_helper_start(&ch);
				ms_connection_helper_unlink(&ch, stream->source, -1, 0);
				if (stream->pixconv) {
					ms_connection_helper_unlink(&ch, stream->pixconv, 0, 0);
				}
				if (stream->sizeconv) {
					ms_connection_helper_unlink(&ch, stream->sizeconv, 0, 0);
				}
				ms_connection_helper_unlink(&ch, stream->tee, 0, 0);
				if (stream->source_performs_encoding == FALSE) {
					ms_connection_helper_unlink(&ch, stream->ms.encoder, 0, 0);
				}
				ms_connection_helper_unlink(&ch, stream->ms.rtpsend, 0, -1);
				if (stream->output2){
					ms_filter_unlink(stream->tee,1,stream->output2,0);
				}
			}
			if (stream->ms.voidsink) {
				ms_filter_unlink(stream->ms.rtprecv, 0, stream->ms.voidsink, 0);
			} else if (stream->ms.rtprecv){
				MSConnectionHelper h;
				ms_connection_helper_start (&h);
				ms_connection_helper_unlink (&h,stream->ms.rtprecv,-1,0);
				if (stream->output_performs_decoding == FALSE) {
					ms_connection_helper_unlink (&h,stream->ms.decoder,0,0);
				}
				if (stream->tee2){
					ms_connection_helper_unlink (&h,stream->tee2,0,0);
					ms_filter_unlink(stream->tee2,1,stream->jpegwriter,0);
				}
				if(stream->output)
					ms_connection_helper_unlink (&h,stream->output,0,-1);
				if (stream->tee && stream->output && stream->output2==NULL)
					ms_filter_unlink(stream->tee,1,stream->output,1);
			}
		}
	}
	video_stream_free (stream);
}
Ejemplo n.º 8
0
int video_stream_send_only_start(VideoStream* stream, RtpProfile *profile, const char *remip, int remport,
	int rem_rtcp_port, int payload, int jitt_comp, MSWebCam *device){
	PayloadType *pt;
	MSPixFmt format;
	MSVideoSize vsize;
	RtpSession *rtps=stream->session;
	float fps=15;
	
	vsize.width=MS_VIDEO_SIZE_CIF_W;
	vsize.height=MS_VIDEO_SIZE_CIF_H;

	rtp_session_set_profile(rtps,profile);
	if (remport>0) rtp_session_set_remote_addr_full(rtps,remip,remport,rem_rtcp_port);
	rtp_session_set_payload_type(rtps,payload);
	rtp_session_set_jitter_compensation(rtps,jitt_comp);
	
	/* creates rtp filter to send streams (remote part) */
	rtp_session_set_recv_buf_size(rtps,MAX_RTP_SIZE);
	stream->rtpsend =ms_filter_new(MS_RTP_SEND_ID);
	if (remport>0) ms_filter_call_method(stream->rtpsend,MS_RTP_SEND_SET_SESSION,stream->session);

	/* creates the filters */
	pt=rtp_profile_get_payload(profile,payload);
	if (pt==NULL){
		video_stream_free(stream);
		ms_error("videostream.c: undefined payload type.");
		return -1;
	}
	stream->encoder=ms_filter_create_encoder(pt->mime_type);
	if ((stream->encoder==NULL)){
		/* big problem: we have not a registered codec for this payload...*/
		video_stream_free(stream);
		ms_error("videostream.c: No codecs available for payload %i.",payload);
		return -1;
	}

	/* creates the filters */
	stream->source = ms_web_cam_create_reader(device);
	stream->sizeconv=ms_filter_new(MS_SIZE_CONV_ID);

	/* configure the filters */
	if (pt->send_fmtp)
		ms_filter_call_method(stream->encoder,MS_FILTER_ADD_FMTP,pt->send_fmtp);
	ms_filter_call_method(stream->encoder,MS_FILTER_SET_BITRATE,&pt->normal_bitrate);
	ms_filter_call_method(stream->encoder,MS_FILTER_GET_FPS,&fps);
	ms_filter_call_method(stream->encoder,MS_FILTER_GET_VIDEO_SIZE,&vsize);

	ms_filter_call_method(stream->source,MS_FILTER_SET_FPS,&fps);
	ms_filter_call_method(stream->source,MS_FILTER_SET_VIDEO_SIZE,&vsize);
	
	/* get the output format for webcam reader */
	ms_filter_call_method(stream->source,MS_FILTER_GET_PIX_FMT,&format);
	/*set it to the pixconv */

	/* bug fix from AMD: What about MJPEG mode???*/
	if (format==MS_MJPEG){
		stream->pixconv=ms_filter_new(MS_MJPEG_DEC_ID);
	}else{
		stream->pixconv=ms_filter_new(MS_PIX_CONV_ID);
		ms_filter_call_method(stream->pixconv,MS_FILTER_SET_PIX_FMT,&format);

		ms_filter_call_method(stream->source,MS_FILTER_GET_VIDEO_SIZE,&vsize);
		ms_filter_call_method(stream->pixconv,MS_FILTER_SET_VIDEO_SIZE,&vsize);
	}

	ms_filter_call_method(stream->encoder,MS_FILTER_GET_VIDEO_SIZE,&vsize);
	ms_filter_call_method(stream->sizeconv,MS_FILTER_SET_VIDEO_SIZE,&vsize);
	
	ms_message("vsize=%ix%i, fps=%f, send format: %s, capture format: %d, bitrate: %d",
			vsize.width,vsize.height,fps,pt->send_fmtp,format, pt->normal_bitrate);

	/* and then connect all */
	ms_filter_link (stream->source, 0, stream->pixconv, 0);
	ms_filter_link (stream->pixconv, 0, stream->sizeconv, 0);
	ms_filter_link (stream->sizeconv, 0, stream->encoder, 0);
	ms_filter_link (stream->encoder,0, stream->rtpsend,0);

	/* create the ticker */
	stream->ticker = ms_ticker_new(); 
	/* attach it the graph */
	ms_ticker_attach (stream->ticker, stream->source);
	return 0;
}