How to operate on GstMapInfo

Nicolas Dufresne nicolas at ndufresne.ca
Wed Mar 15 18:21:46 UTC 2017


Le mercredi 15 mars 2017 à 02:52 -0700, dingoegret a écrit :
> Okay I have it working so far and I'm able to chunk at 16kb. Is the data
> coming out of gst_adapter_map still a byte array? Why is it returned as a
> gconstpointer (void*)? 

Ask the author. Just cast it to const guint8 * and your good. It's
const because when you use gst_adapter_map(), writing to the memory may
have no effect on the gst_buffers inside the adapter. This method may
make a copy if the chunk was overlapping two memory segments.

Note that you should probably use gst_adapter_take() here.

> What's the difference between void* and a pointer to
> a unsigned char? How are they connected to the concept of byte arrays? I
> just want to uderstand the basic data happening here. In higher level

The alignment of a void* is unknown. It would point to a structure, a
function, data array etc. Though, in this case, it's just data, which
is application specific. The adapter is media agnostic remember. In
your case, you know what this data is.


> languages data is less ambiguous. An int is an int and a string is a string,
> even if they are implemented differently underneath so I'm coming from that
> background I'm really confused what a byte array is and why isnt the data
> type set as something like byte[] instead of a pointer to an unsigned char*.

All languages are similar (or more limited) in regard to byte array.
This paragraph is just a rant in my opinion. It's not helpful to get
help from community members.

Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170315/96623b40/attachment.sig>


More information about the gstreamer-devel mailing list