mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
zbar: Include running-time, stream-time and duration in the messages
The timestamp/PTS alone is meaningless without the segment and usually applications care about the running-time or stream-time. This also keeps the messages in sync with the spectrum and level elements.
This commit is contained in:
parent
7b8d198712
commit
5ed27c12cc
1 changed files with 16 additions and 1 deletions
|
@ -291,12 +291,27 @@ gst_zbar_transform_frame_ip (GstVideoFilter * vfilter, GstVideoFrame * frame)
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
GstSample *sample;
|
GstSample *sample;
|
||||||
GstCaps *sample_caps;
|
GstCaps *sample_caps;
|
||||||
|
GstClockTime timestamp, running_time, stream_time, duration;
|
||||||
|
|
||||||
|
timestamp = GST_BUFFER_TIMESTAMP (frame->buffer);
|
||||||
|
duration = GST_BUFFER_DURATION (frame->buffer);
|
||||||
|
running_time =
|
||||||
|
gst_segment_to_running_time (&GST_BASE_TRANSFORM (zbar)->segment,
|
||||||
|
GST_FORMAT_TIME, timestamp);
|
||||||
|
stream_time =
|
||||||
|
gst_segment_to_stream_time (&GST_BASE_TRANSFORM (zbar)->segment,
|
||||||
|
GST_FORMAT_TIME, timestamp);
|
||||||
|
|
||||||
s = gst_structure_new ("barcode",
|
s = gst_structure_new ("barcode",
|
||||||
"timestamp", G_TYPE_UINT64, GST_BUFFER_TIMESTAMP (frame->buffer),
|
"timestamp", G_TYPE_UINT64, timestamp,
|
||||||
|
"stream-time", G_TYPE_UINT64, stream_time,
|
||||||
|
"running-time", G_TYPE_UINT64, running_time,
|
||||||
"type", G_TYPE_STRING, zbar_get_symbol_name (typ),
|
"type", G_TYPE_STRING, zbar_get_symbol_name (typ),
|
||||||
"symbol", G_TYPE_STRING, data, "quality", G_TYPE_INT, quality, NULL);
|
"symbol", G_TYPE_STRING, data, "quality", G_TYPE_INT, quality, NULL);
|
||||||
|
|
||||||
|
if (GST_CLOCK_TIME_IS_VALID (duration))
|
||||||
|
gst_structure_set (s, "duration", G_TYPE_UINT64, duration, NULL);
|
||||||
|
|
||||||
if (zbar->attach_frame) {
|
if (zbar->attach_frame) {
|
||||||
/* create a sample from image */
|
/* create a sample from image */
|
||||||
sample_caps = gst_video_info_to_caps (&frame->info);
|
sample_caps = gst_video_info_to_caps (&frame->info);
|
||||||
|
|
Loading…
Reference in a new issue