h265parse: Parse and attach LCEVC metadata to buffers if present

Similar to h264parse, this patch enhances the element to parse LCEVC enhancement
data from SEI, and attach it to output buffers as GstLcevcMeta. The 'lcevc'
field in the output caps is also set to TRUE or FALSE depending on whether LCEVC
data is present or not.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9335>
This commit is contained in:
Julian Bouzas 2025-05-22 14:41:30 -04:00 committed by GStreamer Marge Bot
parent 24ee088cee
commit 7ad82930e2
5 changed files with 13 additions and 4 deletions

@ -1 +1 @@
Subproject commit 267105aebcfaee4ea8abbd8206b1cd705fb869b9 Subproject commit 3c93fda4fc74e9138ae2f83fcb2b92ccf40fd57e

View File

@ -1,5 +1,5 @@
event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1; event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1;
event caps: video/x-h265, alignment=(string)au, bit-depth-chroma=(uint)8, bit-depth-luma=(uint)8, chroma-format=(string)4:2:0, codec_data=(buffer)0101400000004000000000003cf000fcfdf8f800000f03200001001840010c01ffff01400000030040000003000003003c250240210001003642010101400000030040000003000003003ca009881a7779e96e44a1735010202ed00000030010000004b51affde103e805df7c2010422000100074401c07181cdb2, colorimetry=(string)2:0:0:1, framerate=(fraction)75/2, height=(int)200, level=(string)2, parsed=(boolean)true, profile=(string)main, stream-format=(string)hvc1, tier=(string)main, width=(int)300; event caps: video/x-h265, alignment=(string)au, bit-depth-chroma=(uint)8, bit-depth-luma=(uint)8, chroma-format=(string)4:2:0, codec_data=(buffer)0101400000004000000000003cf000fcfdf8f800000f03200001001840010c01ffff01400000030040000003000003003c250240210001003642010101400000030040000003000003003ca009881a7779e96e44a1735010202ed00000030010000004b51affde103e805df7c2010422000100074401c07181cdb2, colorimetry=(string)2:0:0:1, framerate=(fraction)75/2, height=(int)200, lcevc=(boolean)false, level=(string)2, parsed=(boolean)true, profile=(string)main, stream-format=(string)hvc1, tier=(string)main, width=(int)300;
event segment: format=TIME, start=0:00:00.000000000, offset=0:00:00.000000000, stop=none, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.000000000 event segment: format=TIME, start=0:00:00.000000000, offset=0:00:00.000000000, stop=none, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.000000000
event tag: GstTagList-stream, taglist=(taglist)"taglist\,\ video-codec\=\(string\)\"H.265\\\ \\\(Main\\\ Profile\\\)\"\;"; event tag: GstTagList-stream, taglist=(taglist)"taglist\,\ video-codec\=\(string\)\"H.265\\\ \\\(Main\\\ Profile\\\)\"\;";
buffer: dts=0:00:00.000000000, dur=0:00:00.013333333, flags=discont marker header last buffer: dts=0:00:00.000000000, dur=0:00:00.013333333, flags=discont marker header last

View File

@ -1,5 +1,5 @@
event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1; event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1;
event caps: video/x-h265, alignment=(string)au, bit-depth-chroma=(uint)10, bit-depth-luma=(uint)10, chroma-format=(string)4:2:0, codec_data=(buffer)0102200000009000000000003ff000fcfdfafa00000f03200001001840010c01ffff02200000030090000003000003003f959009210001002e42010102200000030090000003000003003fa00a080f136595924932bffc0004000404000003000400000300782022000100074401c172b46240, colorimetry=(string)2:4:5:4, framerate=(fraction)30/1, height=(int)240, level=(string)2.1, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, profile=(string)main-10, stream-format=(string)hvc1, tier=(string)main, width=(int)320; event caps: video/x-h265, alignment=(string)au, bit-depth-chroma=(uint)10, bit-depth-luma=(uint)10, chroma-format=(string)4:2:0, codec_data=(buffer)0102200000009000000000003ff000fcfdfafa00000f03200001001840010c01ffff02200000030090000003000003003f959009210001002e42010102200000030090000003000003003fa00a080f136595924932bffc0004000404000003000400000300782022000100074401c172b46240, colorimetry=(string)2:4:5:4, framerate=(fraction)30/1, height=(int)240, lcevc=(boolean)false, level=(string)2.1, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, profile=(string)main-10, stream-format=(string)hvc1, tier=(string)main, 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 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.265\\\ /\\\ HEVC\"\,\ maximum-bitrate\=\(uint\)1937280\,\ bitrate\=\(uint\)1537413\,\ container-specific-track-id\=\(string\)2\,\ encoder\=\(string\)x265\;"; event tag: GstTagList-stream, taglist=(taglist)"taglist\,\ video-codec\=\(string\)\"H.265\\\ /\\\ HEVC\"\,\ maximum-bitrate\=\(uint\)1937280\,\ bitrate\=\(uint\)1537413\,\ container-specific-track-id\=\(string\)2\,\ encoder\=\(string\)x265\;";
event tag: GstTagList-global, taglist=(taglist)"taglist\,\ datetime\=\(datetime\)2019-07-15T17:28:39Z\,\ container-format\=\(string\)\"ISO\\\ MP4/M4A\"\;"; event tag: GstTagList-global, taglist=(taglist)"taglist\,\ datetime\=\(datetime\)2019-07-15T17:28:39Z\,\ container-format\=\(string\)\"ISO\\\ MP4/M4A\"\;";

View File

@ -231,6 +231,7 @@ gst_h265_parse_reset_stream_info (GstH265Parse * h265parse)
h265parse->parsed_colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_UNKNOWN; h265parse->parsed_colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_UNKNOWN;
h265parse->parsed_colorimetry.transfer = GST_VIDEO_TRANSFER_UNKNOWN; h265parse->parsed_colorimetry.transfer = GST_VIDEO_TRANSFER_UNKNOWN;
h265parse->parsed_colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_UNKNOWN; h265parse->parsed_colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_UNKNOWN;
h265parse->lcevc = FALSE;
h265parse->have_pps = FALSE; h265parse->have_pps = FALSE;
h265parse->have_sps = FALSE; h265parse->have_sps = FALSE;
h265parse->have_vps = FALSE; h265parse->have_vps = FALSE;
@ -698,8 +699,9 @@ gst_h265_parse_process_sei_user_data (GstH265Parse * h265parse,
GstByteReader br; GstByteReader br;
GstVideoParseUtilsField field = GST_VIDEO_PARSE_UTILS_FIELD_1; GstVideoParseUtilsField field = GST_VIDEO_PARSE_UTILS_FIELD_1;
/* only US country code is currently supported */ /* only US and UK country codes are currently supported */
switch (rud->country_code) { switch (rud->country_code) {
case ITU_T_T35_COUNTRY_CODE_UK:
case ITU_T_T35_COUNTRY_CODE_US: case ITU_T_T35_COUNTRY_CODE_US:
break; break;
default: default:
@ -2562,6 +2564,11 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps)
"Couldn't set content light level to caps"); "Couldn't set content light level to caps");
} }
if (h265parse->user_data.lcevc_enhancement_data || h265parse->lcevc)
gst_caps_set_simple (caps, "lcevc", G_TYPE_BOOLEAN, TRUE, NULL);
else
gst_caps_set_simple (caps, "lcevc", G_TYPE_BOOLEAN, FALSE, NULL);
src_caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (h265parse)); src_caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (h265parse));
if (src_caps) { if (src_caps) {
@ -3289,6 +3296,7 @@ gst_h265_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
&h265parse->fps_den); &h265parse->fps_den);
gst_structure_get_fraction (str, "pixel-aspect-ratio", gst_structure_get_fraction (str, "pixel-aspect-ratio",
&h265parse->upstream_par_n, &h265parse->upstream_par_d); &h265parse->upstream_par_n, &h265parse->upstream_par_d);
gst_structure_get_boolean (str, "lcevc", &h265parse->lcevc);
/* get upstream format and align from caps */ /* get upstream format and align from caps */
gst_h265_parse_format_from_caps (caps, &format, &align); gst_h265_parse_format_from_caps (caps, &format, &align);

View File

@ -56,6 +56,7 @@ struct _GstH265Parse
gint parsed_par_n, parsed_par_d; gint parsed_par_n, parsed_par_d;
gint parsed_fps_n, parsed_fps_d; gint parsed_fps_n, parsed_fps_d;
GstVideoColorimetry parsed_colorimetry; GstVideoColorimetry parsed_colorimetry;
gboolean lcevc;
/* current codec_data in output caps, if any */ /* current codec_data in output caps, if any */
GstBuffer *codec_data; GstBuffer *codec_data;
/* input codec_data, if any */ /* input codec_data, if any */