[FFmpeg-devel] libswresample swr_compensate and swr_init

Clément Bœsch ubitux at gmail.com
Sat Jan 7 12:42:33 CET 2012


On Sat, Jan 07, 2012 at 12:28:11PM +0100, Marton Balint wrote:
> Hi,
> 
> Currently swr_init() does not create the resampler, if the input and
> output frequency matches. But swr_compensate() expects the resampler
> to exist, and it crashes if it does not.
> 
> So what should be done here?
> 
> a) if the user plans to use swr_compensate then he should pass the
> SWR_FLAG_RESAMPLE flag to swr_init, and we should mention this
> requirement in the documentation. Also fix swr_compensate not to
> crash but log an error message if the resampler does not exist.
> (Unfortunately the return type of that function is void...)
> 
> b) fix swr_compensate to create the resampler by itself if
> necessary. Again the return type of swr_compensate is void, so
> extending the API may be required for this.
> 
> c) some other way :)
> 

I think the API should be changed; swr_compensate() should be renamed to
swr_set_resampling_compensation() or something (maybe a smaller form),
return an int and behave just like swr_set_channel_mapping().

We were also talking about swr_set_matrixes() to customize the rematrix a
while ago, so I think some consistency in the API usage won't hurt.

Keep in mind libswr is pretty young, so we should not be afraid of API
changes IMO.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120107/70a18fbe/attachment.asc>


More information about the ffmpeg-devel mailing list