[FFmpeg-devel] [PATCH] Move audioconvert API from libavcodec to libavcore.

Michael Niedermayer michaelni
Sun Jan 9 19:52:26 CET 2011


On Sun, Jan 09, 2011 at 10:58:19AM +0100, Stefano Sabatini wrote:
> 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?

maybe iam silly, but why would it break lavc ABI if the new function had
these arguments?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110109/d3a91f36/attachment.pgp>



More information about the ffmpeg-devel mailing list