Could not link ffdemux_mpegts0 to videoqueue

gagankumarnigam gagankumarnigam at bel.co.in
Tue Apr 17 06:58:28 UTC 2018


Hi all,

I tried to recieve mpeg2ts video stream (RTP/UDP) using the pipeline given
below. Successfully recieve the video

gst-launch udpsrc port=51000
caps="application/x-rtp,media=video,payload=33,clock-rate=90000,
encoding-name=MP2TS " ! rtpmp2tdepay ! mpegtsdemux ! queue !
ffdec_mpeg2video ! ffmpegcolorspace ! xvimagesink

But when i try to transform the same pipeline in c code i got error :
 Could not link ffdemux_mpegts0 to videoqueue. 

Here is my code given below. Can some body help me out what is the problem
here.


#define VIDEO_CAPS
"application/x-rtp,media=video/mpegts,payload=(int)33,clock-rate=(int)90000,
encoding-name=MP2TS"
#define VIDEO_SINK  "xvimagesink"  
#define VIDEO_DEC "ffdec_mpeg2video"

pipeline = gst_pipeline_new (NULL);  
	g_assert (pipeline);  
	 
	rtpsrc = gst_element_factory_make ("udpsrc", "rtpsrc");  
	g_assert (rtpsrc);  
		
	printf("\n Creating rtpbin element ");
	rtpbin = gst_element_factory_make ("gstrtpbin", "rtpbin");  
																												g_object_set (rtpsrc, "port", 51000, NULL); 
	printf("\n set caps on the udpsrc for the RTP data \n");
	caps = gst_caps_from_string (VIDEO_CAPS);  
	g_object_set (rtpsrc, "caps", caps, NULL);  
	gst_caps_unref (caps);  	
	gst_bin_add_many (GST_BIN (pipeline), rtpsrc, NULL); //Working only
	jitterbuffer = gst_element_factory_make
("gstrtpjitterbuffer","jitterbuffer");
  	g_assert (jitterbuffer); 

	videodepay = gst_element_factory_make ("rtpmp2tdepay", "videodepay");
	g_assert (videodepay); 
	
	GstElement *demux = gst_element_factory_make ("ffdemux_mpegts", NULL);
	g_assert (demux);
       
        videodec = gst_element_factory_make (VIDEO_DEC, "videodec"); 
	g_assert (videodec); 

	videoqueue=gst_element_factory_make ("queue","videoqueue");  
	g_assert(videoqueue);  

	tee = gst_element_factory_make ("tee","tee");  
	g_assert(tee);  

	videoconv = gst_element_factory_make ("ffmpegcolorspace", "videoconv");  
	g_assert (videoconv);  
	  
	videosink = gst_element_factory_make (VIDEO_SINK, "videosink");  
	g_assert (videosink);  
	
	GstElement *parse = gst_element_factory_make ("mpegtsparse","parse");
	g_assert(parse);	 
  
  
  g_object_set (G_OBJECT (videoqueue), "max-size-bytes", 0, NULL);
  g_object_set (G_OBJECT (videoqueue), "max-size-buffers", 0, NULL);
  g_object_set (G_OBJECT (videoqueue), "max-size-time", 500000, NULL);

 gst_bin_add_many (GST_BIN
(pipeline),jitterbuffer,tee,videodepay,demux,videoqueue,videodec,videoconv,videosink,NULL);
	
	if (!gst_element_link(jitterbuffer, tee))
	{
		link_error(jitterbuffer, tee);
		return FALSE;
	} 
	else if (!gst_element_link(tee,videodepay)) 
	{
		link_error(tee,videodepay);
		return FALSE;
	}
	else if (!gst_element_link(videodepay,demux)) 
	{
		link_error(videodepay,demux);
		return FALSE;
	} 
	else if (!gst_element_link(demux, videoqueue)) 
	{
		link_error(demux, videoqueue);
		return FALSE;
	} 
	else if (!gst_element_link(videoqueue,videodec))
	{
	  link_error(videoqueue,videodec);
	  return FALSE;
        } 
	else if (!gst_element_link(videodec,videoconv))
	{
	  link_error(videodec,videoconv);
	  return FALSE;
        } 
	else if (!gst_element_link(videoconv,videosink))
	{
	  link_error(videoconv,videosink);
	  return FALSE;
        }

gst_bin_add (GST_BIN (pipeline), rtpbin); 
	srcpad = gst_element_get_static_pad (rtpsrc, "src");  
	sinkpad = gst_element_get_request_pad (rtpbin, "recv_rtp_sink_%d");  
	lres = gst_pad_link (srcpad, sinkpad);  
	g_assert (lres == GST_PAD_LINK_OK);  
	gst_object_unref (srcpad);  

	g_signal_connect (rtpbin, "pad-added", G_CALLBACK
(pad_added_cb),jitterbuffer);  
 
	g_print ("starting receiver pipeline\n");  
	gst_element_set_state (pipeline, GST_STATE_PLAYING);  

	 
	loop = g_main_loop_new (NULL, FALSE);  
	g_main_loop_run (loop);  	 

	return 0;





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list