diff options
author | Juanjo <pulento@users.sourceforge.net> | 2002-04-09 04:52:49 +0000 |
---|---|---|
committer | Juanjo <pulento@users.sourceforge.net> | 2002-04-09 04:52:49 +0000 |
commit | e0d2714adc4985198a4c9fadf76508cfe7c131d0 (patch) | |
tree | 8907aa932e9da43372590f5454fd7fd231e0983e /ffmpeg.c | |
parent | 9f862d1133e23c26e7b682c625f380f68cd4627b (diff) | |
download | ffmpeg-e0d2714adc4985198a4c9fadf76508cfe7c131d0.tar.gz |
- Fixed AC3 decoding for 5:1 AC3 streams. Now when calling av_audio_decode for
AC3 set avcodec_context->channels to the desired number channels, if the
setting is 0 AC3 decoder will set it to the channels found in the
stream.
- Changed ffmpeg to cope with the new "way" of AC3 decoding.
- ASF muxer now uses Tickers for PTS calculations.
Originally committed as revision 393 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -741,10 +741,19 @@ static int av_encode(AVFormatContext **output_files, codec->sample_rate == icodec->sample_rate) { ost->audio_resample = 0; } else { - ost->audio_resample = 1; - ost->resample = audio_resample_init(codec->channels, icodec->channels, + if (codec->channels != icodec->channels && + icodec->codec_id == CODEC_ID_AC3) { + /* Special case for 5:1 AC3 input */ + /* and mono or stereo output */ + ost->audio_resample = 0; + /* Request specific number of channels */ + icodec->channels = codec->channels; + } else { + ost->audio_resample = 1; + ost->resample = audio_resample_init(codec->channels, icodec->channels, codec->sample_rate, icodec->sample_rate); + } } ist->decoding_needed = 1; ost->encoding_needed = 1; @@ -1626,6 +1635,7 @@ void opt_input_file(const char *filename) AVCodecContext *enc = &ic->streams[i]->codec; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: + //fprintf(stderr, "\nInput Audio channels: %d", enc->channels); audio_channels = enc->channels; audio_sample_rate = enc->sample_rate; break; @@ -1789,7 +1799,12 @@ void opt_output_file(const char *filename) audio_enc->bit_rate = audio_bit_rate; audio_enc->sample_rate = audio_sample_rate; - audio_enc->channels = audio_channels; + /* For audio codecs other than AC3 we limit */ + /* the number of coded channels to stereo */ + if (audio_channels > 2 && codec_id != CODEC_ID_AC3) { + audio_enc->channels = 2; + } else + audio_enc->channels = audio_channels; oc->streams[nb_streams] = st; nb_streams++; } |