From cb8da91f7a588262d91371b78a22645cdf6ff1aa Mon Sep 17 00:00:00 2001 From: Vivia Nikolaidou Date: Thu, 14 Apr 2022 13:22:03 +0300 Subject: [PATCH] h264parse: Include coded-picture-structure info in caps This reverts commit 652773de366a98e155332bf8ffb83ee5e6bea9e5 and modifies it to rename the caps field name to coded-picture-structure. It was previously removed because it confuses the decoder and we didn't have a valid use case for including it in the encoded caps at this stage. We now do have such a use case but still don't want to confuse the decoder, so the field is renamed. However, it is still not accurate without looking at the SEI picture structure of each frame, so it was named coded-picture-structure. If its value is "frame" it is most likely progressive, if it's "field" it is most likely interlaced or mixed. Part-of: --- subprojects/gst-integration-testsuites/medias | 2 +- .../flow-expectations/log-parse-src-expected | 2 +- .../flow-expectations/log-parse-src-expected | 2 +- .../gst-plugins-bad/gst/videoparsers/gsth264parse.c | 10 ++++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-integration-testsuites/medias b/subprojects/gst-integration-testsuites/medias index e6bc7e2dd1..96635014c4 160000 --- a/subprojects/gst-integration-testsuites/medias +++ b/subprojects/gst-integration-testsuites/medias @@ -1 +1 @@ -Subproject commit e6bc7e2dd1d0372fbaba825305b82135cc60be00 +Subproject commit 96635014c4a9152afe5bd4bb894d459e79225c02 diff --git a/subprojects/gst-integration-testsuites/testsuites/validate/h264/parse.trickmode_predicted.seek_trickmode_predicted/flow-expectations/log-parse-src-expected b/subprojects/gst-integration-testsuites/testsuites/validate/h264/parse.trickmode_predicted.seek_trickmode_predicted/flow-expectations/log-parse-src-expected index 02e4541083..4e8ecac3c8 100644 --- a/subprojects/gst-integration-testsuites/testsuites/validate/h264/parse.trickmode_predicted.seek_trickmode_predicted/flow-expectations/log-parse-src-expected +++ b/subprojects/gst-integration-testsuites/testsuites/validate/h264/parse.trickmode_predicted.seek_trickmode_predicted/flow-expectations/log-parse-src-expected @@ -1,5 +1,5 @@ event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1; -event caps: video/x-h264, alignment=(string)au, bit-depth-chroma=(uint)8, bit-depth-luma=(uint)8, chroma-format=(string)4:2:0, codec_data=(buffer)01640014ffe1001867640014acd94141fb0110000003001773594000f142996001000568ebecb22c, framerate=(fraction)30/1, height=(int)240, level=(string)2, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, profile=(string)high, stream-format=(string)avc, width=(int)320; +event caps: video/x-h264, alignment=(string)au, bit-depth-chroma=(uint)8, bit-depth-luma=(uint)8, chroma-format=(string)4:2:0, codec_data=(buffer)01640014ffe1001867640014acd94141fb0110000003001773594000f142996001000568ebecb22c, coded-picture-structure=(string)frame, framerate=(fraction)30/1, height=(int)240, level=(string)2, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, profile=(string)high, stream-format=(string)avc, width=(int)320; event segment: format=TIME, start=0:00:00.066666666, offset=0:00:00.000000000, stop=0:00:10.066666666, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.066666666 event tag: GstTagList-stream, taglist=(taglist)"taglist\,\ video-codec\=\(string\)\"H.264\\\ /\\\ AVC\"\,\ bitrate\=\(uint\)99582\,\ language-code\=\(string\)en\;"; event tag: GstTagList-global, taglist=(taglist)"taglist\,\ datetime\=\(datetime\)2013-09-03T16:21:39Z\,\ description\=\(string\)\"audiotest\\\ wave\"\,\ encoder\=\(string\)x264\,\ container-format\=\(string\)Quicktime\;"; diff --git a/subprojects/gst-integration-testsuites/testsuites/validate/mp4/qtdemux_reverse_playback_full_gop.reverse_playback_full_gop/flow-expectations/log-parse-src-expected b/subprojects/gst-integration-testsuites/testsuites/validate/mp4/qtdemux_reverse_playback_full_gop.reverse_playback_full_gop/flow-expectations/log-parse-src-expected index a8269fe910..d0bc7f5a2d 100644 --- a/subprojects/gst-integration-testsuites/testsuites/validate/mp4/qtdemux_reverse_playback_full_gop.reverse_playback_full_gop/flow-expectations/log-parse-src-expected +++ b/subprojects/gst-integration-testsuites/testsuites/validate/mp4/qtdemux_reverse_playback_full_gop.reverse_playback_full_gop/flow-expectations/log-parse-src-expected @@ -1,5 +1,5 @@ event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1; -event caps: video/x-h264, alignment=(string)au, bit-depth-chroma=(uint)8, bit-depth-luma=(uint)8, chroma-format=(string)4:2:0, codec_data=(buffer)01640014ffe1001867640014acd94141fb0110000003001773594000f142996001000568ebecb22c, framerate=(fraction)30/1, height=(int)240, level=(string)2, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, profile=(string)high, stream-format=(string)avc, width=(int)320; +event caps: video/x-h264, alignment=(string)au, bit-depth-chroma=(uint)8, bit-depth-luma=(uint)8, chroma-format=(string)4:2:0, codec_data=(buffer)01640014ffe1001867640014acd94141fb0110000003001773594000f142996001000568ebecb22c, coded-picture-structure=(string)frame, framerate=(fraction)30/1, height=(int)240, level=(string)2, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, profile=(string)high, stream-format=(string)avc, width=(int)320; event segment: format=TIME, start=0:00:00.066666666, offset=0:00:00.000000000, stop=0:00:10.066666666, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.066666666 event tag: GstTagList-stream, taglist=(taglist)"taglist\,\ video-codec\=\(string\)\"H.264\\\ /\\\ AVC\"\,\ bitrate\=\(uint\)99582\,\ language-code\=\(string\)en\;"; event tag: GstTagList-global, taglist=(taglist)"taglist\,\ datetime\=\(datetime\)2013-09-03T16:21:39Z\,\ description\=\(string\)\"audiotest\\\ wave\"\,\ encoder\=\(string\)x264\,\ container-format\=\(string\)Quicktime\;"; diff --git a/subprojects/gst-plugins-bad/gst/videoparsers/gsth264parse.c b/subprojects/gst-plugins-bad/gst/videoparsers/gsth264parse.c index 387cde20fb..1d72ff4993 100644 --- a/subprojects/gst-plugins-bad/gst/videoparsers/gsth264parse.c +++ b/subprojects/gst-plugins-bad/gst/videoparsers/gsth264parse.c @@ -2155,6 +2155,7 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps) GstVideoMultiviewFlags mview_flags = h264parse->multiview_flags; const gchar *chroma_format = NULL; guint bit_depth_chroma; + const gchar *coded_picture_structure; fps_num = h264parse->fps_num; fps_den = h264parse->fps_den; @@ -2233,6 +2234,15 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps) latency); } + if (sps->frame_mbs_only_flag == 1) { + coded_picture_structure = "frame"; + } else { + coded_picture_structure = "field"; + } + + gst_caps_set_simple (caps, "coded-picture-structure", G_TYPE_STRING, + coded_picture_structure, NULL); + bit_depth_chroma = sps->bit_depth_chroma_minus8 + 8; switch (sps->chroma_format_idc) {