gst-launch pipeline vs its exact C analog

Stefan Sauer ensonic at hora-obscura.de
Wed Mar 28 03:50:46 PDT 2012


On 03/28/2012 11:13 AM, Sergei Vorobyov wrote:
> Hi!
>
> Your help will be greatly appreciated.
>
> I am struggling to understand and wondering why
>
> gst-launch filesrc location=file.avi ! decodebin2 ! ffmpegcolorspace !
> autovideosink
>
> works just fine as expected, whereas its straightforward C-programmed analog
>
>   src = gst_element_factory_make ("filesrc", "source");
>   g_object_set (src, "location", "file.avi", NULL);
>
>   dec = gst_element_factory_make ("decodebin2", "decoder"); // won't
> link to the next
>   conv = gst_element_factory_make ("ffmpegcolorspace", "ffmpeg-colorspace");
>   sink = gst_element_factory_make ("autovideosink", "sink");
>
>   gst_bin_add_many (GST_BIN (pipeline),
> 		    src,
> 		    dec,
> 		    conv,
> 		    sink, NULL);
>
>   if (!gst_element_link (src, dec)) {
>     g_print("cannot link src and dec\n");
>     return -1;
>   }
>
>   if (!gst_element_link (dec, conv)) { // FAILS here
>     g_print("cannot link dec and conv\n");
>     return -1;
>   }
>
> reports "cannot link dec and conv", i.e., gst_element_link (dec, conv) FAILS.
FAQ. Please read up on sometimes pads and look at the docs for the
GstElement pad-added signal.

Stefan

> If I take away return -1, allowing it to proceed, it results in:
>
> Error from element avidemux0: Internal data stream error.
> Debug: gstavidemux.c(5204): gst_avi_demux_loop ():
> /GstPipeline:length/GstDecodeBin2:decoder/GstAviDemux:avidemux0:
> streaming stopped, reason not-linked
>
> caught in the callback for the loop/pipeline
>
>
>     if (msg_type & GST_MESSAGE_ERROR) {
>       g_print ("ERROR message\n");
>       gchar *debug;
>       GError *err;
>
>       gst_message_parse_error (msg, &err, &debug);
>       g_free (debug);
>
>       g_print ("Error from element %s: %s\n",
> 	       GST_OBJECT_NAME (msg->src),
> 	       err->message);
>       g_print ("Debug: %s\n", (debug) ? debug : "none");
>       g_error_free (err);
>       g_free (debug);
>
>       g_main_loop_quit (loop);
>     }
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list