[gst-devel] Please hepl me to ignore the error in code to run a mpeg file

Thomas Vander Stichele thomas at apestaart.org
Thu Aug 25 02:20:19 CEST 2005


Hi,

why are the lines that actually add your bins to the main pipeline
commented out ?

Also, in general, it's a lot easier if you make it so that it's a
trivial thing for someone to save your file, compile and run it in one
go.  Easiest is if you have it in some project that people can check out
and build.  I always have to force myself to read over code that I can't
just run without fiddling with compilers and pkg-config, I suspect other
people have the same thing.

Thomas

On Thu, 2005-08-25 at 10:53 +0530, soma dutta banik wrote:
> Hi all.
> Please help me about the code....I write the code to run a mpeg file....
> The code is
> =================================
> #include <gst/gst.h>
> #include <string.h>
> 
> static void
> cb_signal(GstElement *demux, GstPad *pad, GstElement *main_thread)
> {
> 	g_print ("New pad %s created\n", gst_pad_get_name (pad));
> 	if (!strncmp("video_", gst_pad_get_name (pad), 6)) {
> 		GstElement *vid_q, *vid_dec, *vid_sink, *vid_bin , *vid_filter, *vid_sdlsink;
> 
> 		vid_bin = gst_thread_new ("vid_bin");
> 		vid_q = gst_element_factory_make ("queue", "vid_q");
> 		vid_dec = gst_element_factory_make ("mpeg2dec" , "vid_dec");
> 		vid_sink = gst_element_factory_make ("videomixer", "vid_sink");
> 		vid_filter = gst_element_factory_make ("alpha", "vid_filter");
> 		vid_sdlsink = gst_element_factory_make ("sdlvideosink", "vid_sdlsink");
> 		gst_bin_add_many(GST_BIN(vid_bin), vid_q, vid_dec,vid_filter, vid_sink, NULL);
> 		//gst_element_link_many(vid_q, vid_dec, vid_filter, vid_sink,
> vid_sdlsink,  NULL);
> 
> 		gst_element_link(vid_q, vid_dec);
> 		gst_element_link(vid_dec, vid_filter);
> 		gst_pad_link(gst_element_get_pad(vid_filter, "src"),
> gst_element_get_pad(vid_sink, "sink_00"));
> 		gst_element_link(vid_sink, vid_sdlsink);
> 	
> 
> 		gst_element_add_ghost_pad(vid_bin,
> 				 gst_element_get_pad(vid_q, "sink"), "sink");
> 	//	gst_bin_add(GST_BIN(main_thread), vid_bin); 
> 		gst_pad_link(pad, gst_element_get_pad(vid_bin, "sink"));
> 		g_print("%s:%d\n",__FUNCTION__,__LINE__);
> 		gst_element_set_state(GST_ELEMENT(vid_bin), GST_STATE_PLAYING);
> 		g_print("%s:%d\n",__FUNCTION__,__LINE__);
> 
> 	} else if (!strncmp("audio_", gst_pad_get_name (pad), 6)) {
> 		GstElement *aud_q, *aud_dec, *aud_sink, *aud_bin;
> 
> 		aud_bin = gst_thread_new("aud_bin");
> 		aud_q = gst_element_factory_make("queue", "aud_q");
> 		aud_dec = gst_element_factory_make("mad" , "aud_dec");
> 		aud_sink = gst_element_factory_make("osssink", "aud_sink");
> 
> 		gst_bin_add_many(GST_BIN(aud_bin), aud_q,
> 				aud_dec, aud_sink, NULL);
> 		gst_element_link_many(aud_q, aud_dec, aud_sink, NULL);
> 
> 		gst_element_add_ghost_pad(aud_bin,
> 				 gst_element_get_pad(aud_q, "sink"), "sink");
> 
> 		//gst_bin_add(GST_BIN(main_thread), GST_ELEMENT(aud_bin)); 
> 		gst_pad_link(pad, gst_element_get_pad(aud_bin, "sink"));
> 
> 		gst_element_set_state(GST_ELEMENT(aud_bin), GST_STATE_PLAYING);
> 	} else {
> 		g_print("Unhandled case\n");
> 	}
> }
> 
> int main (int argc, char *argv[])
> {
> 	GstElement *src, *demux, *main_thread;
> 	if (argc !=2) {
> 		g_print("Usage: ./a.out <MPEG Filename>\n");
> 		return 0;
> 	}
> 
> 	gst_init(&argc, &argv);
> 
> 	main_thread = gst_thread_new("main_thread");
> 	
> 	src = gst_element_factory_make ("filesrc", "src");
> 	g_object_set(G_OBJECT(src), "location", argv[1], NULL);
> 	demux = gst_element_factory_make ("mpegdemux", "demux");
> 	g_print("%s:%d\n",__FUNCTION__,__LINE__);
> 	g_signal_connect(G_OBJECT(demux), "new-pad",
> 			G_CALLBACK(cb_signal), main_thread);
> 	g_print("%s:%d\n",__FUNCTION__,__LINE__);
> 	gst_bin_add(GST_BIN(main_thread), src);
> 	gst_bin_add(GST_BIN(main_thread), demux);
> 	gst_element_link(src, demux);
> 	
> 	g_print("%s:%d\n",__FUNCTION__,__LINE__);
> 	gst_element_set_state(GST_ELEMENT(main_thread), GST_STATE_PLAYING);
> 	g_print("Iterating over pipeline\n");
> 	while (gst_bin_iterate (GST_BIN (main_thread)));
> 
> 	gst_object_unref (GST_OBJECT (main_thread));
> 	exit(0);
> }
> 
> 
> =================================
> But it gives the following error message....in run time
> 
> (process:4126): GStreamer-WARNING **: internal error: push on pad
> vid_sdlsink:sink but it has no chainhandler
> 
> (process:4126): GStreamer-WARNING **: pushing data on non-negotiated
> pad demux:audio_00, not allowed.
> 
> Please suggest me what to do..
> Thanks
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

Dave/Dina : future TV today ! - http://www.davedina.org/
<-*- thomas (dot) apestaart (dot) org -*->
Death, where is thy sting?
Grave, where is thy victory? 
<-*- thomas (at) apestaart (dot) org -*->
URGent, best radio on the net - 24/7 ! - http://urgent.fm/







More information about the gstreamer-devel mailing list