Gstreamer buffers and their data

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Gstreamer buffers and their data

dayunbao
Hi,

As a follow-on to my last question, I was hoping to get some advice on how to deal with the GStreamer data structures used when working with buffers, as well as the data they contain.  Here's the pipeline I have:

v4l2src -> videorate -> identity -> jpegenc -> queue -> jifmux -> multifilesink

I have a callback function that is triggered by the identity's handoff signal.  The function is below (this is Python, by the way):

def identityHandoff(self, identity, buf):
   memory = Gst.Buffer.get_all_memory(buf)
   (result, info) = Gst.Memory.map(memory, Gst.MapFlags.READ)
   if result:
      #Eventually pass data to another process for image processing
                doSomething()
                #Clean up
      Gst.Memory.unmap(memory, info)
   else:
      #Error

The problem I'm running into is how to deal with the "info" variable returned by the map() call.  The "info" variable is of type Gst.MapInfo, and this page explains the data type.  The "data" member variable is of type "bytes" (which is actually just a string in Python 2.7), and is explained as a "a pointer to the mapped data."  I'm eventually going to want to pass off this data to another process where I'm running C++ code, but for now am trying to look at the data in Python.  However, I'm having trouble viewing/interpreting the data. If I used the identity plugin's dump property, I get something like this:

00000000  (0xb2eda000)  06 77 05 81 05 79 03 7f 02 7d 01 7e 01 81 01 80  .w...y...}.~....


This seems to me to be the values at memory location 0xb2eda000, although I'm not sure what that last string of characters (.w...y...}.~....) is supposed to be.  However, I'm having trouble viewing the data when I use the Gst.MapInfo object's data property.  Is there anyone with some experience working with data this way (preferably in Python)?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer buffers and their data

killerrats
Administrator
Don't Know what kind of data your looking for but hopefully this helps to get have a starting point. found a link that shows to get the height and width if that is what your looking for. search for "MapInfo" in the page.

https://cdn.hackaday.io/files/14729630165536/hdev-availability-gstreamer.py
------------------------------
Gstreamer 1.16.2
------------------------------
Windows