Skip to content

Commit 3ccaee1

Browse files
committed
Adds frame_id to GstZedSrcMeta
Adds a frame_id field to the ZedSrc MetaData in order to allow buffers to be tracked throughout a GStreamer pipeline.
1 parent 7315ad8 commit 3ccaee1

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

gst-zed-data-mux/gstzeddatamux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static GstFlowReturn gst_zeddatamux_chain_data(GstPad* pad, GstObject * parent,
466466
gst_buffer_add_zed_src_meta( out_buf,
467467
meta->info,
468468
meta->pose, meta->sens,
469-
meta->od_enabled, meta->obj_count, meta->objects);
469+
meta->od_enabled, meta->obj_count, meta->objects, meta->frame_id);
470470

471471
// ----> Timestamp meta-data
472472
GST_TRACE ("Out buffer set timestamp" );
@@ -621,7 +621,7 @@ static GstFlowReturn gst_zeddatamux_chain_video(GstPad* pad, GstObject * parent,
621621
gst_buffer_add_zed_src_meta( out_buf,
622622
meta->info,
623623
meta->pose, meta->sens,
624-
meta->od_enabled, meta->obj_count, meta->objects);
624+
meta->od_enabled, meta->obj_count, meta->objects, meta->frame_id);
625625

626626
// ----> Timestamp meta-data
627627
GST_TRACE ("Out buffer set timestamp" );

gst-zed-demux/gstzeddemux.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,8 @@ static GstFlowReturn gst_zeddemux_chain(GstPad* pad, GstObject * parent, GstBuff
560560
meta->sens,
561561
meta->od_enabled,
562562
meta->obj_count,
563-
meta->objects );
563+
meta->objects,
564+
meta->frame_id );
564565
}
565566

566567
GST_TRACE ("Left buffer set timestamp" );
@@ -651,7 +652,8 @@ static GstFlowReturn gst_zeddemux_chain(GstPad* pad, GstObject * parent, GstBuff
651652
meta->sens,
652653
meta->od_enabled,
653654
meta->obj_count,
654-
meta->objects );
655+
meta->objects,
656+
meta->frame_id );
655657
}
656658

657659
GST_TRACE ("Aux buffer set timestamp" );

gst-zed-meta/gstzedmeta.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ static gboolean gst_zed_src_meta_transform( GstBuffer* transbuf, GstMeta * meta,
123123
emeta->sens,
124124
emeta->od_enabled,
125125
emeta->obj_count,
126-
emeta->objects );
126+
emeta->objects,
127+
emeta->frame_id);
127128

128129

129130
return TRUE;
@@ -162,7 +163,8 @@ GstZedSrcMeta* gst_buffer_add_zed_src_meta( GstBuffer* buffer,
162163
ZedSensors& sens,
163164
gboolean od_enabled,
164165
guint8 obj_count,
165-
ZedObjectData* objects)
166+
ZedObjectData* objects,
167+
guint64 frame_id)
166168
{
167169
GST_TRACE( "gst_buffer_add_zed_src_meta" );
168170

@@ -183,5 +185,7 @@ GstZedSrcMeta* gst_buffer_add_zed_src_meta( GstBuffer* buffer,
183185

184186
memcpy( &meta->objects, objects, obj_count*sizeof(ZedObjectData));
185187

188+
meta->frame_id = frame_id;
189+
186190
return meta;
187191
}

gst-zed-meta/gstzedmeta.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ struct _GstZedSrcMeta {
184184

185185
gboolean od_enabled;
186186
guint8 obj_count;
187+
guint64 frame_id;
187188
ZedObjectData objects[256];
188189
};
189190

@@ -258,7 +259,8 @@ GstZedSrcMeta* gst_buffer_add_zed_src_meta( GstBuffer* buffer,
258259
ZedSensors& sens,
259260
gboolean od_enabled,
260261
guint8 obj_count,
261-
ZedObjectData* objects);
262+
ZedObjectData* objects,
263+
guint64 frame_id);
262264

263265
G_END_DECLS
264266

gst-zed-src/gstzedsrc.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,15 +2313,16 @@ static GstFlowReturn gst_zedsrc_fill( GstPushSrc * psrc, GstBuffer * buf )
23132313
}
23142314
// <---- Object detection metadata
23152315

2316-
gst_buffer_add_zed_src_meta( buf, info, pose, sens, src->object_detection, obj_count, obj_data);
2317-
23182316
// ----> Timestamp meta-data
23192317
GST_BUFFER_TIMESTAMP(buf) = GST_CLOCK_DIFF (gst_element_get_base_time (GST_ELEMENT (src)),
23202318
clock_time);
23212319
GST_BUFFER_DTS(buf) = GST_BUFFER_TIMESTAMP(buf);
23222320
GST_BUFFER_OFFSET(buf) = temp_ugly_buf_index++;
23232321
// <---- Timestamp meta-data
23242322

2323+
guint64 offset = GST_BUFFER_OFFSET(buf);
2324+
GstZedSrcMeta* meta = gst_buffer_add_zed_src_meta( buf, info, pose, sens, src->object_detection, obj_count, obj_data, offset);
2325+
23252326
// Buffer release
23262327
gst_buffer_unmap( buf, &minfo );
23272328
// gst_buffer_unref(buf); // NOTE: do not uncomment to not crash

0 commit comments

Comments
 (0)