Hello, everyone:<br> 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! <br><br>
usally, I use such one command:<br> gst-launch filesrc location="test.mpg" ! mpegdemux ! mpeg2dec ! xvimagesink<br> and I managed to display the video; <br><br> Now, I want to write my own program to do it. I meet two problems.
<br> 1) how should I use "mpegdemux" and "mpeg2dec" in my program?<br> related code is here:<br>========<br> datasource = gst_element_factory_make ("filesrc", "mpegfile");
<br> g_object_set(G_OBJECT(datasource), "location", "/home/minjun/test.mpg", NULL);<br> demuxer = gst_element_factory_make("mpegdemux", "demux");<br> gst_bin_add(GST_BIN(pipeline), datasource);
<br> gst_bin_add(GST_BIN(pipeline), demuxer);<br> <br> gst_element_link_pads(datasource, "src", demuxer, "sink");<br> <br> decoder = gst_element_factory_make("mpeg2dec", "decoder");
<br> gst_bin_add(GST_BIN(pipeline), decoder);<br> gst_element_link_pads(demuxer, "src", decoder, "sink");<br> sink = gst_element_factory_make ("xvimagesink", "xvimagesink");
<br> gst_bin_add(GST_BIN(pipeline), sink);<br><br>===================Is there something wrong? thank you.<br><br> 2) how should I to display video contents on one drawingarea widget? <br> 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?
<br><br>thank you!<br clear="all"><br>-- <br>Best regards,<br><br>Minjun