[FFmpeg-cvslog] lavr: do not pass consumed samples as a parameter to ff_audio_resample()
Justin Ruggles
git at videolan.org
Wed Nov 28 13:31:26 CET 2012
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Thu Nov 1 11:08:08 2012 -0400| [1d86aa8b0f491f06e848026c7704daa39a54f523] | committer: Justin Ruggles
lavr: do not pass consumed samples as a parameter to ff_audio_resample()
Since the resampler handles buffering of unconsumed samples internally, the
caller does not need this information.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1d86aa8b0f491f06e848026c7704daa39a54f523
---
libavresample/resample.c | 9 ++++-----
libavresample/resample.h | 4 +---
libavresample/utils.c | 3 +--
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/libavresample/resample.c b/libavresample/resample.c
index f0af1ff..381d673 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 c16186e..7534e26 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 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 20b5fb1..3fdeeb8 100644
--- a/libavresample/utils.c
+++ b/libavresample/utils.c
@@ -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;
More information about the ffmpeg-cvslog
mailing list