Hi,<br>thank&#39;s for the tips. When I told that I&#39;ve started from GstPluginTemplate I mean something like this:<br><br>GST_BOILERPLATE (GstPluginTemplate, gst_plugin_template, GstBaseSrc,<br>&nbsp;&nbsp;&nbsp; GST_TYPE_ELEMENT);<br>
<br>Is it what did you mean?<br><br><br><div><span class="gmail_quote">2007/6/28, René Stadler &lt;<a href="mailto:mail@renestadler.de">mail@renestadler.de</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Am Donnerstag, den 28.06.2007, 13:09 +0200 schrieb Riccardo Corona:<br>&gt; Hi,<br>&gt; I&#39;m writing a source plugin, I&#39;m started from GstPluginTemplate to<br>&gt; make a simple plugin that generate only B&amp;W frames...
<br>&gt; The problem is that with this pipeline:<br>&gt;<br>I strongly suggest deriving from GstBaseSrc instead.<br><br><br>&gt; mysrc ! ffmpegcolorspace ! directdrawsink<br>&gt;<br>&gt; the pipeline is blocked on PREROLLING and in debug mode I can see that
<br>&gt; the last state of my plugin is PAUSED.<br>&gt; Here the snipped of code in which I set the buffer:<br>&gt;<br>&gt;<br>&gt;<br>&gt; /* get_range function<br>&gt;&nbsp;&nbsp;* makes it a source of a stream<br>&gt;&nbsp;&nbsp;*/<br>&gt; static gboolean gst_plugin_template_get_range (GstPad *pad, guint64
<br>&gt; offset, guint lenght, GstBuffer **buf)<br>&gt; {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; static&nbsp;&nbsp;gboolean white=1;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; GstPluginTemplate *plug= GST_PLUGIN_TEMPLATE (GST_OBJECT_PARENT<br>&gt; (pad) );<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GstBuffer *buffer;
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gint size, width, height, bpp;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width = 320; height = 240; bpp = 16;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size = width * height * bpp;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer = gst_buffer_new();<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GST_BUFFER_SIZE (buffer) = size;
<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; if (white)GST_BUFFER_MALLOCDATA (buffer) =&nbsp;&nbsp;g_memdup (0xff,size);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else GST_BUFFER_MALLOCDATA (buffer) =&nbsp;&nbsp;g_memdup (0x0,size);<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; white=!white;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
<br>&gt;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; ts = gst_util_uint64_scale_int (frame_num * GST_SECOND, FPS_DEN,<br>&gt; FPS_NUM);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; next_ts = gst_util_uint64_scale_int ((frame_num + 1) * GST_SECOND,<br>&gt; FPS_DEN,&nbsp;&nbsp;FPS_NUM);<br>
&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; GST_BUFFER_TIMESTAMP (buffer) = ts;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; GST_BUFFER_DURATION (buffer) = next_ts-ts;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; frame_num++;<br>&gt;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; return gst_pad_push (plug-&gt;srcpad, buffer);<br>&gt;
<br>&gt; }<br>&gt;<br>This is completely wrong.&nbsp;&nbsp;In a get_range function, you are supposed to<br>return the buffer to the supplied location!&nbsp;&nbsp;Take a look at<br>gstreamer/docs/design/part-scheduling.txt [1] and other docs in that
<br>directory to get some insight.<br><br>[1]:<br><a href="http://webcvs.freedesktop.org/gstreamer/gstreamer/docs/design/part-scheduling.txt?view=markup">http://webcvs.freedesktop.org/gstreamer/gstreamer/docs/design/part-scheduling.txt?view=markup
</a><br>&gt;<br>&gt; I thought that setting the timestamp is enough to have continuosly a<br>&gt; stream of images but it seems that I&#39;m wrong.<br>&gt; Do I must force the state of the plugin in PLAY mode?<br>&gt; Or maybe I&#39;m wrong with the buffer management?
<br>&gt;<br>&gt; Any help will be very appreciate becouse I&#39;m new to plugin writing...<br>&gt;<br>&gt;<br>&gt; Best Regards.<br>&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; Riccardo Corona<br><br>--<br>Regards,<br>&nbsp;&nbsp;René Stadler
<br><br></blockquote></div><br><br clear="all"><br>-- <br>Riccardo Corona