Gstreamer buffers and their data

dayunbao dayunbao at gmail.com
Wed May 24 16:08:46 UTC 2017


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
<https://lazka.github.io/pgi-docs/Gst-1.0/classes/MapInfo.html#Gst.MapInfo>  
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!



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Gstreamer-buffers-and-their-data-tp4683090.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list