[xiph-commits] r18026 - trunk/ffmpeg2theora/src
j at svn.xiph.org
j at svn.xiph.org
Mon Jul 4 13:31:32 PDT 2011
Author: j
Date: 2011-07-04 13:31:32 -0700 (Mon, 04 Jul 2011)
New Revision: 18026
Modified:
trunk/ffmpeg2theora/src/ffmpeg2theora.c
Log:
some audio decoders set sample_rate to 0 in avcodec_open now
Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.c 2011-06-16 10:11:40 UTC (rev 18025)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.c 2011-07-04 20:31:32 UTC (rev 18026)
@@ -934,6 +934,7 @@
astream = this->context->streams[this->audio_index];
aenc = this->context->streams[this->audio_index]->codec;
acodec = avcodec_find_decoder (aenc->codec_id);
+ int sample_rate = aenc->sample_rate;
if (this->channels < 1) {
this->channels = aenc->channels;
}
@@ -949,19 +950,19 @@
}
if (acodec != NULL && avcodec_open (aenc, acodec) >= 0) {
- if (this->sample_rate != aenc->sample_rate
+ if (this->sample_rate != sample_rate
|| this->channels != aenc->channels
|| aenc->sample_fmt != SAMPLE_FMT_S16) {
// values take from libavcodec/resample.c
this->audio_resample_ctx = av_audio_resample_init(this->channels, aenc->channels,
- this->sample_rate, aenc->sample_rate,
+ this->sample_rate, sample_rate,
SAMPLE_FMT_S16, aenc->sample_fmt,
16, 10, 0, 0.8);
if (!this->audio_resample_ctx) {
this->channels = aenc->channels;
}
- if (!info.frontend && this->sample_rate!=aenc->sample_rate)
- fprintf(stderr, " Resample: %dHz => %dHz\n",aenc->sample_rate,this->sample_rate);
+ if (!info.frontend && this->sample_rate!=sample_rate)
+ fprintf(stderr, " Resample: %dHz => %dHz\n", sample_rate,this->sample_rate);
if (!info.frontend && this->channels!=aenc->channels)
fprintf(stderr, " Channels: %d => %d\n",aenc->channels,this->channels);
}
More information about the commits
mailing list