diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-06-18 17:47:12 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-18 17:47:12 +0200 |
commit | 2d70282254834b276ab5eea44dba694f98551c79 (patch) | |
tree | 57c8bc8f4c248c001eca910f13c26cee3fcf8437 /libavformat/riffenc.c | |
parent | 95398aa9499bfad3330b47001b7eb086c31b0cd6 (diff) | |
parent | d754ed41727b1fcbab335b510248a9758a73320c (diff) | |
download | ffmpeg-2d70282254834b276ab5eea44dba694f98551c79.tar.gz |
Merge commit 'd754ed41727b1fcbab335b510248a9758a73320c'
* commit 'd754ed41727b1fcbab335b510248a9758a73320c':
riffenc: take an AVStream instead of an AVCodecContext
Conflicts:
libavformat/nutenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/riffenc.c')
-rw-r--r-- | libavformat/riffenc.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index 9cdf301f26..edb8b4ce44 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -234,32 +234,33 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, } } -void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, +void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int *au_scale) { + AVCodecContext *codec = st->codec; int gcd; int audio_frame_size; /* We use the known constant frame size for the codec if known, otherwise * fall back on using AVCodecContext.frame_size, which is not as reliable * for indicating packet duration. */ - audio_frame_size = av_get_audio_frame_duration(stream, 0); + audio_frame_size = av_get_audio_frame_duration(codec, 0); if (!audio_frame_size) - audio_frame_size = stream->frame_size; + audio_frame_size = codec->frame_size; - *au_ssize = stream->block_align; - if (audio_frame_size && stream->sample_rate) { + *au_ssize = codec->block_align; + if (audio_frame_size && codec->sample_rate) { *au_scale = audio_frame_size; - *au_rate = stream->sample_rate; - } else if (stream->codec_type == AVMEDIA_TYPE_VIDEO || - stream->codec_type == AVMEDIA_TYPE_DATA || - stream->codec_type == AVMEDIA_TYPE_SUBTITLE) { - *au_scale = stream->time_base.num; - *au_rate = stream->time_base.den; + *au_rate = codec->sample_rate; + } else if (codec->codec_type == AVMEDIA_TYPE_VIDEO || + codec->codec_type == AVMEDIA_TYPE_DATA || + codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { + *au_scale = codec->time_base.num; + *au_rate = codec->time_base.den; } else { - *au_scale = stream->block_align ? stream->block_align * 8 : 8; - *au_rate = stream->bit_rate ? stream->bit_rate : - 8 * stream->sample_rate; + *au_scale = codec->block_align ? codec->block_align * 8 : 8; + *au_rate = codec->bit_rate ? codec->bit_rate : + 8 * codec->sample_rate; } gcd = av_gcd(*au_scale, *au_rate); *au_scale /= gcd; |