Question about GstBuffer and GstMapInfo

Wim Taymans wim.taymans at gmail.com
Tue Oct 8 06:38:58 PDT 2013



On Tue, Oct 8, 2013 at 3:35 PM, Eric Trousset <etrousset at awox.com> 
wrote:
> Hi,
> As I understand the GstMapInfo, I get one using gst_buffer_map on a 
> GstBuffer using the GST_MAP_READWRITE.  I can then modify the buffer 
> data thru the MapInfo.data. And then commit the changes using 
> gst_buffer_unmap.
>  
> But, when modifying the mapinfo.size field, it seems this isn’t 
> committed when unmapped.
> And if we can call gst_buffer_resize() on a buffer that have been 
> mapped, the MapInfo then becomes inconsistent.
>  
> So when modifying both the data content and the size, how one should 
> proceed?
>  
> Let say I need to process the data and that the result has x less 
> bytes …
>  
> Should I :
>  
> Map the buffer
> Process the data
> Unmap
> Call gst_buffer_resize
>  
> Or
>  
> Should I :
> Map the buffer
> Process the data
> Update the size in the map
> Unmap
>  
>  
> The second seems more logical to me, but the API seem to work in the 
> first way (Am I right)?
> 

Yes, you must resize explicitly, changing the mapinfo size does nothing.

Wim

>  
> Eric
>  
>  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131008/0c00b1bf/attachment.html>


More information about the gstreamer-devel mailing list