summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-04 04:06:15 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-04 04:26:12 +0100
commitb8afbbca9c4e96881e8e22018c675ed5b915fea6 (patch)
treee21f6ac73bc3d7f139ed21899afd8fe7db76a44c /libavformat
parent15c6be8c7da7b94b5e131396e9a82ab6fe4a6b64 (diff)
lavf: factor out determinable_frame_size()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 7f6bfaa88a..bf8abeec68 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -752,6 +752,17 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
/**********************************************************/
+static int determinable_frame_size(AVCodecContext *avctx)
+{
+ if (avctx->codec_id == CODEC_ID_AAC ||
+ avctx->codec_id == CODEC_ID_MP1 ||
+ avctx->codec_id == CODEC_ID_MP2 ||
+ avctx->codec_id == CODEC_ID_MP3 ||
+ avctx->codec_id == CODEC_ID_CELT)
+ return 1;
+ return 0;
+}
+
/**
* Get the number of samples of an audio frame. Return -1 on error.
*/
@@ -2101,12 +2112,7 @@ static int has_codec_parameters(AVCodecContext *avctx)
switch (avctx->codec_type) {
case AVMEDIA_TYPE_AUDIO:
val = avctx->sample_rate && avctx->channels && avctx->sample_fmt != AV_SAMPLE_FMT_NONE;
- if (!avctx->frame_size &&
- (avctx->codec_id == CODEC_ID_AAC ||
- avctx->codec_id == CODEC_ID_MP1 ||
- avctx->codec_id == CODEC_ID_MP2 ||
- avctx->codec_id == CODEC_ID_MP3 ||
- avctx->codec_id == CODEC_ID_CELT))
+ if (!avctx->frame_size && determinable_frame_size(avctx))
return 0;
break;
case AVMEDIA_TYPE_VIDEO: