diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-02-11 22:57:10 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-02-11 22:57:10 +0000 |
commit | d1e3c6fd404fc401de26457af294e21852ffdd8f (patch) | |
tree | 877855e8083ed59a999857f3646cc8321ea76ae0 /ffmpeg.c | |
parent | b5fdaebb44f9d2351a4678183eee6d38f2709d1e (diff) | |
download | ffmpeg-d1e3c6fd404fc401de26457af294e21852ffdd8f.tar.gz |
extend resampling API, add S16 internal conversion
Originally committed as revision 17163 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -555,12 +555,12 @@ static void do_audio_out(AVFormatContext *s, ost->audio_resample = 1; if (ost->audio_resample && !ost->resample) { - if (dec->sample_fmt != SAMPLE_FMT_S16) { - fprintf(stderr, "Audio resampler only works with 16 bits per sample, patch welcome.\n"); - av_exit(1); - } - ost->resample = audio_resample_init(enc->channels, dec->channels, - enc->sample_rate, dec->sample_rate); + if (dec->sample_fmt != SAMPLE_FMT_S16) + fprintf(stderr, "Warning, using s16 intermediate sample format for resampling\n"); + ost->resample = av_audio_resample_init(enc->channels, dec->channels, + enc->sample_rate, dec->sample_rate, + enc->sample_fmt, dec->sample_fmt, + 16, 10, 0, 0.8); if (!ost->resample) { fprintf(stderr, "Can not resample %d channels @ %d Hz to %d channels @ %d Hz\n", dec->channels, dec->sample_rate, @@ -570,7 +570,7 @@ static void do_audio_out(AVFormatContext *s, } #define MAKE_SFMT_PAIR(a,b) ((a)+SAMPLE_FMT_NB*(b)) - if (dec->sample_fmt!=enc->sample_fmt && + if (!ost->audio_resample && dec->sample_fmt!=enc->sample_fmt && MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt)!=ost->reformat_pair) { if (!audio_out2) audio_out2 = av_malloc(audio_out_size); @@ -647,7 +647,7 @@ static void do_audio_out(AVFormatContext *s, size_out = size; } - if (dec->sample_fmt!=enc->sample_fmt) { + if (!ost->audio_resample && dec->sample_fmt!=enc->sample_fmt) { const void *ibuf[6]= {buftmp}; void *obuf[6]= {audio_out2}; int istride[6]= {isize}; |