On Fri, Jan 1, 2016 at 7:29 PM, Ronald S. Bultje <rsbul...@gmail.com> wrote: > Hi, > > On Fri, Jan 1, 2016 at 11:43 AM, Michael Niedermayer <michae...@gmx.at> > wrote: > >> From: Michael Niedermayer <mich...@niedermayer.cc> >> >> This is not guranteed to be correct but only the encoder or the packet >> headers >> can really provide the correct value. And before the first packet there is >> no alternative to receiving the value from the encoder by some means >> >> other codecs like AAC are still missing and are left for voluteers >> >> Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> >> --- >> libavcodec/utils.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/libavcodec/utils.c b/libavcodec/utils.c >> index 4b4aea0..6ed47ef 100644 >> --- a/libavcodec/utils.c >> +++ b/libavcodec/utils.c >> @@ -3042,6 +3042,12 @@ int av_get_audio_frame_duration(AVCodecContext >> *avctx, int frame_bytes) >> if (id == AV_CODEC_ID_TTA) >> return 256 * sr / 245; >> >> + // When frame_bytes is set then the headers can be parsed to find >> the >> + // frame size >> + if (id == AV_CODEC_ID_MP3 && !frame_bytes) { >> + return sr <= 24000 ? 576 : 1152; >> + } >> + >> if (ch > 0) { >> /* calc from sample rate and channels */ >> if (id == AV_CODEC_ID_BINKAUDIO_DCT) >> -- >> 1.7.9.5 > > > Please, no more codec-specific hacks in generic code. >
This whole function is codec specific crazy. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel