h264parse, h265parse: Support drop frame codes with counting_type 6

Tested with an Ateme Kyrion CM5000, which uses 6 when it drops 4 frames
from the code for 1080p@59.94.

Apply the same change to h265parse, with reference to the spec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7316>
This commit is contained in:
Jan Alexander Steffens (heftig) 2024-07-30 14:31:45 +02:00 committed by GStreamer Marge Bot
parent 4ea16ff146
commit 04238d3b3c
2 changed files with 66 additions and 13 deletions

View file

@ -3127,9 +3127,12 @@ gst_h264_parse_create_pic_timing_sei (GstH264Parse * h264parse,
tim->nuit_field_based_flag = 1; tim->nuit_field_based_flag = 1;
tim->counting_type = 0; tim->counting_type = 0;
if ((tc->config.flags & GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME) if (tc->config.flags & GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME) {
== GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME) if (tc->config.fps_n == 30000 && tc->config.fps_d == 1001)
tim->counting_type = 4; tim->counting_type = 4;
else
tim->counting_type = 6;
}
tim->discontinuity_flag = 0; tim->discontinuity_flag = 0;
tim->cnt_dropped_flag = 0; tim->cnt_dropped_flag = 0;
@ -3434,11 +3437,36 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
field_count = 0; field_count = 0;
} }
/* dropping of the two lowest (value 0 and 1) n_frames /* Table D-3 - Definition of counting_type values */
* counts when seconds_value is equal to 0 and switch (tim->counting_type) {
* minutes_value is not an integer multiple of 10 */ /* dropping of the two lowest (value 0 and 1) n_frames counts when
if (tim->counting_type == 4) * seconds_value is equal to 0 and minutes_value is not an integer
* multiple of 10 */
case 4:
flags |= GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME; flags |= GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME;
break;
/* dropping of unspecified numbers of unspecified n_frames count
* values */
case 6:
if (h264parse->parsed_fps_d != 1001)
break;
switch (h264parse->parsed_fps_n) {
case 30000:
case 60000:
case 120000:
flags |= GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME;
break;
default:
break;
}
break;
default:
break;
}
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;

View file

@ -3113,11 +3113,36 @@ gst_h265_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
field_count = 0; field_count = 0;
} }
/* Table D.11 - Definition of counting_type[ i ] values */
switch (h265parse->time_code.counting_type[i]) {
/* Dropping of the two lowest (value 0 and 1) n_frames[ i ] counts when /* Dropping of the two lowest (value 0 and 1) n_frames[ i ] counts when
* seconds_value[ i ] is equal to 0 and minutes_value[ i ] is not an integer * seconds_value[ i ] is equal to 0 and minutes_value[ i ] is not an
* multiple of 10 */ * integer multiple of 10 */
if (h265parse->time_code.counting_type[i] == 4) case 4:
flags |= GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME; flags |= GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME;
break;
/* Dropping of unspecified numbers of unspecified n_frames[ i ] count
* values */
case 6:
if (h265parse->parsed_fps_d != 1001)
break;
switch (h265parse->parsed_fps_n) {
case 30000:
case 60000:
case 120000:
flags |= GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME;
break;
default:
break;
}
break;
default:
break;
}
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;