avutil/hdr_dynamic_metadata: fix from_t35 NULL return and version doc

av_dynamic_hdr_plus_from_t35() returned AVERROR(ENOMEM) when passed a
NULL AVDynamicHDRPlus. A NULL output struct is invalid API usage by the
caller, not an allocation failure, and nothing is allocated on that
path. av_dynamic_hdr_smpte2094_app5_from_t35() already returns
AVERROR(EINVAL) for the same condition; make the two parsers agree.

The documentation for AVDynamicHDRPlus.application_version said the
value shall be set to 0, which contradicts both sides of the
implementation: av_dynamic_hdr_plus_to_t35() ignores the field and
always writes 1, the value CTA-861-H specifies for the HDR10+ payload,
and av_dynamic_hdr_plus_from_t35() sets the field from the parsed
payload rather than validating it against 0. No FFmpeg code assigns
this field, so document the contract the implementation provides.

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
This commit is contained in:
Marcos Ashton Iglesias authored and michaelni committed 2026-08-15 01:08:24 +00:00
1 parent cb98f5c3df
commit bc4cbbb85f
2 files changed
+6 -2

No files matched your search

+1 -1
View File
@@ -64,7 +64,7 @@ int av_dynamic_hdr_plus_from_t35(AVDynamicHDRPlus *s, const uint8_t *data,
int ret;
if (!s)
return AVERROR(ENOMEM);
return AVERROR(EINVAL);
if (size > AV_HDR_PLUS_MAX_PAYLOAD_SIZE)
return AVERROR(EINVAL);
+5 -1
View File
@@ -248,7 +248,11 @@ typedef struct AVDynamicHDRPlus {
/**
* Application version in the application defining document in ST-2094
* suite. The value shall be set to 0.
* suite. CTA-861-H sets this to 1 for the HDR10+ payload carried in a
* Rec. ITU-T T.35 message.
*
* av_dynamic_hdr_plus_from_t35() sets this field from the parsed payload.
* av_dynamic_hdr_plus_to_t35() ignores it and always writes 1.
*/
uint8_t application_version;