I have a question about GstBuffer

Nicolas Dufresne nicolas at ndufresne.ca
Mon Apr 12 13:21:02 UTC 2021


Le lundi 12 avril 2021 à 02:26 -0500, OhsureBoy a écrit :
> static GstFlowReturn
> gst_my_muxer_chain(GstPad *pad, GstObject *parent, GstBuffer *buf)
> {
>   GstMyMuxer *filter;
>   
> 
> 
> 
> ...
> }
> 
> 
> 
> 
> When we have the above source code, we have found that data is coming in due
> to the change of the offset in the buf.
> 
> What I'm curious about here is, is there a way to view buf's data?

GstBuffer are GstMemory container, they will contain one or more GstMemory
appended one after each other. You can "view" the data with a read only mapping
of the memory data, see gst_memory_map/unmap() function. As a convenience, you
may use gst_buffer_map/unmap() or gst_buffer_map_range()/unmao_range() to avoid
having to iterate the GstBuffer. You should though be aware that such mapping
will merge the data if the reselected range is over one or more GstMemory.

> 
> This is because we are creating a new plugin by separating the buf header
> and payload.
> 
> Thank you for reading
> 
> 
> 
> --
> 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