[gst-devel] source plugin blocked in PAUSE state

Riccardo Corona coronariccardo at gmail.com
Thu Jun 28 13:09:48 CEST 2007


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:

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);

}


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20070628/fbf72e1d/attachment.htm>


More information about the gstreamer-devel mailing list