gst-launch works, but fails in application

ding cheng dingchengus1 at yahoo.com
Fri Feb 25 14:59:42 PST 2011


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,


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110225/5736a3bf/attachment.htm>


More information about the gstreamer-devel mailing list