[gst-devel] Error in my pipe?

Wim Taymans wim.taymans at gmail.com
Thu Feb 3 18:39:22 CET 2011


On 02/03/2011 05:57 PM, StyveA wrote:
> I really don't understand where is my error...
Check out the part in the manual about dynamic pads. You need to connect to
the pad-added signal from decodebin.

Wim

> I've launch this line :
>
> gst-launch filesrc location=test.avi ! avidemux name=demux   demux.video_00
> ! decodebin ! ffmpegcolorspace ! videoscale ! autovideosink
>
> and my video works fine..
>
> But when I do this :
> //-----------------------------CODE--------------
> int main (int argc, char *argv[])
> {
>     GstElement *pipe,*src, *dec,*ffm,*scale, *sink;
>     GstMessage *msg;
>     gst_init (&argc,&argv);
>
>        loop = g_main_loop_new (NULL, FALSE);
>     if (argc<  2)
>         g_error ("Usage: %s<path to file>", argv[0]);
>
>     pipe = gst_pipeline_new ("pipeline");
>     src = gst_element_factory_make ("filesrc", "src");
>     gst_bin_add (GST_BIN (pipe), src);
>     g_object_set (src, "location", argv[1], NULL); //essayer avec dec au lieu
> de src
>     dec = gst_element_factory_make ("decodebin", "decoder");
>     gst_bin_add (GST_BIN (pipe), dec);
>     ffm = gst_element_factory_make ("ffmpegcolorspace", NULL);
>     gst_bin_add (GST_BIN (pipe), ffm);
>     scale = gst_element_factory_make ("videoscale", NULL);
>     gst_bin_add (GST_BIN (pipe), scale);
>     sink = gst_element_factory_make ("autovideosink", "sink");
>     gst_bin_add (GST_BIN (pipe), sink);
>     g_signal_connect (dec, "pad-added", G_CALLBACK (on_new_pad), sink);
>
>    gst_element_link_many (src,dec,ffm,scale,sink, NULL);
>
> if(!pipe || !dec || !sink || !src || !scale || !ffm)
>     g_print ("error...\n");
>
>     gst_element_set_state (pipe, GST_STATE_PLAYING);
>
>     g_print ("Running...\n");
>     g_timeout_add (5000, get_me_out, NULL);
>     g_main_loop_run (loop);
> /* Out of the main loop, clean up nicely */
>     g_print ("Returned, stopping playback\n");
>     gst_element_set_state (pipe, GST_STATE_NULL);
>     g_print ("Deleting pipeline\n");
>     gst_object_unref (GST_OBJECT (pipe));
>
>
>     return 0;
>
> }
> //-----------------------------END---------------
>
> I have nothing that shows up ! Just the "running..." message, but no video..
> I really don't get it..





More information about the gstreamer-devel mailing list