Open hauges opened 5 years ago
Is that copying the buffer data or creating a buffer that wraps the same data? Can you provide a link, ideally to the C API equivalent. You should be able to copy by creating a buffer and mapping the ByteBuffers, one with write, I think. You might also look at the GstBufferAPI in lowlevel to see if it provides anything extra you need.
I want to copy the buffer data and create a new buffer containing that data along with other data I pull from my system. I thinkGstBufferAPI.MapInfoStruct
may be what I'm looking for (it has a data
field), but I am too unfamiliar with the com.sun.jna.Pointer
API to create a new GstBufferAPI.MapInfoStruct
.
I couldn't find an equivalent C API, but this is the python documentation on buffer.data
.
It also appears there is no way I can inject a MapInfoStruct
into a Buffer
.
You don't need to use the structs, but we are missing low level mappings for copying.
You should be able to map the source buffer to get the ByteBuffer, create a new Buffer of that size, map the new buffer as writable, copy one ByteBuffer into the other, and unmap both. Not tried it though!
Thanks so much! Unfortunately my testing for this is now blocked by #133
I want to construct a new
org.freedesktop.gstreamer.Buffer
object with data from another Buffer. For example, with the python library, I could do something like this:Is there any way I could do this using the java library?