[gst-devel] help: how to use "mpegdemux" and "mpeg2dec" to decode mpeg files?

minjun bitzilla at gmail.com
Tue Jan 15 06:55:37 CET 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20080115/1c6299fe/attachment.htm>


More information about the gstreamer-devel mailing list