I've wrote the vmethod create() and set the type as GST_TYPE_BASE_SRC, but now gst-inspect give me this error :<br><br>CRITICAL **: file E:\devel-cvs\src\gstreamer\gst\gstelementfactory.c: line 266: assertion `g_type_is_a (type, GST_TYPE_ELEMENT)'
<br> failed<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, 17:01 +0200 schrieb Riccardo Corona:<br>> Hi,<br>> thank's for the tips. When I told that I've started from<br>> 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>That should be<br><br>GST_BOILERPLATE (GstPluginTemplate, gst_plugin_template, GstBaseSrc,<br>GST_TYPE_BASE_SRC);<br><br>Have a look at the GstBaseSrc documentation and refer to the various
<br>existing code that uses it (gnomevfssrc, videotestsrc, etc.).<br><br>What you had before as get_range function goes as the create vmethod of<br>your BaseSrc derived element (after you fix the function to return the<br>
buffer as *buf = buffer and return GST_FLOW_OK).<br>><br>> 2007/6/28, René Stadler <<a href="mailto:mail@renestadler.de">mail@renestadler.de</a>>:<br>> Am Donnerstag, den 28.06.2007, 13:09 +0200 schrieb Riccardo
<br>> Corona:<br>> > Hi,<br>> > I'm writing a source plugin, I'm started from<br>> 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<br>> 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,
<br>> guint64<br>> > offset, guint lenght, GstBuffer **buf)<br>> > {<br>> > static gboolean white=1;<br>> ><br>> > GstPluginTemplate *plug= GST_PLUGIN_TEMPLATE
<br>> (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
<br>> (0xff,size);<br>> > else GST_BUFFER_MALLOCDATA (buffer) = g_memdup<br>> (0x0,size);<br>> ><br>> > white=!white;<br>> ><br>> > GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA
<br>> (buffer);<br>> ><br>> ><br>> > ts = gst_util_uint64_scale_int (frame_num * GST_SECOND,<br>> FPS_DEN,<br>> > FPS_NUM);<br>> > next_ts = gst_util_uint64_scale_int ((frame_num + 1) *
<br>> 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<br>> 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<br>> 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<br>> 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<br>> writing...<br>> ><br>> ><br>> > Best Regards.<br>> >
<br>> ><br>> ><br>> > --<br>> > Riccardo Corona<br>><br>> --<br>> Regards,<br>> René Stadler<br>><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