[FFmpeg-devel] [PATCH] Move audioconvert API from libavcodec to libavcore.
Stefano Sabatini
stefano.sabatini-lala
Sun Jan 9 10:58:19 CET 2011
On date Friday 2011-01-07 16:20:06 +0100, Michael Niedermayer encoded:
> On Sat, Nov 20, 2010 at 07:32:07PM +0100, Stefano Sabatini wrote:
[...]
> > libavcodec/audioconvert.c | 74 ++++-----------------------------------
> > libavcodec/audioconvert.h | 8 ++++
> > libavcore/audioconvert.c | 85 +++++++++++++++++++++++++++++++++++++++++++++
> > libavcore/audioconvert.h | 39 ++++++++++++++++++++
> > 4 files changed, 140 insertions(+), 66 deletions(-)
> >
> > diff --git a/libavcodec/audioconvert.c b/libavcodec/audioconvert.c
> > index 609fd1c..5e8b19e 100644
> > --- a/libavcodec/audioconvert.c
> > +++ b/libavcodec/audioconvert.c
> > @@ -27,7 +27,7 @@
> >
> > #include "libavutil/avstring.h"
> > #include "libavutil/libm.h"
> > -#include "libavcore/samplefmt.h"
> > +#include "libavcore/audioconvert.h"
> > #include "avcodec.h"
> > #include "audioconvert.h"
> >
> > @@ -77,87 +77,29 @@ int avcodec_channel_layout_num_channels(int64_t channel_layout)
> > {
> > return av_get_channel_layout_nb_channels(channel_layout);
> > }
> > -#endif
> >
> > -struct AVAudioConvert {
> > - int in_channels, out_channels;
> > - int fmt_pair;
> > -};
> > +typedef AVAudioConvert AudioConvertContext;
> >
> > AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels,
> > enum AVSampleFormat in_fmt, int in_channels,
> > const float *matrix, int flags)
> > {
> > - AVAudioConvert *ctx;
> > - if (in_channels!=out_channels)
> > - return NULL; /* FIXME: not supported */
> > - ctx = av_malloc(sizeof(AVAudioConvert));
> > - if (!ctx)
> > + AVAudioConvert *ctx = NULL;
> > + if (av_audio_convert_alloc2(&ctx, out_fmt, out_channels, in_fmt, in_channels, matrix, flags) < 0)
> > return NULL;
>
> as you change the API, i would suggest you pass parent context and log offset
> so error messages can be logged correctly
>
> except that the patch should be ok if tested
I agree this is better, but then it will break libavcodec ABI
compatibility. I wonder, is this a good occasion for bumping major?
--
FFmpeg = Fascinating & Fundamentalist Mournful Portable Elaborated Gem
More information about the ffmpeg-devel
mailing list