mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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.
This commit is contained in:
parent
55bb8966e1
commit
0e89f2a6d9
2 changed files with 21 additions and 12 deletions
|
@ -553,8 +553,8 @@ gst_h264_parse_process_sei (GstH264Parse * h264parse, GstH264NalUnit * nalu)
|
||||||
|
|
||||||
for (j = 0; j < 3; j++) {
|
for (j = 0; j < 3; j++) {
|
||||||
if (sei.payload.pic_timing.clock_timestamp_flag[j]) {
|
if (sei.payload.pic_timing.clock_timestamp_flag[j]) {
|
||||||
memcpy (&h264parse->
|
memcpy (&h264parse->clock_timestamp[h264parse->
|
||||||
clock_timestamp[h264parse->num_clock_timestamp++],
|
num_clock_timestamp++],
|
||||||
&sei.payload.pic_timing.clock_timestamp[j],
|
&sei.payload.pic_timing.clock_timestamp[j],
|
||||||
sizeof (GstH264ClockTimestamp));
|
sizeof (GstH264ClockTimestamp));
|
||||||
}
|
}
|
||||||
|
@ -2578,6 +2578,7 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
||||||
GstH264ClockTimestamp *tim = &h264parse->clock_timestamp[i];
|
GstH264ClockTimestamp *tim = &h264parse->clock_timestamp[i];
|
||||||
GstVideoTimeCodeFlags flags = 0;
|
GstVideoTimeCodeFlags flags = 0;
|
||||||
gint field_count = -1;
|
gint field_count = -1;
|
||||||
|
guint n_frames;
|
||||||
|
|
||||||
/* Table D-1 */
|
/* Table D-1 */
|
||||||
switch (h264parse->sei_pic_struct) {
|
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)
|
if (tim->ct_type == GST_H264_CT_TYPE_INTERLACED)
|
||||||
flags |= GST_VIDEO_TIME_CODE_FLAGS_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,
|
gst_buffer_add_video_time_code_meta_full (buffer,
|
||||||
h264parse->parsed_fps_n,
|
h264parse->parsed_fps_n,
|
||||||
h264parse->parsed_fps_d,
|
h264parse->parsed_fps_d,
|
||||||
|
@ -2626,8 +2631,7 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
||||||
flags,
|
flags,
|
||||||
tim->hours_flag ? tim->hours_value : 0,
|
tim->hours_flag ? tim->hours_value : 0,
|
||||||
tim->minutes_flag ? tim->minutes_value : 0,
|
tim->minutes_flag ? tim->minutes_value : 0,
|
||||||
tim->seconds_flag ? tim->seconds_value : 0,
|
tim->seconds_flag ? tim->seconds_value : 0, n_frames, field_count);
|
||||||
tim->n_frames, field_count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h264parse->num_clock_timestamp = 0;
|
h264parse->num_clock_timestamp = 0;
|
||||||
|
|
|
@ -1250,8 +1250,8 @@ gst_h265_parse_make_codec_data (GstH265Parse * h265parse)
|
||||||
}
|
}
|
||||||
data[6] |=
|
data[6] |=
|
||||||
(pft->progressive_source_flag << 7) | (pft->interlaced_source_flag << 6) |
|
(pft->progressive_source_flag << 7) | (pft->interlaced_source_flag << 6) |
|
||||||
(pft->
|
(pft->non_packed_constraint_flag << 5) | (pft->
|
||||||
non_packed_constraint_flag << 5) | (pft->frame_only_constraint_flag << 4);
|
frame_only_constraint_flag << 4);
|
||||||
data[12] = pft->level_idc;
|
data[12] = pft->level_idc;
|
||||||
/* min_spatial_segmentation_idc */
|
/* min_spatial_segmentation_idc */
|
||||||
GST_WRITE_UINT16_BE (data + 13, 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++) {
|
for (i = 0; i < h265parse->time_code.num_clock_ts; i++) {
|
||||||
GstVideoTimeCodeFlags flags = 0;
|
GstVideoTimeCodeFlags flags = 0;
|
||||||
gint field_count = -1;
|
gint field_count = -1;
|
||||||
|
guint n_frames;
|
||||||
|
|
||||||
if (!h265parse->time_code.clock_timestamp_flag[i])
|
if (!h265parse->time_code.clock_timestamp_flag[i])
|
||||||
break;
|
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)
|
if (h265parse->sei_pic_struct != GST_H265_SEI_PIC_STRUCT_FRAME)
|
||||||
flags |= GST_VIDEO_TIME_CODE_FLAGS_INTERLACED;
|
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,
|
gst_buffer_add_video_time_code_meta_full (buffer,
|
||||||
h265parse->parsed_fps_n,
|
h265parse->parsed_fps_n,
|
||||||
h265parse->parsed_fps_d,
|
h265parse->parsed_fps_d,
|
||||||
NULL,
|
NULL,
|
||||||
flags,
|
flags,
|
||||||
h265parse->time_code.hours_flag[i] ? h265parse->time_code.
|
h265parse->time_code.hours_flag[i] ? h265parse->
|
||||||
hours_value[i] : 0,
|
time_code.hours_value[i] : 0,
|
||||||
h265parse->time_code.minutes_flag[i] ? h265parse->time_code.
|
h265parse->time_code.minutes_flag[i] ? h265parse->
|
||||||
minutes_value[i] : 0,
|
time_code.minutes_value[i] : 0,
|
||||||
h265parse->time_code.seconds_flag[i] ? h265parse->time_code.
|
h265parse->time_code.seconds_flag[i] ? h265parse->
|
||||||
seconds_value[i] : 0, h265parse->time_code.n_frames[i], field_count);
|
time_code.seconds_value[i] : 0, n_frames, field_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue