Skip to content

Need to know the native pointer of a Buffer object #277

@gatordevin

Description

@gatordevin

Hello,
I am attempting to run a deepstream pipeline using java gstreamer and so far have had success in starting the pipeline and visualizing detections. However I would like to access these detections in java to make decisions based on them. Deepstream provides an API that provides back their custom metadata object from the gstreamer buffer as seen below.

static GstPadProbeReturn osd_sink_pad_buffer_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
{
    GstBuffer *buf = (GstBuffer *)info->data; // GstBuffer is a container object used to hold formatted data
    NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta(buf);
 }

I am hoping to mimic this functionality using javas new project Panama. I currently am able to natively call gst_buffer_get_nvds_batch_meta and functionally it works as excepted. However it expects a pointer to the underlying GstBuffer object. I am able to pass this to the native function using Project Panama but I need to know what this value is. I have the Java Gstreamer equivalent of the above code shown below.

try {
    Buffer metadataBuffer = info.getBuffer();
    MemorySegment segment = MemorySegment.ofAddress(address);
    gst_buffer_get_nvds_batch_meta.invokeExact(segment);
    return PadProbeReturn.PASS;
} catch (Throwable ex) {
    Logger.getLogger(DeepStreamUsingGStreamerJava.class.getName()).log(Level.SEVERE, null, ex);
}
return PadProbeReturn.PASS;
}

Assuming metadataBuffer is the equivalent java object to GstBuffer I would like to now if its possible to access its native pointer value which can then be passed into my native call to gst_buffer_get_nvds_batch_meta.

Please let me know if this is possible!

Thank you,
Devin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions