Merge commit 'b2d4565422
'
* commit 'b2d4565422
':
avresample: Add avresample_get_out_samples
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
bdb2e80e88
4 changed files with 42 additions and 8 deletions
|
@ -622,6 +622,25 @@ int avresample_available(AVAudioResampleContext *avr)
|
|||
return av_audio_fifo_size(avr->out_fifo);
|
||||
}
|
||||
|
||||
int avresample_get_out_samples(AVAudioResampleContext *avr, int in_nb_samples)
|
||||
{
|
||||
int64_t samples = avresample_get_delay(avr) + (int64_t)in_nb_samples;
|
||||
|
||||
if (avr->resample_needed) {
|
||||
samples = av_rescale_rnd(samples,
|
||||
avr->out_sample_rate,
|
||||
avr->in_sample_rate,
|
||||
AV_ROUND_UP);
|
||||
}
|
||||
|
||||
samples += avresample_available(avr);
|
||||
|
||||
if (samples > INT_MAX)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
return samples;
|
||||
}
|
||||
|
||||
int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples)
|
||||
{
|
||||
if (!output)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue