gst-launch works, but fails in application

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

gst-launch works, but fails in application

ding huah cheng
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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst-launch works, but fails in application

michael smith-6-3
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 <[hidden email]> 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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel