Why is GstBuffer not writable in the _fill method of GstPushSrc?

Ben Rush ben at ben-rush.net
Sun Apr 28 15:23:59 UTC 2019


Just to be clear, I'm seeing examples of others doing what I want to do.
That is, write directly to the GstBuffer as a GstPushSrc. Examples include:

https://github.com/GStreamer/gst-plugins-bad/blob/master/gst/frei0r/gstfrei0rsrc.c
(between lines 96 to 106)
https://gitlab.collabora.com/gkiagia/gst-plugins-bad/blob/8cdfb13658a069cf8c45a3265bf865849d3dc8e9/ext/neon/gstneonhttpsrc.c
(between lines 955 to 995)

Among others. So, I don't feel like what I'm doing is strange or out of the
ordinary. It's just that the map function call fails (returns false) and
gives me a null buffer to write to when I try to open it with
GST_MAP_WRITE. It succeeds when I try to open it with GST_MAP_READ, but
that makes no sense when I'm trying to WRITE to the buffer.


On Sat, Apr 27, 2019 at 11:56 PM Ben Rush <ben at ben-rush.net> wrote:

> When implementing a GstPushSrc-derived class, I set the fill method to my
> own method. This fill method gets passed to it a GstBuffer that,
> presumably, is to be filled by the method. However, if I call
>
> GstMapInfo info;
> gst_buffer_map(buffer, &info, GST_MAP_WRITE);
>
> The data property of the info object is null. I can't copy data to a null
> pointer. I've been able to successfully use GstVideoFrame
> and gst_video_frame_map and write data to the video frame. So why can't I
> directly write to the buffer that's passed?
>
> As it turns out I'm reading data from a camera in YUV420, and don't want
> to incur any penalty for copying buffers around. I want to be able to just
> copy the frame data directly onto my buffer object.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190428/e06254a2/attachment.html>


More information about the gstreamer-devel mailing list