[FFmpeg-devel] [PATCH 4/4] Move audio channel API from libavcodec to libavcore.

Michael Niedermayer michaelni
Mon Nov 1 14:51:20 CET 2010


On Fri, Oct 29, 2010 at 09:49:41PM -0700, Stefano Sabatini wrote:
> ---
>  libavcodec/audioconvert.c |   91 +++------------------------------
>  libavcodec/audioconvert.h |   21 ++++---
>  libavcodec/avcodec.h      |   80 +++++++++++++++-------------
>  libavcore/Makefile        |    6 ++-
>  libavcore/audioconvert.c  |  125 +++++++++++++++++++++++++++++++++++++++++++++
>  libavcore/audioconvert.h  |  108 ++++++++++++++++++++++++++++++++++++++
>  6 files changed, 299 insertions(+), 132 deletions(-)
>  create mode 100644 libavcore/audioconvert.c
>  create mode 100644 libavcore/audioconvert.h
> 
> diff --git a/libavcodec/audioconvert.c b/libavcodec/audioconvert.c
> index 4e4063f..f3d483c 100644
> --- a/libavcodec/audioconvert.c
> +++ b/libavcodec/audioconvert.c
> @@ -48,104 +48,27 @@ void avcodec_sample_fmt_string (char *buf, int buf_size, int sample_fmt)
>  }
>  #endif
>  
> -static const char* const channel_names[]={
> -    "FL", "FR", "FC", "LFE", "BL",  "BR",  "FLC", "FRC",
> -    "BC", "SL", "SR", "TC",  "TFL", "TFC", "TFR", "TBL",
> -    "TBC", "TBR",
> -    [29] = "DL",
> -    [30] = "DR",
> -};
> -
> -static const char *get_channel_name(int channel_id)
> -{
> -    if (channel_id<0 || channel_id>=FF_ARRAY_ELEMS(channel_names))
> -        return NULL;
> -    return channel_names[channel_id];
> -}
> -

> +#if FF_API_OLD_AUDIOCONVERT
>  int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name)
>  {
> -    switch(nb_channels) {
> -    case 1: return CH_LAYOUT_MONO;
> -    case 2: return CH_LAYOUT_STEREO;
> -    case 3: return CH_LAYOUT_SURROUND;
> -    case 4: return CH_LAYOUT_QUAD;
> -    case 5: return CH_LAYOUT_5POINT0;
> -    case 6: return CH_LAYOUT_5POINT1;
> -    case 8: return CH_LAYOUT_7POINT1;
> -    default: return 0;
> -    }
> +    return av_guess_channel_layout(nb_channels);

This is not possible, codec and demuxer ids can be required for guessing


[...]
> @@ -3,12 +3,14 @@ include $(SUBDIR)../config.mak
>  NAME = avcore
>  FFLIBS = avutil
>  
> -HEADERS = avcore.h                                                      \
> +HEADERS = audioconvert.h                                                \
> +          avcore.h                                                      \

if you leave HEADER= \
on its own line than future patches would a line smaller if they change the first
entry


>            imgutils.h                                                    \
>            parseutils.h                                                  \
>            samplefmt.h                                                   \
>  
> -OBJS = imgutils.o                                                       \
> +OBJS = audioconvert.o                                                   \
> +       imgutils.o                                                       \
>         parseutils.o                                                     \
>         samplefmt.o                                                      \
>         utils.o                                                          \
> diff --git a/libavcore/audioconvert.c b/libavcore/audioconvert.c
> new file mode 100644
> index 0000000..2b6e1a8
> --- /dev/null
> +++ b/libavcore/audioconvert.c
> @@ -0,0 +1,125 @@
> +/*
> + * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */

dont forget svn cp
and a diff against the true ancestor might be usefull

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

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- 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/20101101/38daab9b/attachment.pgp>



More information about the ffmpeg-devel mailing list