How to operate on GstMapInfo

Andrew Grace apenngrace at gmail.com
Thu Mar 16 10:27:32 UTC 2017


Sent from my iPhone
> On Mar 16, 2017, at 5:30 AM, dingoegret <sephvelut at gmail.com> wrote:
> 
> with gst_adapter_available i can get the size (gsize) of bytesof char data in
> the adapter.
> 
> with gst_adapter_map i can get the actual data as const void*
> (gconstpointer).
> 
> now if i cast the gconstpointer to an unsigned *char, does that mean i get
> back an array of pointers to char bytes where the size of the array of
> pointers is the returned gsize? as in i could access data[0], data[1],
> data[2] ... data[returned_gsize]? and get back pointers to the actual
> singular bytes of supposed unsigned chars? this is what im trying to
> understand. What is the data?

That sounds right, except I'd expect the last valid array index to be size-1.  The unsigned chars are your bytes.  Each unsigned char is 8 bits in width (1 byte). The cast does not change the underlying bit string, just how you interpret that string as a number.  If it's unsigned char, the bit values of each byte are interpreted in the range [0,255], and if it is signed char is [-128,127].  Char is used rather than int just because it is guaranteed to be exactly 8 bits in width on every playform (because stuff like data type sizes vary per platform with C).



> 
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-operate-on-GstMapInfo-tp4682202p4682252.html
> Sent from the GStreamer-devel mailing list archive at 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