Hi,<br>thank's for the tips. When I told that I've started from GstPluginTemplate I mean something like this:<br><br>GST_BOILERPLATE (GstPluginTemplate, gst_plugin_template, GstBaseSrc,<br> GST_TYPE_ELEMENT);<br>
<br>Is it what did you mean?<br><br><br><div><span class="gmail_quote">2007/6/28, René Stadler <<a href="mailto:mail@renestadler.de">mail@renestadler.de</a>>:</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>> Hi,<br>> I'm writing a source plugin, I'm started from GstPluginTemplate to<br>> make a simple plugin that generate only B&W frames...
<br>> The problem is that with this pipeline:<br>><br>I strongly suggest deriving from GstBaseSrc instead.<br><br><br>> mysrc ! ffmpegcolorspace ! directdrawsink<br>><br>> the pipeline is blocked on PREROLLING and in debug mode I can see that
<br>> the last state of my plugin is PAUSED.<br>> Here the snipped of code in which I set the buffer:<br>><br>><br>><br>> /* get_range function<br>> * makes it a source of a stream<br>> */<br>> static gboolean gst_plugin_template_get_range (GstPad *pad, guint64
<br>> offset, guint lenght, GstBuffer **buf)<br>> {<br>> static gboolean white=1;<br>><br>> GstPluginTemplate *plug= GST_PLUGIN_TEMPLATE (GST_OBJECT_PARENT<br>> (pad) );<br>><br>> GstBuffer *buffer;
<br>> gint size, width, height, bpp;<br>> width = 320; height = 240; bpp = 16;<br>> size = width * height * bpp;<br>> buffer = gst_buffer_new();<br>> GST_BUFFER_SIZE (buffer) = size;
<br>><br>> if (white)GST_BUFFER_MALLOCDATA (buffer) = g_memdup (0xff,size);<br>> else GST_BUFFER_MALLOCDATA (buffer) = g_memdup (0x0,size);<br>><br>> white=!white;<br>><br>> GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
<br>><br>><br>> ts = gst_util_uint64_scale_int (frame_num * GST_SECOND, FPS_DEN,<br>> FPS_NUM);<br>> next_ts = gst_util_uint64_scale_int ((frame_num + 1) * GST_SECOND,<br>> FPS_DEN, FPS_NUM);<br>
><br>> GST_BUFFER_TIMESTAMP (buffer) = ts;<br>> GST_BUFFER_DURATION (buffer) = next_ts-ts;<br>><br>> frame_num++;<br>><br>><br>> return gst_pad_push (plug->srcpad, buffer);<br>>
<br>> }<br>><br>This is completely wrong. In a get_range function, you are supposed to<br>return the buffer to the supplied location! 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>><br>> I thought that setting the timestamp is enough to have continuosly a<br>> stream of images but it seems that I'm wrong.<br>> Do I must force the state of the plugin in PLAY mode?<br>> Or maybe I'm wrong with the buffer management?
<br>><br>> Any help will be very appreciate becouse I'm new to plugin writing...<br>><br>><br>> Best Regards.<br>><br>><br>><br>> --<br>> Riccardo Corona<br><br>--<br>Regards,<br> René Stadler
<br><br></blockquote></div><br><br clear="all"><br>-- <br>Riccardo Corona