mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
lavf: factor out determinable_frame_size()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
15c6be8c7d
commit
b8afbbca9c
@ -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.
|
* 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) {
|
switch (avctx->codec_type) {
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
val = avctx->sample_rate && avctx->channels && avctx->sample_fmt != AV_SAMPLE_FMT_NONE;
|
val = avctx->sample_rate && avctx->channels && avctx->sample_fmt != AV_SAMPLE_FMT_NONE;
|
||||||
if (!avctx->frame_size &&
|
if (!avctx->frame_size && determinable_frame_size(avctx))
|
||||||
(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 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user