Just for knowledge....<br>
I was able to avoid the 100% CPU usage doing these changes to the fakesrc example on the gst manual (note that I&#39;ve used the directdrawsink and not the xvimagesink):<br><br>static void<br>cb_handoff (GstElement *fakesrc,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GstBuffer&nbsp; *buffer,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GstPad&nbsp;&nbsp;&nbsp;&nbsp; *pad,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gpointer&nbsp;&nbsp;&nbsp; user_data)<br>{<br>&nbsp;&nbsp;&nbsp; static gboolean white = FALSE;<br><br>&nbsp;&nbsp;&nbsp; GTimeVal gtime;<br>&nbsp;&nbsp;&nbsp; g_get_current_time(&amp;gtime);<br><br>&nbsp;&nbsp;&nbsp; GstClockTime gstClock=GST_TIMEVAL_TO_TIME(gtime);
<br><br>//basetime is a static GstClockTime var<br>&nbsp;&nbsp;&nbsp; buffer-&gt;timestamp= gstClock-baseTime;<br><br>&nbsp;&nbsp;&nbsp; memset (GST_BUFFER_DATA (buffer), white ? 0xff : 0x0,<br>&nbsp;&nbsp;&nbsp; &nbsp; GST_BUFFER_SIZE (buffer));<br>&nbsp;&nbsp;&nbsp; white = !white;<br>
<br>}<br><br><br><br>gint<br>main (gint&nbsp;&nbsp; argc,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gchar *argv[])<br>{<br>&nbsp; GstElement *pipeline, *fakesrc, *flt, *conv, *videosink,*parDDSink;<br>&nbsp; GMainLoop *loop;<br>&nbsp; GstBus* bus;<br><br>&nbsp; /* init GStreamer */<br>
&nbsp; gst_init (&amp;argc, &amp;argv);<br>&nbsp; loop = g_main_loop_new (NULL, FALSE);<br><br>&nbsp; /* setup pipeline */<br>&nbsp; pipeline = gst_pipeline_new (&quot;pipeline&quot;);<br>&nbsp; fakesrc = gst_element_factory_make (&quot;fakesrc&quot;, &quot;source&quot;);
<br><br>&nbsp; gst_base_src_set_format((GstBaseSrc*)fakesrc,GST_FORMAT_TIME);<br><br>&nbsp; flt = gst_element_factory_make (&quot;capsfilter&quot;, &quot;flt&quot;);<br>&nbsp; conv = gst_element_factory_make (&quot;ffmpegcolorspace&quot;, &quot;conv&quot;);
<br>&nbsp; videosink = gst_element_factory_make (&quot;directdrawsink&quot;, &quot;directdraw&quot;);<br>&nbsp; parDDSink = gst_element_factory_make (&quot;capsfilter&quot;, &quot;ddSinkPar&quot;);<br>&nbsp; /* setup */<br>&nbsp; g_object_set (G_OBJECT (flt), &quot;caps&quot;,
<br>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_caps_new_simple (&quot;video/x-raw-rgb&quot;,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &quot;width&quot;, G_TYPE_INT, 384,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &quot;height&quot;, G_TYPE_INT, 288,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &quot;framerate&quot;, GST_TYPE_FRACTION, 1, 1,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &quot;bpp&quot;, G_TYPE_INT, 16,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &quot;depth&quot;, G_TYPE_INT, 16,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &quot;endianness&quot;, G_TYPE_INT, G_BYTE_ORDER,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; NULL), NULL);
<br><br><br>&nbsp; g_object_set (G_OBJECT(parDDSink), &quot;caps&quot;,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_caps_new_simple (&quot;video/x-raw-rgb&quot;,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;width&quot;, G_TYPE_INT, 384,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;height&quot;, G_TYPE_INT, 288,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;framerate&quot;,GST_TYPE_FRACTION, 1, 1),<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL);<br><br>&nbsp; gst_bin_add_many (GST_BIN (pipeline), fakesrc, flt,conv,parDDSink, videosink, NULL);<br><br>&nbsp; gst_element_link_many (fakesrc, flt, conv, parDDSink,videosink, NULL);
<br><br><br>&nbsp; bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br>&nbsp; gst_bus_add_watch (bus, bus_call, loop);<br>&nbsp; gst_object_unref (bus);<br><br>&nbsp; /* setup fake source */<br>&nbsp; g_object_set (G_OBJECT (fakesrc),<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;signal-handoffs&quot;, TRUE,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;sizemax&quot;, 384 * 288 * 2,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;sizetype&quot;, 2, NULL);<br>&nbsp; g_signal_connect (fakesrc, &quot;handoff&quot;, G_CALLBACK (cb_handoff), NULL);<br><br>&nbsp; /* play */<br>&nbsp; gst_element_set_state (pipeline, GST_STATE_PLAYING);
<br><br>&nbsp; GstClock *clock;<br>&nbsp; clock=gst_pipeline_get_clock ((GstPipeline*)pipeline);<br>&nbsp; baseTime=gst_clock_get_time(clock);<br><br>&nbsp; g_main_loop_run (loop);<br><br>&nbsp; /* clean up */<br>&nbsp; gst_element_set_state (pipeline, GST_STATE_NULL);
<br>&nbsp; gst_object_unref (GST_OBJECT (pipeline));<br><br>&nbsp; return 0;<br>}<br><br><br>Simply I&#39;ve done some add on the time management, unfortunately I can&#39;t reach the flow control of 1fps and the video is flickering as fast as it can with a strange behaviour: if I run the example with GST_DEBUG &gt;= 3 the fps is exactly 1, this is a very mistery for me....
<br><br>Hope that&#39;s helpfull for some of you.<br><br>Regards.<br><br><br><br clear="all"><br>-- <br>Riccardo Corona