[FFmpeg-cvslog] lavf: eliminate ff_get_audio_frame_size()
Anton Khirnov
git at videolan.org
Thu Aug 14 01:26:28 CEST 2014
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Jul 28 13:27:57 2014 +0000| [30e50c50274f88f0f5ae829f401cd3c7f5266719] | committer: Anton Khirnov
lavf: eliminate ff_get_audio_frame_size()
It is basically a wrapper around av_get_audio_frame_duration(), with a
fallback to AVCodecContext.frame_size. However, that field is set only
when the stream codec context is actually used for encoding or decoding,
which is discouraged.
For muxing, it is generally the responsibility of the caller to set the
packet duration.
For demuxing, if the duration is not stored at the container level, it
should be set by the parser.
Therefore, removing the frame_size fallback should not break any
important case.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30e50c50274f88f0f5ae829f401cd3c7f5266719
---
libavformat/internal.h | 2 --
libavformat/utils.c | 23 +----------------------
2 files changed, 1 insertion(+), 24 deletions(-)
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 2824436..9921ce1 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -326,8 +326,6 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
AVCodecParserContext *pc, AVPacket *pkt);
-int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux);
-
unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 973ab94..4cc246d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -454,27 +454,6 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
/**********************************************************/
/**
- * Get the number of samples of an audio frame. Return -1 on error.
- */
-int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux)
-{
- int frame_size;
-
- /* give frame_size priority if demuxing */
- if (!mux && enc->frame_size > 1)
- return enc->frame_size;
-
- if ((frame_size = av_get_audio_frame_duration(enc, size)) > 0)
- return frame_size;
-
- /* Fall back on using frame_size if muxing. */
- if (enc->frame_size > 1)
- return enc->frame_size;
-
- return -1;
-}
-
-/**
* Return the frame duration in seconds. Return 0 if not available.
*/
void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
@@ -509,7 +488,7 @@ void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
}
break;
case AVMEDIA_TYPE_AUDIO:
- frame_size = ff_get_audio_frame_size(st->codec, pkt->size, 0);
+ frame_size = av_get_audio_frame_duration(st->codec, pkt->size);
if (frame_size <= 0 || st->codec->sample_rate <= 0)
break;
*pnum = frame_size;
More information about the ffmpeg-cvslog
mailing list