How to operate on GstMapInfo

Andrew Grace apenngrace at gmail.com
Wed Mar 15 15:37:42 UTC 2017




Sent from my iPhone
> On Mar 15, 2017, at 5:52 AM, dingoegret <sephvelut at gmail.com> wrote:
> 
> 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*)? What's the difference between void* and a pointer to
> a unsigned char?

Those are different data types.  void pointer is a pointer (holds a memory address), and any kind of pointer (ptr to int, ptr to float, ptr to char, whatever) can be casted to void ptr amd vice versa.

Unsigned char is a datatype that holds one byte of data.  Unless you are doing bit twiddling, pointer to unsigned char or pointer to char are interchangable dealing with a buffer.

If this is new then consider reading the K&R C book (isbn 0131103628).  Its very old, but it is short and sweet.
 
> How are they connected to the concept of byte arrays?

Byte arrays sounds like a python term.  Python has a nice abstraction for representing a block of memory.  C's abstraction is more old-school... but with faster performance.  A char* buffer is the same as a python byte array conceptually, though Python wraps the memory buffer in a python object.  C does not... C is less abstracted from the underlying machine instructions... and faster.

> I
> just want to uderstand the basic data happening here. In higher level
> languages data is less ambiguous.

C feels less ambiguous when you get familiar with it.  It's just less abstracted from the machine lang than a higher level lang.  I've heard C described as a high level assembly language.

> 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*.
> 
With C, you really just need take time and do some reading or tutorials.  It has features you dont see used elsewhere and lacks other features.  For example pointers and arrays in C are closely related.  You can treat pointers as arrays and arrays as pointers.


> 
> 
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-operate-on-GstMapInfo-tp4682202p4682228.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