help: how to use "mpegdemux" and "mpeg2dec" to decode mpeg files?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

help: how to use "mpegdemux" and "mpeg2dec" to decode mpeg files?

minjun
Hello, everyone:
     I am a newbie to use gstreamer, and I want to write one program to decode one mpeg file and display the video on the gtk+ drawingarea widgets; but I am failed. I need your help, thank you!

    usally, I use such one command:
          gst-launch filesrc location="test.mpg" ! mpegdemux ! mpeg2dec ! xvimagesink
    and I managed to display the video;

   Now, I want to write my own program to do it. I meet two problems.
   1) how should I use "mpegdemux" and "mpeg2dec" in my program?
   related code is here:
========
         datasource = gst_element_factory_make ("filesrc", "mpegfile");
         g_object_set(G_OBJECT(datasource), "location", "/home/minjun/test.mpg", NULL);
         demuxer = gst_element_factory_make("mpegdemux", "demux");
         gst_bin_add(GST_BIN(pipeline), datasource);
         gst_bin_add(GST_BIN(pipeline), demuxer);
   
         gst_element_link_pads(datasource, "src", demuxer, "sink");
   
         decoder = gst_element_factory_make("mpeg2dec", "decoder");
         gst_bin_add(GST_BIN(pipeline), decoder);
         gst_element_link_pads(demuxer, "src", decoder, "sink");
         sink = gst_element_factory_make ("xvimagesink", "xvimagesink");
         gst_bin_add(GST_BIN(pipeline), sink);

===================Is there something wrong? thank you.

   2) how should I to display video contents on one drawingarea widget?
     I use "gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_MESSAGE_SRC(message)), GDK_DRAWABLE_XID(screen->window));" in the callback function for "expose-event". Is it right?

thank you!

--
Best regards,

Minjun
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel