[FFmpeg-soc] [PATCH] ffmpeg.c changes for calling lavfi audio framework

S.N. Hemanth Meenakshisundaram smeenaks at ucsd.edu
Sat Jul 31 19:17:10 CEST 2010


On 07/31/2010 07:19 AM, Stefano Sabatini wrote:
> On date Saturday 2010-07-31 03:35:35 -0700, S.N. Hemanth Meenakshisundaram encoded:
>   
>> ffmpeg changes to call lavfi audio framework. It works but is a
>> temporary way to test the other audio filters. Couple if issues with this:
>>
>> 1. Right now, asrc and ffmpeg.c copy any incoming audio frames and thewn
>> copy them back out. To avoid the two memcpy calls. is it ok to implement
>> interfaces to avoid this? Please let me know.
>>     
> To avoid useless memcpy is a requirement for main SVN integration. 
>
>   
>> I was thinking of defining alternative get_video_buffer and
>> unref_samples to pass in a buffer pointer alone and use this as input
>> parameter. Comments?
>>     
> Elaborate more on this.
>
> [...]
>   

Right now, avfilter_get_samples_ref always allocates a buffer and
populates the 8 data pointers of SamplesRef with offsets into this
buffer. Also, the last unref_samples() frees the buffer along with the
last reference. Hence the memcpy. Ideally, I guess we want to put the
audio buffer directly into the SamplesRef struct and pass it through the
filter chain. At the end, we should be able to just copy the pointer
back in ffmpeg and use it.

So maybe a avfilter_build_samples_ref() with the same arguments as
get_samples_ref() + the pointer to the data buffer that will be used
instead of a new allocation?

Also a unref_samples2() which only frees the AVFilterSamplesRef and
AVFilterBuffer structures but not the actual data.



In video the post processing (like scaling and cropping) is done by the
video filters and when lavfi is enabled the old post processing is
disabled. I haven't yet done this for audio because af_resample
currently doesn't support sample rate conversion. Can I add a filter
wrapping the sample rate conversion of lavc or wrap it from af_resample
itself and then get lavfi to handle the post processing?

Regards,



More information about the FFmpeg-soc mailing list