[gst-devel] source plugin blocked in PAUSE state
René Stadler
mail at renestadler.de
Thu Jun 28 13:47:13 CEST 2007
Am Donnerstag, den 28.06.2007, 13:09 +0200 schrieb Riccardo Corona:
> Hi,
> I'm writing a source plugin, I'm started from GstPluginTemplate to
> make a simple plugin that generate only B&W frames...
> The problem is that with this pipeline:
>
I strongly suggest deriving from GstBaseSrc instead.
> mysrc ! ffmpegcolorspace ! directdrawsink
>
> the pipeline is blocked on PREROLLING and in debug mode I can see that
> the last state of my plugin is PAUSED.
> Here the snipped of code in which I set the buffer:
>
>
>
> /* get_range function
> * makes it a source of a stream
> */
> static gboolean gst_plugin_template_get_range (GstPad *pad, guint64
> offset, guint lenght, GstBuffer **buf)
> {
> static gboolean white=1;
>
> GstPluginTemplate *plug= GST_PLUGIN_TEMPLATE (GST_OBJECT_PARENT
> (pad) );
>
> GstBuffer *buffer;
> gint size, width, height, bpp;
> width = 320; height = 240; bpp = 16;
> size = width * height * bpp;
> buffer = gst_buffer_new();
> GST_BUFFER_SIZE (buffer) = size;
>
> if (white)GST_BUFFER_MALLOCDATA (buffer) = g_memdup (0xff,size);
> else GST_BUFFER_MALLOCDATA (buffer) = g_memdup (0x0,size);
>
> white=!white;
>
> GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
>
>
> ts = gst_util_uint64_scale_int (frame_num * GST_SECOND, FPS_DEN,
> FPS_NUM);
> next_ts = gst_util_uint64_scale_int ((frame_num + 1) * GST_SECOND,
> FPS_DEN, FPS_NUM);
>
> GST_BUFFER_TIMESTAMP (buffer) = ts;
> GST_BUFFER_DURATION (buffer) = next_ts-ts;
>
> frame_num++;
>
>
> return gst_pad_push (plug->srcpad, buffer);
>
> }
>
This is completely wrong. In a get_range function, you are supposed to
return the buffer to the supplied location! Take a look at
gstreamer/docs/design/part-scheduling.txt [1] and other docs in that
directory to get some insight.
[1]:
http://webcvs.freedesktop.org/gstreamer/gstreamer/docs/design/part-scheduling.txt?view=markup
>
> I thought that setting the timestamp is enough to have continuosly a
> stream of images but it seems that I'm wrong.
> Do I must force the state of the plugin in PLAY mode?
> Or maybe I'm wrong with the buffer management?
>
> Any help will be very appreciate becouse I'm new to plugin writing...
>
>
> Best Regards.
>
>
>
> --
> Riccardo Corona
--
Regards,
René Stadler
More information about the gstreamer-devel
mailing list