Commit 7f534d11 authored by Justin Ruggles's avatar Justin Ruggles

lavr: do not pass sample count as a parameter to ff_audio_convert()

It will always be the number of samples in the input buffer, so just use that
directly instead of passing it as a separate parameter.
parent 28e1cf19
...@@ -284,9 +284,10 @@ AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, ...@@ -284,9 +284,10 @@ AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr,
return ac; 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 use_generic = 1;
int len = in->nb_samples;
/* determine whether to use the optimized function based on pointer and /* determine whether to use the optimized function based on pointer and
samples alignment in both the input and output */ samples alignment in both the input and output */
......
...@@ -72,13 +72,16 @@ AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, ...@@ -72,13 +72,16 @@ AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr,
* examined to determine whether to use the generic or optimized conversion * examined to determine whether to use the generic or optimized conversion
* function (when available). * 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 ac AudioConvert context
* @param out output audio data * @param out output audio data
* @param in input audio data * @param in input audio data
* @param len number of samples to convert
* @return 0 on success, negative AVERROR code on failure * @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 */ /* arch-specific initialization functions */
......
...@@ -313,8 +313,8 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, ...@@ -313,8 +313,8 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr,
if (ret < 0) if (ret < 0)
return ret; return ret;
av_dlog(avr, "[convert] %s to in_buffer\n", current_buffer->name); av_dlog(avr, "[convert] %s to in_buffer\n", current_buffer->name);
ret = ff_audio_convert(avr->ac_in, avr->in_buffer, current_buffer, ret = ff_audio_convert(avr->ac_in, avr->in_buffer,
current_buffer->nb_samples); current_buffer);
if (ret < 0) if (ret < 0)
return ret; return ret;
} else { } else {
...@@ -381,8 +381,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, ...@@ -381,8 +381,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr,
if (direct_output && out_samples >= current_buffer->nb_samples) { if (direct_output && out_samples >= current_buffer->nb_samples) {
/* convert directly to output */ /* convert directly to output */
av_dlog(avr, "[convert] %s to output\n", current_buffer->name); av_dlog(avr, "[convert] %s to output\n", current_buffer->name);
ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer, ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer);
current_buffer->nb_samples);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -395,7 +394,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, ...@@ -395,7 +394,7 @@ int attribute_align_arg avresample_convert(AVAudioResampleContext *avr,
return ret; return ret;
av_dlog(avr, "[convert] %s to out_buffer\n", current_buffer->name); av_dlog(avr, "[convert] %s to out_buffer\n", current_buffer->name);
ret = ff_audio_convert(avr->ac_out, avr->out_buffer, ret = ff_audio_convert(avr->ac_out, avr->out_buffer,
current_buffer, current_buffer->nb_samples); current_buffer);
if (ret < 0) if (ret < 0)
return ret; return ret;
current_buffer = avr->out_buffer; current_buffer = avr->out_buffer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment