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