diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-28 13:27:18 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-28 13:27:18 +0100 |
commit | 264441715b132344e15f27f6a5740645d5146f56 (patch) | |
tree | 9ad81892cf141d8a2e3b09c242498aa425daedcf /libavresample | |
parent | b0d9b011c752f8526b73ffcef727c21f34cc5e46 (diff) | |
parent | f5fa03660db16f9d78abc5a626438b4d0b54f563 (diff) | |
download | ffmpeg-264441715b132344e15f27f6a5740645d5146f56.tar.gz |
Merge commit 'f5fa03660db16f9d78abc5a626438b4d0b54f563'
* commit 'f5fa03660db16f9d78abc5a626438b4d0b54f563':
vble: Do not abort decoding when version is not 1
lavr: do not pass consumed samples as a parameter to ff_audio_resample()
lavr: correct the documentation for the ff_audio_resample() return value
lavr: do not pass sample count as a parameter to ff_audio_convert()
x86: h264_weight: port to cpuflags
configure: Enable avconv filter dependencies automatically
Conflicts:
configure
libavcodec/x86/h264_weight.asm
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavresample')
-rw-r--r-- | libavresample/audio_convert.c | 3 | ||||
-rw-r--r-- | libavresample/audio_convert.h | 7 | ||||
-rw-r--r-- | libavresample/resample.c | 9 | ||||
-rw-r--r-- | libavresample/resample.h | 6 | ||||
-rw-r--r-- | libavresample/utils.c | 12 |
5 files changed, 18 insertions, 19 deletions
diff --git a/libavresample/audio_convert.c b/libavresample/audio_convert.c index e9835c8e8b..dcf8a39b06 100644 --- a/libavresample/audio_convert.c +++ b/libavresample/audio_convert.c @@ -284,9 +284,10 @@ AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, return ac; } -int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in, int len) +int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic = 1; + int len = in->nb_samples; /* determine whether to use the optimized function based on pointer and samples alignment in both the input and output */ diff --git a/libavresample/audio_convert.h b/libavresample/audio_convert.h index 2b8bface7d..bc27223140 100644 --- a/libavresample/audio_convert.h +++ b/libavresample/audio_convert.h @@ -72,13 +72,16 @@ AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, * examined to determine whether to use the generic or optimized conversion * function (when available). * + * The number of samples to convert is determined by in->nb_samples. The output + * buffer must be large enough to handle this many samples. out->nb_samples is + * set by this function before a successful return. + * * @param ac AudioConvert context * @param out output audio data * @param in input audio data - * @param len number of samples to convert * @return 0 on success, negative AVERROR code on failure */ -int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in, int len); +int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in); /* arch-specific initialization functions */ diff --git a/libavresample/resample.c b/libavresample/resample.c index f0af1ffd58..381d673717 100644 --- a/libavresample/resample.c +++ b/libavresample/resample.c @@ -394,10 +394,9 @@ static int resample(ResampleContext *c, void *dst, const void *src, return dst_index; } -int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src, - int *consumed) +int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src) { - int ch, in_samples, in_leftover, out_samples = 0; + int ch, in_samples, in_leftover, consumed = 0, out_samples = 0; int ret = AVERROR(EINVAL); in_samples = src ? src->nb_samples : 0; @@ -430,7 +429,7 @@ int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src, /* resample each channel plane */ for (ch = 0; ch < c->buffer->channels; ch++) { out_samples = resample(c, (void *)dst->data[ch], - (const void *)c->buffer->data[ch], consumed, + (const void *)c->buffer->data[ch], &consumed, c->buffer->nb_samples, dst->allocated_samples, ch + 1 == c->buffer->channels); } @@ -440,7 +439,7 @@ int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src, } /* drain consumed samples from the internal buffer */ - ff_audio_data_drain(c->buffer, *consumed); + ff_audio_data_drain(c->buffer, consumed); av_dlog(c->avr, "resampled %d in + %d leftover to %d out + %d leftover\n", in_samples, in_leftover, out_samples, c->buffer->nb_samples); diff --git a/libavresample/resample.h b/libavresample/resample.h index b42fdbbaac..7534e26ad4 100644 --- a/libavresample/resample.h +++ b/libavresample/resample.h @@ -61,10 +61,8 @@ void ff_audio_resample_free(ResampleContext **c); * @param c ResampleContext * @param dst destination audio data * @param src source audio data - * @param consumed number of samples consumed from the source - * @return number of samples written to the destination + * @return 0 on success, negative AVERROR code on failure */ -int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src, - int *consumed); +int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src); #endif /* AVRESAMPLE_RESAMPLE_H */ diff --git a/libavresample/utils.c b/libavresample/utils.c index ad49e880af..5591f1575e 100644 --- a/libavresample/utils.c +++ b/libavresample/utils.c @@ -313,8 +313,8 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, if (ret < 0) return ret; av_dlog(avr, "[convert] %s to in_buffer\n", current_buffer->name); - ret = ff_audio_convert(avr->ac_in, avr->in_buffer, current_buffer, - current_buffer->nb_samples); + ret = ff_audio_convert(avr->ac_in, avr->in_buffer, + current_buffer); if (ret < 0) return ret; } else { @@ -342,7 +342,6 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, if (avr->resample_needed) { AudioData *resample_out; - int consumed = 0; if (!avr->out_convert_needed && direct_output && out_samples > 0) resample_out = &output_buffer; @@ -351,7 +350,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, av_dlog(avr, "[resample] %s to %s\n", current_buffer->name, resample_out->name); ret = ff_audio_resample(avr->resample, resample_out, - current_buffer, &consumed); + current_buffer); if (ret < 0) return ret; @@ -381,8 +380,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, if (direct_output && out_samples >= current_buffer->nb_samples) { /* convert directly to output */ av_dlog(avr, "[convert] %s to output\n", current_buffer->name); - ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer, - current_buffer->nb_samples); + ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer); if (ret < 0) return ret; @@ -395,7 +393,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, return ret; av_dlog(avr, "[convert] %s to out_buffer\n", current_buffer->name); ret = ff_audio_convert(avr->ac_out, avr->out_buffer, - current_buffer, current_buffer->nb_samples); + current_buffer); if (ret < 0) return ret; current_buffer = avr->out_buffer; |