This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 0c29837dac4f67c9a5ca6f96cb0cbb5572b692af Author: James Almer <[email protected]> AuthorDate: Wed Jun 10 18:11:58 2026 -0300 Commit: James Almer <[email protected]> CommitDate: Tue Jun 16 09:18:23 2026 -0300 avcodec/mpeg4audio: add a frame_length field to MPEG4AudioConfig Will be useful to get fixed frame sizes outside decoders. Signed-off-by: James Almer <[email protected]> --- libavcodec/mpeg4audio.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ libavcodec/mpeg4audio.h | 1 + 2 files changed, 48 insertions(+) diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c index fbd2a8f811..0430568b63 100644 --- a/libavcodec/mpeg4audio.c +++ b/libavcodec/mpeg4audio.c @@ -133,6 +133,53 @@ int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, if (ret < 0) return ret; } + switch (c->object_type) { + case AOT_AAC_MAIN: + case AOT_AAC_LC: + case AOT_AAC_SSR: + case AOT_AAC_LTP: + case AOT_ER_AAC_LC: + c->frame_length_short = get_bits1(gb); + c->frame_length = c->frame_length_short ? 960 : 1024; + break; + case AOT_ER_AAC_LD: + case AOT_ER_AAC_ELD: + c->frame_length_short = get_bits1(gb); + c->frame_length = c->frame_length_short ? 480 : 512; + break; + case AOT_USAC: { + int core_sbr_frame_len_idx, sbr_ratio; + int ratio_mult, ratio_dec, frame_length; + if (get_bits(gb, 5) == 0x1f) /* usacSamplingFrequencyIndex */ { + skip_bits(gb, 24); /* usacSamplingFrequency */ + } + core_sbr_frame_len_idx = get_bits(gb, 3); + c->frame_length_short = core_sbr_frame_len_idx == 0 || + core_sbr_frame_len_idx == 2; + sbr_ratio = core_sbr_frame_len_idx == 2 ? 2 : + core_sbr_frame_len_idx == 3 ? 3 : + core_sbr_frame_len_idx == 4 ? 1 : + 0; + + if (sbr_ratio == 2) { + ratio_mult = 8; + ratio_dec = 3; + } else if (sbr_ratio == 3) { + ratio_mult = 2; + ratio_dec = 1; + } else if (sbr_ratio == 4) { + ratio_mult = 4; + ratio_dec = 1; + } else { + ratio_mult = 1; + ratio_dec = 1; + } + + frame_length = c->frame_length_short ? 768 : 1024; + c->frame_length = (frame_length * ratio_mult) / ratio_dec; + break; + } + } if (c->ext_object_type != AOT_SBR && sync_extension) { while (get_bits_left(gb) > 15) { diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index 0819e48a42..089d6abf9f 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -39,6 +39,7 @@ typedef struct MPEG4AudioConfig { int channels; int ps; ///< -1 implicit, 1 presence int frame_length_short; + int frame_length; ///< derived value } MPEG4AudioConfig; extern const int ff_mpeg4audio_sample_rates[16]; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
