Hi,
I am trying to use the input-selector element of gstreamer in my custom pipeline to select the desired media (ogg) file to play. the pipeline I was using is as below: filesrc --> queue - | ---------- -->| | | I/P | | Selector|--> oggdemux --> theoradec --> ffmpegcolorspace --> autovideosink -->| | | ---------- filesrc -> queue - I tried to activate sinkpad1 of the input-selector element, but I am getting following error: Erplaybin2ror: Internal data flow error. Please suugest the resolution. Best Regards, Rohit ================================ The source code I wrote is as below: #include <gst/gst.h> #include <string.h> #include <stdio.h> #include <termios.h> #include <unistd.h> #include <ctype.h> /* Global variables */ GstElement *pipeline,*source,*demuxer,*vid_decoder,*vid_convert,*vid_sink,*vid_queue; GstElement *selector,*source1,*vid_queue1; GMainLoop *loop; GstBus *bus; /* Call back function for the message signal over the bus */ static gboolean bus_call (GstBus * bus, GstMessage * msg, gpointer data) { GMainLoop *loop = (GMainLoop *) data; switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_EOS:{ g_print ("End-of-stream\n"); g_main_loop_quit (loop); break; } case GST_MESSAGE_ERROR:{ gchar *debug; GError *err; gst_message_parse_error (msg, &err, &debug); g_free (debug); g_print ("Erplaybin2ror: %s\n", err->message); g_error_free (err); g_main_loop_quit (loop); break; } default: break; } return TRUE; } /* Callback function for the dynamic pad created */ static void on_pad_added(GstElement *element,GstPad *pad,gpointer a_data) { GstPad *SinkPad; GstStructure *str; GstCaps *caps; caps = gst_pad_get_caps(pad); str = gst_caps_get_structure(caps,0); /* Audio demuxed pad created */ if(g_strrstr(gst_structure_get_name(str),"audio")) { #if 0 g_print("Dynamic pad created,linking the demuxer and audio decoder \n"); SinkPad = gst_element_get_static_pad(aud_queue,"sink"); if(gst_pad_link(pad,SinkPad)) { g_print("\n Cannot link the demuxer with the audio decoder \n"); } gst_object_unref(SinkPad); if(!gst_element_link_many(aud_queue,aud_decoder,aud_convert,aud_sink,NULL)) { g_print("Failed to link one or more element \n"); } #endif } else { /* Video Demuxed pad created */ g_print("\n Dynamic pad created,linking the demuxer and video decoder \n"); //SinkPad = gst_element_get_static_pad(vid_queue,"sink"); SinkPad = gst_element_get_static_pad(vid_decoder,"sink"); if(gst_pad_link(pad,SinkPad)) { g_print("\n Cannot link the demuxer with the video decoder \n"); } gst_object_unref(SinkPad); if(!gst_element_link_many(/*vid_queue,*/vid_decoder,vid_convert,vid_sink,NULL)) { g_print("Failed to link one or more element \n"); } } } /* Main */ gint main (gint argc, gchar * argv[]) { GstPad *sinkpad0, *sinkpad1, *srcpad0, *srcpad1; gst_init (&argc, &argv); if (argc < 3) { g_print ("usage: %s <media file or uri> <media file or uri>\n", argv[0]); return 1; } /* Get all the elements */ pipeline = gst_pipeline_new("ogg_player"); source = gst_element_factory_make("filesrc","file-source"); demuxer = gst_element_factory_make("oggdemux","ogg-demux"); vid_decoder = gst_element_factory_make("theoradec","theora-decoder"); vid_convert = gst_element_factory_make("ffmpegcolorspace","colorspaceconverter"); vid_sink = gst_element_factory_make("autovideosink","video-output"); vid_queue = gst_element_factory_make("queue","video-output-queue"); if (!pipeline || !source || !demuxer || !vid_decoder || !vid_convert || !vid_sink || !vid_queue) { g_print("\n One or more element is not created \n"); } g_object_set (G_OBJECT (source), "location", argv[1], NULL); selector = gst_element_factory_make("input-selector","inputselector"); source1 = gst_element_factory_make("filesrc","file-source-1"); vid_queue1 = gst_element_factory_make("queue","video-output-queue-1"); if (!selector || !source1 || !vid_queue1) { g_print("\n One or more element is not created \n"); } g_object_set (G_OBJECT (source1), "location", argv[2], NULL); /* create and event loop and feed gstreamer bus mesages to it */ loop = g_main_loop_new (NULL, FALSE); bus = gst_pipeline_get_bus (GST_PIPELINE(pipeline)); gst_bus_add_watch (bus, bus_call, loop); g_object_unref (bus); /* Add the elements into the pipeline */ gst_bin_add_many (GST_BIN(pipeline), source, demuxer, vid_decoder, vid_convert, vid_sink, vid_queue, NULL); gst_bin_add_many (GST_BIN(pipeline), source1, selector, vid_queue1, NULL); gst_element_link (source, vid_queue); gst_element_link (source1, vid_queue1); srcpad0 = gst_element_get_static_pad (vid_queue, "src"); srcpad1 = gst_element_get_static_pad (vid_queue1, "src"); sinkpad0 = gst_element_get_request_pad (selector, "sink0"); sinkpad1 = gst_element_get_request_pad (selector, "sink1"); if (gst_pad_link (srcpad0, sinkpad0)) { g_print("\n Cannot link the vid_queue with the selector \n"); } if (gst_pad_link (srcpad1, sinkpad1)) { g_print("\n Cannot link the vid_queue1 with the selector \n"); } if (!gst_element_link (selector, demuxer)) { g_print("\n Cannot link selector with the demuxer \n"); return 0; } gst_element_set_state (selector, GST_STATE_PAUSED); g_object_set (G_OBJECT(selector), "active-pad", sinkpad0, NULL); g_print ("\n Back to main() outside of gst_input_selector_set_property()\n"); g_print("\n selector and demuxer are now connected \n"); g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), NULL); gst_element_set_state (pipeline, GST_STATE_PLAYING); g_main_loop_run (loop); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (sinkpad0); gst_object_unref (sinkpad1); gst_object_unref (srcpad0); gst_object_unref (srcpad1); g_object_unref (pipeline); //g_object_unref (loop); return 0; } _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |