On 11/05/14 19:18, Justin Ruggles wrote:
> On 05/10/2014 12:16 PM, Luca Barbato wrote:
>> +int avresample_convert_frame(AVAudioResampleContext *avr,
>> +                             AVFrame *out, AVFrame *in)
>> +{
>> +    int ret, setup = 0;
>> +
>> +    if (!avresample_is_open(avr)) {
>> +        if ((ret = avresample_config(avr, out, in, NULL)) < 0)
>> +            return ret;
>> +        setup = 1;
>> +    } else {
>> +        // return as is or reconfigure for input changes?
>> +        if ((ret = avresample_config_changed(avr, out, in)))
>> +            return ret;
> 
> What do you think about having an option to automatically reconfigure
> without returning? It would simplify the user code if they know they
> will always want default settings for any potential new configuration.

It was one of the two options I asked feedback for at the start, it
would be probably nice to have since, while switching input format isn't
problematic, switching output resampling is gory.

I'm tempted to add an avoption to select the behaviour and then
implement both (help on the latter welcome).

> This would segfault if out is NULL.

Right, I forgot about that codepath =)

> Also, we should only override out->nb_samples if it is not already set
> by the user.

Not sure which default behaviour would work best since we'd set its
value in a loop.

In my case I'd like to write the largest number of samples the frame
would fit every time, not the amount that was available last time.

lu
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to