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 */
* 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 */
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 {
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;
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;