summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2019-04-02 15:18:03 +0200
committerMathieu Duponchelle <mathieu@centricular.com>2019-04-02 15:18:03 +0200
commit0e89f2a6d9323c1f8ff4a2b03d8dcb713a8e8bab (patch)
tree0e224a0f392f87d73660aa4998691257e350d824
parent55bb8966e1508ab7b35b6a507ef90cc5f64d8486 (diff)
downloadgstreamer-plugins-bad-0e89f2a6d9323c1f8ff4a2b03d8dcb713a8e8bab.tar.gz
h264parse, h265parse: take unit_field_based_flag into account ..
when computing timecode metas. Depending on the value of that flag, n_frames is to be interpreted as a number of fields or a number of frames. As GstVideoTimeCodeMeta always deals with frames, we want to scale that number when needed.
-rw-r--r--gst/videoparsers/gsth264parse.c12
-rw-r--r--gst/videoparsers/gsth265parse.c21
2 files changed, 21 insertions, 12 deletions
diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c
index 3654516d8..c2729102f 100644
--- a/gst/videoparsers/gsth264parse.c
+++ b/gst/videoparsers/gsth264parse.c
@@ -553,8 +553,8 @@ gst_h264_parse_process_sei (GstH264Parse * h264parse, GstH264NalUnit * nalu)
for (j = 0; j < 3; j++) {
if (sei.payload.pic_timing.clock_timestamp_flag[j]) {
- memcpy (&h264parse->
- clock_timestamp[h264parse->num_clock_timestamp++],
+ memcpy (&h264parse->clock_timestamp[h264parse->
+ num_clock_timestamp++],
&sei.payload.pic_timing.clock_timestamp[j],
sizeof (GstH264ClockTimestamp));
}
@@ -2578,6 +2578,7 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
GstH264ClockTimestamp *tim = &h264parse->clock_timestamp[i];
GstVideoTimeCodeFlags flags = 0;
gint field_count = -1;
+ guint n_frames;
/* Table D-1 */
switch (h264parse->sei_pic_struct) {
@@ -2619,6 +2620,10 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
if (tim->ct_type == GST_H264_CT_TYPE_INTERLACED)
flags |= GST_VIDEO_TIME_CODE_FLAGS_INTERLACED;
+ n_frames =
+ gst_util_uint64_scale_int (tim->n_frames, 1,
+ 2 - tim->nuit_field_based_flag);
+
gst_buffer_add_video_time_code_meta_full (buffer,
h264parse->parsed_fps_n,
h264parse->parsed_fps_d,
@@ -2626,8 +2631,7 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
flags,
tim->hours_flag ? tim->hours_value : 0,
tim->minutes_flag ? tim->minutes_value : 0,
- tim->seconds_flag ? tim->seconds_value : 0,
- tim->n_frames, field_count);
+ tim->seconds_flag ? tim->seconds_value : 0, n_frames, field_count);
}
h264parse->num_clock_timestamp = 0;
diff --git a/gst/videoparsers/gsth265parse.c b/gst/videoparsers/gsth265parse.c
index b16f20d09..5031ba695 100644
--- a/gst/videoparsers/gsth265parse.c
+++ b/gst/videoparsers/gsth265parse.c
@@ -1250,8 +1250,8 @@ gst_h265_parse_make_codec_data (GstH265Parse * h265parse)
}
data[6] |=
(pft->progressive_source_flag << 7) | (pft->interlaced_source_flag << 6) |
- (pft->
- non_packed_constraint_flag << 5) | (pft->frame_only_constraint_flag << 4);
+ (pft->non_packed_constraint_flag << 5) | (pft->
+ frame_only_constraint_flag << 4);
data[12] = pft->level_idc;
/* min_spatial_segmentation_idc */
GST_WRITE_UINT16_BE (data + 13, min_spatial_segmentation_idc);
@@ -2228,6 +2228,7 @@ gst_h265_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
for (i = 0; i < h265parse->time_code.num_clock_ts; i++) {
GstVideoTimeCodeFlags flags = 0;
gint field_count = -1;
+ guint n_frames;
if (!h265parse->time_code.clock_timestamp_flag[i])
break;
@@ -2278,17 +2279,21 @@ gst_h265_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
if (h265parse->sei_pic_struct != GST_H265_SEI_PIC_STRUCT_FRAME)
flags |= GST_VIDEO_TIME_CODE_FLAGS_INTERLACED;
+ n_frames =
+ gst_util_uint64_scale_int (h265parse->time_code.n_frames[i], 1,
+ 2 - h265parse->time_code.units_field_based_flag[i]);
+
gst_buffer_add_video_time_code_meta_full (buffer,
h265parse->parsed_fps_n,
h265parse->parsed_fps_d,
NULL,
flags,
- h265parse->time_code.hours_flag[i] ? h265parse->time_code.
- hours_value[i] : 0,
- h265parse->time_code.minutes_flag[i] ? h265parse->time_code.
- minutes_value[i] : 0,
- h265parse->time_code.seconds_flag[i] ? h265parse->time_code.
- seconds_value[i] : 0, h265parse->time_code.n_frames[i], field_count);
+ h265parse->time_code.hours_flag[i] ? h265parse->
+ time_code.hours_value[i] : 0,
+ h265parse->time_code.minutes_flag[i] ? h265parse->
+ time_code.minutes_value[i] : 0,
+ h265parse->time_code.seconds_flag[i] ? h265parse->
+ time_code.seconds_value[i] : 0, n_frames, field_count);
}
}