How do you access GstZedSrcMeta from the buffer?
The documentation for metadata at stereolabs.com says to reference the Zeddatacsvsink for an example. I copied how the gst_zeddatacsvsink_render()
function maps the buffer to the ZedSrcMeta. However, when I do so, I only get uninitialized data (sometimes 0, sometimes -1255031952, etc). I am working in a .cpp script that rebuilds the example pipeline from GStreamer - ZED Sensors CSV Sink - Stereolabs with a pad probe onto the zedsrc element’s src pad. The following is a condensed version of the probe:
include <gst/zed/gstzedmeta.h>
static GstPadProbeReturn zed_metadata_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data) {
GstBuffer *buf = (GstBuffer *) info->buffer;
GstMapInfo map_in;
if (gst_buffer_map(buf, &map_in, GST_MAP_READ)) {
GstZedSrcMeta *meta = (GstZedSrcMeta *) info->data;
g_print("%d %d %d\n", meta->info.cam_model, meta->info.stream_type, meta->pose.pose_avail);
gst_buffer_unmap(buf, &map_in);
}
return GST_PAD_PROBE_OK;
}
I know the GstZedSrcMeta is available and correct because I have it linked into a zeddatacsvsink element which shows valid data. I referenced the zed-gstreamer source code https://github.com/stereolabs/zed-gstreamer/blob/master/gst-zed-meta/gstzedmeta.h to try to utilize the functions defined to get the metadata but was also unable to. For example, gst_buffer_get_zed_src_meta(b)
. It may likely I am referencing this function wrong.
I have added these lines to me CMakeLists.txt:
find_package(ZED 3.7 REQUIRED)
include_directories(${ZED_INCLUDE_DIRS})
link_directories(${ZED_LIBRARY_DIR})
target_link_libraries(${PROJECT_NAME} ${ZED_LIBRARIES})
But compiling results in:
...undefined reference to 'gst_zed_src_meta_api_get_type'
collect2: error: ld returned 1 exit status
Any help or an example of how to access it through a pad probe would be great!
Specifications:
- NVidia Jetson Xavier NX
- Jetpack 4.6.0
- ZED SDK 3.7.2
- Zed-Gstreamer (master, latest)
- Ubuntu 18.04 LTS