gst-launch works, but fails in application

Michael Smith msmith at xiph.org
Fri Feb 25 15:23:46 PST 2011


You're not dealing with dynamic pads (as used by decodebin2) correctly.

gst-launch does that for you automatically. You're also not checking any of
your return values - if you were, you'd see that your gst_element_link_many
call is failing.

Mike


On Fri, Feb 25, 2011 at 2:59 PM, ding cheng <dingchengus1 at yahoo.com> wrote:

> gst-launch filesrc location=h264.mp4 ! decodebin2 ! videoscale !
> xvimagesink
>
> This command works, but I convert it to C application, it fails. Any
> suggestion ?
>
>
> ---------------------------------------------------------------------------------------------------------
>    gst_init(&argc, &argv);
>    loop = g_main_loop_new(NULL, FALSE);
>    pipeline = gst_pipeline_new("my-pipeline");
>    src = gst_element_factory_make("filesrc", "src");
>    g_object_set (G_OBJECT (usrc),"location","h264.mp4", NULL);
>    decode = gst_element_factory_make("decodebin2", "decode");
>    scale = gst_element_factory_make("videoscale", "scale");
>    sink = gst_element_factory_make("xvimagesink", "sink");
>    gst_bin_add_many(GST_BIN(pipeline), src, decode, scale,  sink, NULL);
>    gst_element_link_many(src, decode, scale, sink, NULL);
>    gst_element_set_state(pipeline, GST_STATE_PLAYING);
>    if (gst_element_get_state(pipeline, NULL, NULL, -1) ==
> ST_STATE_CHANGE_FAILURE)
>          g_error("Failed to go into PLAYING state");
>    g_main_loop_run(loop);
>    gst_element_set_state(pipeline, GST_STATE_NULL);
>    gst_object_unref(pipeline);
>
> -----------------------------------------------------------------------------------------------
> Thanks,
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110225/7d50091d/attachment.html>


More information about the gstreamer-devel mailing list