Gstreamer dev : custom source based on basesrc

Duchassin Frederic duchassin at sefram.fr
Wed Jan 23 10:36:38 UTC 2019


Hello,


It's strange...

The fill function should give me in parameter the size of the buffer 
mapped, isn't ?

so info-> size should always equal size (parameter).

 From my size, it's possible that there no enough data in device.

So correct me if I'm wrong but the fill would be :


gst_pciesrc_fill (GstBaseSrc * src, guint64 offset, guint size,
GstBuffer * buf)
{
    GstPciesrc *pciesrc = GST_PCIESRC (src);

    GST_DEBUG_OBJECT (pciesrc, "fill");

    if(fd != -1)
    {
        GstMapInfo info;

      //Read the global device
      gst_buffer_map (buf, &info, GST_MAP_WRITE);

      int rc = read(fd, info.data, info.size);

      gst_buffer_unmap (buf, &info);
      gst_buffer_resize (buf, 0, rc);
    }

    return GST_FLOW_OK;
}

BR


Frédéric




Le 23/01/2019 à 07:05, Geek-Gst a écrit :
> Duchassin,
>
> This asserts are due to padtemplate. Check your stats pad registry once.
>
> Some corrections in gst_pciesrc_fill. Specify what is the size to be read
> from read() and in the end set the buffer size.
>
> gst_pciesrc_fill (GstBaseSrc * src, guint64 offset, guint size,
> GstBuffer * buf)
> {
>     GstPciesrc *pciesrc = GST_PCIESRC (src);
>
>     GST_DEBUG_OBJECT (pciesrc, "fill");
>
>     if(fd != -1)
>     {
>         GstMapInfo info;
>
>       //Read the global device
>       gst_buffer_map (buf, &info, GST_MAP_WRITE);
>       info.size = size;
>       int rc = read(fd, info.data, info.size);
>
>       gst_buffer_unmap (buf, &info);
>       gst_buffer_resize (buf, 0, size);
>       GST_DEBUG_OBJECT (pciesrc, "info.size = %d", info.size);
>       GST_DEBUG_OBJECT (pciesrc, "rc = %d", rc);
>     }
>
>     return GST_FLOW_OK;
> }
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


More information about the gstreamer-devel mailing list