Sending timestamp metadata from C++ to Python
Wilkins White
ww at novadynamics.com
Fri Aug 28 00:42:24 UTC 2020
I would like to send metadata, specifically GstReferenceTimestampMeta, from
my C/C++ application to a Python application. It seems like I should be able
to accomplish this with `appsrc ! ipcpipelinesink` and `ipcpipelinesrc !
appsink` but the metadata isn't showing up on the Python side. Am I missing
something obvious, or will metadata not travel through
ipcpipelinesink/ipcpipelinesrc?
On my C++ application I am loading an appsrc with data from a CUDA pipeline
which feeds an ipcpipelinesink. I am using
`gst_buffer_add_reference_timestamp_meta` to add the reference timestamp for
when the frame was captured. I was able to read the value back using
`gst_buffer_get_reference_timestamp_meta` so I know it is there.
// Allocate a new GstBuffer
GstBuffer *gstbuf = gst_buffer_new_allocate(nullptr, buffer_size,
nullptr);
// Add reference timestamp to metadata
GstClockTime timestamp = static_cast<uint64_t>(ctx->m_frame.m_ts);
GstCaps *reference =
gst_caps_from_string("timestamp/x-metavision-stream");
gst_buffer_add_reference_timestamp_meta(
gstbuf, reference, timestamp, GST_CLOCK_TIME_NONE);
// Set pipeline timestamp
if(ctx->m_init_ts == 0)
ctx->m_init_ts = timestamp;
gstbuf->pts = timestamp - ctx->m_init_ts; // ns
gstbuf->dts = gstbuf->pts;
// Map GstBuffer (output)
GstMapInfo map;
memset(&map, 0, sizeof(GstMapInfo));
gst_buffer_map(gstbuf, &map, GST_MAP_WRITE);
// Copy NvBuffer to GstBuffer
...
// Unmap
gst_buffer_unmap(gstbuf, &map);
// Push buffer
gst_app_src_push_buffer(GST_APP_SRC(ctx->m_appsrc), gstbuf);
On the Python side I create an ipcslavepipeline with an ipcpipelinesrc
feeding an appsink. Caps are negotiated properly and I am able to convert
the Gst.Buffer into a numpy array, but
`Gst.Buffer.buf.get_reference_timestamp_meta` is returning None:
buf = sample.get_buffer()
reference = Gst.Caps.from_string('timestamp/x-metavision-stream')
ts_meta = buf.get_reference_timestamp_meta(reference) #
Gst.ReferenceTimestampMeta
print(ts_meta) # None
Am I barking up the wrong tree here? I would appreciate any input.
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list