This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 9eaab0dd0ddc49f4f8588a117bae6b9455b0cddd Author: Romain Beauxis <[email protected]> AuthorDate: Tue Nov 17 08:43:08 2026 -0600 Commit: Romain Beauxis <[email protected]> CommitDate: Sat Nov 21 13:32:34 2026 +0000 avcodec/hevc: add a helper to detect an hvcC record The decoder and hevc_mp4toannexb each wrote out the same test. libavformat needs it too. --- libavcodec/bsf/hevc_mp4toannexb.c | 4 +--- libavcodec/hevc/hevc.h | 15 +++++++++++++++ libavcodec/hevc/parse.c | 7 +------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/libavcodec/bsf/hevc_mp4toannexb.c b/libavcodec/bsf/hevc_mp4toannexb.c index 345a7ebbc0..4d3bc8accf 100644 --- a/libavcodec/bsf/hevc_mp4toannexb.c +++ b/libavcodec/bsf/hevc_mp4toannexb.c @@ -377,9 +377,7 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) extradata = av_packet_get_side_data(in, AV_PKT_DATA_NEW_EXTRADATA, &extradata_size); - if (extradata && extradata_size >= MIN_HEVCC_LENGTH && - ((extradata[0] == 1) || - (extradata[0] == 0 && (extradata[1] || extradata[2] > 1)))) { + if (extradata && ff_hevc_is_hvcc(extradata, extradata_size)) { ret = hevc_extradata_to_annexb(ctx, extradata, extradata_size, NULL, NULL); if (ret < 0) diff --git a/libavcodec/hevc/hevc.h b/libavcodec/hevc/hevc.h index 710786a89d..35cea20390 100644 --- a/libavcodec/hevc/hevc.h +++ b/libavcodec/hevc/hevc.h @@ -21,6 +21,8 @@ #ifndef AVCODEC_HEVC_HEVC_H #define AVCODEC_HEVC_HEVC_H +#include <stdint.h> + /** * Table 7-1 – NAL unit type codes and NAL unit type classes in * T-REC-H.265-201802 @@ -175,4 +177,17 @@ enum HEVCAuxId { HEVC_AUX_DEPTH = 2, }; +/** + * Tell whether extradata is an HEVCDecoderConfigurationRecord (ISO/IEC + * 14496-15) rather than Annex B. configurationVersion 0 predates the + * standard and is still written by older muxers. + * + * @param size extradata size; a record is at least 23 bytes + */ +static inline int ff_hevc_is_hvcc(const uint8_t *data, int size) +{ + return size >= 23 && + (data[0] == 1 || (data[0] == 0 && (data[1] || data[2] > 1))); +} + #endif /* AVCODEC_HEVC_HEVC_H */ diff --git a/libavcodec/hevc/parse.c b/libavcodec/hevc/parse.c index 2f519380fb..723a6fcf8d 100644 --- a/libavcodec/hevc/parse.c +++ b/libavcodec/hevc/parse.c @@ -85,12 +85,7 @@ int ff_hevc_decode_extradata(const uint8_t *data, int size, HEVCParamSets *ps, bytestream2_init(&gb, data, size); - /* data[0] == 1 is configurationVersion from 14496-15. - * data[0] == 0 is for backward compatibility predates the standard. - * - * Minimum number of bytes of hvcC with 0 numOfArrays is 23. - */ - if (size >= 23 && ((data[0] == 1) || (data[0] == 0 && (data[1] || data[2] > 1)))) { + if (ff_hevc_is_hvcc(data, size)) { /* It seems the extradata is encoded as hvcC format. */ int i, j, num_arrays, nal_len_size; -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
