Browse code

Merge commit '97bf7c03b1338a867da52c159a2afecbdedcfa88'

* commit '97bf7c03b1338a867da52c159a2afecbdedcfa88':
doc: git-howto: Leave reviewers time to react before pushing patches
Include libavutil/channel_layout.h instead of libavutil/audioconvert.h
lavu: rename audioconvert.* to channel_layout.* and deprecate audioconvert.h

Conflicts:
doc/APIchanges
doc/examples/decoding_encoding.c
doc/git-howto.texi
ffmpeg_filter.c
libavcodec/flacdec.c
libavcodec/imc.c
libavcodec/mpegaudiodec.c
libavcodec/utils.c
libavfilter/asrc_anullsrc.c
libavfilter/audio.c
libavfilter/avfilter.c
libavfilter/avfilter.h
libavfilter/avfiltergraph.c
libavfilter/buffer.c
libavutil/Makefile
libavutil/audioconvert.h
libavutil/channel_layout.c
libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/11/12 19:32:11
Showing 85 changed files
... ...
@@ -110,6 +110,9 @@ API changes, most recent first:
110 110
 2012-03-26 - a67d9cf - lavfi 2.66.100
111 111
   Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
112 112
 
113
+2012-xx-xx - xxxxxxx - lavu 52.2.0 - audioconvert.h
114
+  Rename audioconvert.h to channel_layout.h. audioconvert.h is now deprecated.
115
+
113 116
 2012-xx-xx - xxxxxxx - lavu 52.1.0 - intmath.h
114 117
   Add av_ctz() for trailing zero bit count
115 118
 
... ...
@@ -34,7 +34,7 @@
34 34
 
35 35
 #include <libavutil/opt.h>
36 36
 #include <libavcodec/avcodec.h>
37
-#include <libavutil/audioconvert.h>
37
+#include <libavutil/channel_layout.h>
38 38
 #include <libavutil/common.h>
39 39
 #include <libavutil/imgutils.h>
40 40
 #include <libavutil/mathematics.h>
... ...
@@ -1093,7 +1093,7 @@ representing a channel layout. The default value of @var{channel_layout}
1093 1093
 is "stereo".
1094 1094
 
1095 1095
 Check the channel_layout_map definition in
1096
-@file{libavcodec/audioconvert.c} for the mapping between strings and
1096
+@file{libavutil/channel_layout.c} for the mapping between strings and
1097 1097
 channel layout values.
1098 1098
 
1099 1099
 @item nb_samples, n
... ...
@@ -43,7 +43,7 @@
43 43
 #include "libswscale/swscale.h"
44 44
 #include "libswresample/swresample.h"
45 45
 #include "libavutil/opt.h"
46
-#include "libavutil/audioconvert.h"
46
+#include "libavutil/channel_layout.h"
47 47
 #include "libavutil/parseutils.h"
48 48
 #include "libavutil/samplefmt.h"
49 49
 #include "libavutil/colorspace.h"
... ...
@@ -24,10 +24,10 @@
24 24
 #include "libavfilter/avfiltergraph.h"
25 25
 #include "libavfilter/buffersink.h"
26 26
 
27
-#include "libavutil/audioconvert.h"
28 27
 #include "libavutil/avassert.h"
29 28
 #include "libavutil/avstring.h"
30 29
 #include "libavutil/bprint.h"
30
+#include "libavutil/channel_layout.h"
31 31
 #include "libavutil/pixdesc.h"
32 32
 #include "libavutil/pixfmt.h"
33 33
 #include "libavutil/imgutils.h"
... ...
@@ -30,10 +30,10 @@
30 30
 #include "libavfilter/avfilter.h"
31 31
 #include "libavfilter/avfiltergraph.h"
32 32
 
33
-#include "libavutil/audioconvert.h"
34 33
 #include "libavutil/avassert.h"
35 34
 #include "libavutil/avstring.h"
36 35
 #include "libavutil/avutil.h"
36
+#include "libavutil/channel_layout.h"
37 37
 #include "libavutil/intreadwrite.h"
38 38
 #include "libavutil/fifo.h"
39 39
 #include "libavutil/mathematics.h"
... ...
@@ -30,7 +30,7 @@
30 30
 #ifndef AVCODEC_AACDECTAB_H
31 31
 #define AVCODEC_AACDECTAB_H
32 32
 
33
-#include "libavutil/audioconvert.h"
33
+#include "libavutil/channel_layout.h"
34 34
 #include "aac.h"
35 35
 
36 36
 #include <stdint.h>
... ...
@@ -20,11 +20,11 @@
20 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 21
  */
22 22
 
23
+#include "libavutil/channel_layout.h"
23 24
 #include "parser.h"
24 25
 #include "ac3_parser.h"
25 26
 #include "aac_ac3_parser.h"
26 27
 #include "get_bits.h"
27
-#include "libavutil/audioconvert.h"
28 28
 
29 29
 
30 30
 #define AC3_HEADER_SIZE 7
... ...
@@ -30,9 +30,9 @@
30 30
 
31 31
 #include <stdint.h>
32 32
 
33
-#include "libavutil/audioconvert.h"
34 33
 #include "libavutil/avassert.h"
35 34
 #include "libavutil/avstring.h"
35
+#include "libavutil/channel_layout.h"
36 36
 #include "libavutil/crc.h"
37 37
 #include "libavutil/opt.h"
38 38
 #include "avcodec.h"
... ...
@@ -40,7 +40,6 @@
40 40
 #include "dsputil.h"
41 41
 #include "ac3dsp.h"
42 42
 #include "ac3.h"
43
-#include "audioconvert.h"
44 43
 #include "fft.h"
45 44
 #include "ac3enc.h"
46 45
 #include "eac3enc.h"
... ...
@@ -24,7 +24,7 @@
24 24
  * tables taken directly from the AC-3 spec.
25 25
  */
26 26
 
27
-#include "libavutil/audioconvert.h"
27
+#include "libavutil/channel_layout.h"
28 28
 #include "avcodec.h"
29 29
 #include "ac3tab.h"
30 30
 
... ...
@@ -45,7 +45,7 @@
45 45
  * 32bit  samplerate
46 46
  */
47 47
 
48
-#include "libavutil/audioconvert.h"
48
+#include "libavutil/channel_layout.h"
49 49
 #include "avcodec.h"
50 50
 #include "get_bits.h"
51 51
 #include "bytestream.h"
... ...
@@ -43,7 +43,7 @@
43 43
 #include <string.h>
44 44
 #include <math.h>
45 45
 
46
-#include "libavutil/audioconvert.h"
46
+#include "libavutil/channel_layout.h"
47 47
 #include "avcodec.h"
48 48
 #include "dsputil.h"
49 49
 #include "libavutil/common.h"
... ...
@@ -24,7 +24,7 @@
24 24
  * AMR wideband decoder
25 25
  */
26 26
 
27
-#include "libavutil/audioconvert.h"
27
+#include "libavutil/channel_layout.h"
28 28
 #include "libavutil/common.h"
29 29
 #include "libavutil/lfg.h"
30 30
 
... ...
@@ -20,12 +20,12 @@
20 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 21
  */
22 22
 
23
+#include "libavutil/avassert.h"
24
+#include "libavutil/channel_layout.h"
25
+#include "libavutil/opt.h"
23 26
 #include "avcodec.h"
24 27
 #include "dsputil.h"
25 28
 #include "bytestream.h"
26
-#include "libavutil/audioconvert.h"
27
-#include "libavutil/avassert.h"
28
-#include "libavutil/opt.h"
29 29
 
30 30
 /**
31 31
  * @file
... ...
@@ -31,7 +31,7 @@
31 31
 
32 32
 #include "libavutil/cpu.h"
33 33
 #include "avcodec.h"
34
-#include "libavutil/audioconvert.h"
34
+#include "libavutil/channel_layout.h"
35 35
 
36 36
 struct AVAudioConvert;
37 37
 typedef struct AVAudioConvert AVAudioConvert;
... ...
@@ -19,7 +19,7 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 
22
-#include "libavutil/audioconvert.h"
22
+#include "libavutil/channel_layout.h"
23 23
 #include "avcodec.h"
24 24
 #include "bytestream.h"
25 25
 #include "libavutil/avassert.h"
... ...
@@ -42,13 +42,13 @@
42 42
  * available.
43 43
  */
44 44
 
45
+#include "libavutil/channel_layout.h"
45 46
 #include "libavutil/lfg.h"
46 47
 #include "avcodec.h"
47 48
 #include "get_bits.h"
48 49
 #include "dsputil.h"
49 50
 #include "bytestream.h"
50 51
 #include "fft.h"
51
-#include "libavutil/audioconvert.h"
52 52
 #include "sinewin.h"
53 53
 
54 54
 #include "cookdata.h"
... ...
@@ -26,12 +26,12 @@
26 26
 #include <stddef.h>
27 27
 #include <stdio.h>
28 28
 
29
+#include "libavutil/channel_layout.h"
29 30
 #include "libavutil/common.h"
30 31
 #include "libavutil/float_dsp.h"
31 32
 #include "libavutil/intmath.h"
32 33
 #include "libavutil/intreadwrite.h"
33 34
 #include "libavutil/mathematics.h"
34
-#include "libavutil/audioconvert.h"
35 35
 #include "libavutil/samplefmt.h"
36 36
 #include "avcodec.h"
37 37
 #include "dsputil.h"
... ...
@@ -24,7 +24,7 @@
24 24
  * Delphine Software International CIN audio/video decoders
25 25
  */
26 26
 
27
-#include "libavutil/audioconvert.h"
27
+#include "libavutil/channel_layout.h"
28 28
 #include "avcodec.h"
29 29
 #include "bytestream.h"
30 30
 #include "mathops.h"
... ...
@@ -19,7 +19,7 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 
22
-#include "libavutil/audioconvert.h"
22
+#include "libavutil/channel_layout.h"
23 23
 #include "libavutil/crc.h"
24 24
 #include "libavutil/log.h"
25 25
 #include "bytestream.h"
... ...
@@ -33,8 +33,8 @@
33 33
 
34 34
 #include <limits.h>
35 35
 
36
-#include "libavutil/audioconvert.h"
37 36
 #include "libavutil/avassert.h"
37
+#include "libavutil/channel_layout.h"
38 38
 #include "libavutil/crc.h"
39 39
 #include "avcodec.h"
40 40
 #include "internal.h"
... ...
@@ -34,11 +34,11 @@
34 34
  *       respectively of each byte are ignored.
35 35
  */
36 36
 
37
-#include "libavutil/audioconvert.h"
37
+#include "libavutil/channel_layout.h"
38
+#include "libavutil/opt.h"
38 39
 #include "avcodec.h"
39 40
 #include "get_bits.h"
40 41
 #include "g722.h"
41
-#include "libavutil/opt.h"
42 42
 
43 43
 #define OFFSET(x) offsetof(G722Context, x)
44 44
 #define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
... ...
@@ -26,7 +26,7 @@
26 26
  */
27 27
 
28 28
 #define BITSTREAM_READER_LE
29
-#include "libavutil/audioconvert.h"
29
+#include "libavutil/channel_layout.h"
30 30
 #include "libavutil/mem.h"
31 31
 #include "libavutil/opt.h"
32 32
 #include "avcodec.h"
... ...
@@ -23,8 +23,8 @@
23 23
  */
24 24
 #include <limits.h>
25 25
 
26
-#include "libavutil/audioconvert.h"
27 26
 #include "libavutil/avassert.h"
27
+#include "libavutil/channel_layout.h"
28 28
 #include "libavutil/opt.h"
29 29
 #include "avcodec.h"
30 30
 #include "internal.h"
... ...
@@ -24,7 +24,7 @@
24 24
  * GSM decoder
25 25
  */
26 26
 
27
-#include "libavutil/audioconvert.h"
27
+#include "libavutil/channel_layout.h"
28 28
 #include "avcodec.h"
29 29
 #include "get_bits.h"
30 30
 #include "msgsmdec.h"
... ...
@@ -35,12 +35,12 @@
35 35
 #include <stddef.h>
36 36
 #include <stdio.h>
37 37
 
38
+#include "libavutil/channel_layout.h"
39
+#include "libavutil/libm.h"
38 40
 #include "avcodec.h"
39 41
 #include "get_bits.h"
40 42
 #include "dsputil.h"
41 43
 #include "fft.h"
42
-#include "libavutil/audioconvert.h"
43
-#include "libavutil/libm.h"
44 44
 #include "sinewin.h"
45 45
 
46 46
 #include "imcdata.h"
... ...
@@ -26,11 +26,11 @@
26 26
 
27 27
 #include <faac.h>
28 28
 
29
+#include "libavutil/channel_layout.h"
30
+#include "libavutil/common.h"
29 31
 #include "avcodec.h"
30 32
 #include "audio_frame_queue.h"
31 33
 #include "internal.h"
32
-#include "libavutil/audioconvert.h"
33
-#include "libavutil/common.h"
34 34
 
35 35
 
36 36
 /* libfaac has an encoder delay of 1024 samples */
... ...
@@ -21,12 +21,12 @@
21 21
 
22 22
 #include <fdk-aac/aacenc_lib.h>
23 23
 
24
+#include "libavutil/channel_layout.h"
25
+#include "libavutil/common.h"
26
+#include "libavutil/opt.h"
24 27
 #include "avcodec.h"
25 28
 #include "audio_frame_queue.h"
26 29
 #include "internal.h"
27
-#include "libavutil/audioconvert.h"
28
-#include "libavutil/common.h"
29
-#include "libavutil/opt.h"
30 30
 
31 31
 typedef struct AACContext {
32 32
     const AVClass *class;
... ...
@@ -29,11 +29,11 @@
29 29
 
30 30
 #include <gsm/gsm.h>
31 31
 
32
-#include "libavutil/audioconvert.h"
32
+#include "libavutil/channel_layout.h"
33
+#include "libavutil/common.h"
33 34
 #include "avcodec.h"
34 35
 #include "internal.h"
35 36
 #include "gsm.h"
36
-#include "libavutil/common.h"
37 37
 
38 38
 static av_cold int libgsm_encode_close(AVCodecContext *avctx) {
39 39
 #if FF_API_OLD_ENCODE_AUDIO
... ...
@@ -21,10 +21,10 @@
21 21
 
22 22
 #include <ilbc.h>
23 23
 
24
-#include "libavutil/audioconvert.h"
25
-#include "avcodec.h"
24
+#include "libavutil/channel_layout.h"
26 25
 #include "libavutil/common.h"
27 26
 #include "libavutil/opt.h"
27
+#include "avcodec.h"
28 28
 #include "internal.h"
29 29
 
30 30
 static int get_mode(AVCodecContext *avctx)
... ...
@@ -26,7 +26,7 @@
26 26
 
27 27
 #include <lame/lame.h>
28 28
 
29
-#include "libavutil/audioconvert.h"
29
+#include "libavutil/channel_layout.h"
30 30
 #include "libavutil/common.h"
31 31
 #include "libavutil/intreadwrite.h"
32 32
 #include "libavutil/log.h"
... ...
@@ -19,11 +19,11 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 
22
-#include "libavutil/audioconvert.h"
23
-#include "avcodec.h"
24 22
 #include "libavutil/avstring.h"
23
+#include "libavutil/channel_layout.h"
25 24
 #include "libavutil/common.h"
26 25
 #include "libavutil/opt.h"
26
+#include "avcodec.h"
27 27
 #include "audio_frame_queue.h"
28 28
 #include "internal.h"
29 29
 
... ...
@@ -23,7 +23,7 @@
23 23
 #include <speex/speex_stereo.h>
24 24
 #include <speex/speex_callbacks.h>
25 25
 
26
-#include "libavutil/audioconvert.h"
26
+#include "libavutil/channel_layout.h"
27 27
 #include "libavutil/common.h"
28 28
 #include "avcodec.h"
29 29
 
... ...
@@ -85,7 +85,7 @@
85 85
 #include <speex/speex_header.h>
86 86
 #include <speex/speex_stereo.h>
87 87
 
88
-#include "libavutil/audioconvert.h"
88
+#include "libavutil/channel_layout.h"
89 89
 #include "libavutil/common.h"
90 90
 #include "libavutil/opt.h"
91 91
 #include "avcodec.h"
... ...
@@ -26,8 +26,8 @@
26 26
 
27 27
 #include <stdint.h>
28 28
 
29
+#include "libavutil/channel_layout.h"
29 30
 #include "libavutil/crc.h"
30
-#include "libavutil/audioconvert.h"
31 31
 #include "get_bits.h"
32 32
 #include "parser.h"
33 33
 #include "mlp_parser.h"
... ...
@@ -25,12 +25,12 @@
25 25
  * divided into 32 subbands.
26 26
  */
27 27
 
28
+#include "libavutil/channel_layout.h"
28 29
 #include "libavutil/lfg.h"
29 30
 #include "avcodec.h"
30 31
 #include "get_bits.h"
31 32
 #include "dsputil.h"
32 33
 #include "mpegaudiodsp.h"
33
-#include "libavutil/audioconvert.h"
34 34
 
35 35
 #include "mpc.h"
36 36
 #include "mpc7data.h"
... ...
@@ -25,12 +25,12 @@
25 25
  * divided into 32 subbands.
26 26
  */
27 27
 
28
+#include "libavutil/channel_layout.h"
28 29
 #include "libavutil/lfg.h"
29 30
 #include "avcodec.h"
30 31
 #include "get_bits.h"
31 32
 #include "dsputil.h"
32 33
 #include "mpegaudiodsp.h"
33
-#include "libavutil/audioconvert.h"
34 34
 
35 35
 #include "mpc.h"
36 36
 #include "mpc8data.h"
... ...
@@ -24,8 +24,8 @@
24 24
  * MPEG Audio decoder
25 25
  */
26 26
 
27
-#include "libavutil/audioconvert.h"
28 27
 #include "libavutil/avassert.h"
28
+#include "libavutil/channel_layout.h"
29 29
 #include "libavutil/libm.h"
30 30
 #include "avcodec.h"
31 31
 #include "get_bits.h"
... ...
@@ -24,7 +24,7 @@
24 24
  * The simplest mpeg audio layer 2 encoder.
25 25
  */
26 26
 
27
-#include "libavutil/audioconvert.h"
27
+#include "libavutil/channel_layout.h"
28 28
 
29 29
 #include "avcodec.h"
30 30
 #include "internal.h"
... ...
@@ -31,14 +31,14 @@
31 31
  * implementors. The original code is available from http://code.google.com/p/nelly2pcm/
32 32
  */
33 33
 
34
-#include "nellymoser.h"
34
+#include "libavutil/channel_layout.h"
35 35
 #include "libavutil/lfg.h"
36 36
 #include "libavutil/random_seed.h"
37
-#include "libavutil/audioconvert.h"
38 37
 #include "avcodec.h"
39 38
 #include "dsputil.h"
40 39
 #include "fft.h"
41 40
 #include "fmtconvert.h"
41
+#include "nellymoser.h"
42 42
 #include "sinewin.h"
43 43
 
44 44
 #define BITSTREAM_READER_LE
... ...
@@ -24,7 +24,7 @@
24 24
  * PCM codecs for encodings found in MPEG streams (DVD/Blu-ray)
25 25
  */
26 26
 
27
-#include "libavutil/audioconvert.h"
27
+#include "libavutil/channel_layout.h"
28 28
 #include "avcodec.h"
29 29
 #include "bytestream.h"
30 30
 
... ...
@@ -29,7 +29,7 @@
29 29
 
30 30
 #include <stddef.h>
31 31
 
32
-#include "libavutil/audioconvert.h"
32
+#include "libavutil/channel_layout.h"
33 33
 #include "avcodec.h"
34 34
 #include "internal.h"
35 35
 #include "get_bits.h"
... ...
@@ -36,7 +36,7 @@
36 36
 #include <stdio.h>
37 37
 
38 38
 #define BITSTREAM_READER_LE
39
-#include "libavutil/audioconvert.h"
39
+#include "libavutil/channel_layout.h"
40 40
 #include "avcodec.h"
41 41
 #include "get_bits.h"
42 42
 #include "dsputil.h"
... ...
@@ -22,7 +22,7 @@
22 22
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 23
  */
24 24
 
25
-#include "libavutil/audioconvert.h"
25
+#include "libavutil/channel_layout.h"
26 26
 #include "libavutil/intmath.h"
27 27
 #include "avcodec.h"
28 28
 #include "get_bits.h"
... ...
@@ -19,7 +19,7 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 
22
-#include "libavutil/audioconvert.h"
22
+#include "libavutil/channel_layout.h"
23 23
 #include "libavutil/float_dsp.h"
24 24
 #include "avcodec.h"
25 25
 #define BITSTREAM_READER_LE
... ...
@@ -26,11 +26,11 @@
26 26
  * Dedicated to the mastermind behind it, Ralph Wiggum.
27 27
  */
28 28
 
29
+#include "libavutil/channel_layout.h"
29 30
 #include "avcodec.h"
30 31
 #include "get_bits.h"
31 32
 #include "golomb.h"
32 33
 #include "unary.h"
33
-#include "libavutil/audioconvert.h"
34 34
 #include "ralfdata.h"
35 35
 
36 36
 #define FILTER_NONE 0
... ...
@@ -25,7 +25,7 @@
25 25
 #include <stdint.h>
26 26
 #include <string.h>
27 27
 
28
-#include "libavutil/audioconvert.h"
28
+#include "libavutil/channel_layout.h"
29 29
 #include "libavutil/mathematics.h"
30 30
 #include "avcodec.h"
31 31
 #define BITSTREAM_READER_LE
... ...
@@ -31,8 +31,8 @@
31 31
 #include <stdio.h>
32 32
 #include <stdlib.h>
33 33
 
34
+#include "libavutil/channel_layout.h"
34 35
 #include "avcodec.h"
35
-#include "libavutil/audioconvert.h"
36 36
 #include "mathops.h"
37 37
 
38 38
 #define BITSTREAM_READER_LE
... ...
@@ -19,7 +19,7 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 
22
-#include "libavutil/audioconvert.h"
22
+#include "libavutil/channel_layout.h"
23 23
 #include "libavutil/intreadwrite.h"
24 24
 #include "avcodec.h"
25 25
 #include "dsputil.h"
... ...
@@ -19,7 +19,7 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 
22
-#include "libavutil/audioconvert.h"
22
+#include "libavutil/channel_layout.h"
23 23
 #include "libavutil/float_dsp.h"
24 24
 #include "avcodec.h"
25 25
 #include "get_bits.h"
... ...
@@ -27,10 +27,10 @@
27 27
 
28 28
 #include "libavutil/avassert.h"
29 29
 #include "libavutil/avstring.h"
30
+#include "libavutil/channel_layout.h"
30 31
 #include "libavutil/crc.h"
31 32
 #include "libavutil/mathematics.h"
32 33
 #include "libavutil/pixdesc.h"
33
-#include "libavutil/audioconvert.h"
34 34
 #include "libavutil/imgutils.h"
35 35
 #include "libavutil/samplefmt.h"
36 36
 #include "libavutil/dict.h"
... ...
@@ -40,7 +40,6 @@
40 40
 #include "libavutil/opt.h"
41 41
 #include "thread.h"
42 42
 #include "frame_thread_encoder.h"
43
-#include "audioconvert.h"
44 43
 #include "internal.h"
45 44
 #include "bytestream.h"
46 45
 #include <stdlib.h>
... ...
@@ -43,7 +43,7 @@
43 43
 #include <stdlib.h>
44 44
 #include <string.h>
45 45
 
46
-#include "libavutil/audioconvert.h"
46
+#include "libavutil/channel_layout.h"
47 47
 #include "libavutil/common.h"
48 48
 #include "libavutil/intreadwrite.h"
49 49
 #include "avcodec.h"
... ...
@@ -18,10 +18,10 @@
18 18
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 19
  */
20 20
 
21
+#include "libavutil/channel_layout.h"
22
+#include "libavutil/mem.h"
21 23
 #include "dsputil.h"
22 24
 #include "vorbis.h"
23
-#include "libavutil/audioconvert.h"
24
-#include "libavutil/mem.h"
25 25
 
26 26
 const uint8_t ff_vorbis_channel_layout_offsets[8][8] = {
27 27
     { 0 },
... ...
@@ -21,7 +21,7 @@
21 21
 
22 22
 #define BITSTREAM_READER_LE
23 23
 
24
-#include "libavutil/audioconvert.h"
24
+#include "libavutil/channel_layout.h"
25 25
 #include "avcodec.h"
26 26
 #include "get_bits.h"
27 27
 #include "unary.h"
... ...
@@ -29,7 +29,7 @@
29 29
 
30 30
 #include <math.h>
31 31
 
32
-#include "libavutil/audioconvert.h"
32
+#include "libavutil/channel_layout.h"
33 33
 #include "libavutil/mem.h"
34 34
 #include "dsputil.h"
35 35
 #include "avcodec.h"
... ...
@@ -21,7 +21,7 @@
21 21
 
22 22
 #include <stdint.h>
23 23
 
24
-#include "libavutil/audioconvert.h"
24
+#include "libavutil/channel_layout.h"
25 25
 #include "libavutil/common.h"
26 26
 #include "libavutil/intreadwrite.h"
27 27
 #include "avcodec.h"
... ...
@@ -31,7 +31,7 @@
31 31
 #include <alsa/asoundlib.h>
32 32
 #include "avdevice.h"
33 33
 #include "libavutil/avassert.h"
34
-#include "libavutil/audioconvert.h"
34
+#include "libavutil/channel_layout.h"
35 35
 
36 36
 #include "alsa-audio.h"
37 37
 
... ...
@@ -23,8 +23,8 @@
23 23
  * format audio filter
24 24
  */
25 25
 
26
-#include "libavutil/audioconvert.h"
27 26
 #include "libavutil/avstring.h"
27
+#include "libavutil/channel_layout.h"
28 28
 #include "libavutil/common.h"
29 29
 #include "libavutil/opt.h"
30 30
 
... ...
@@ -28,10 +28,10 @@
28 28
  * output.
29 29
  */
30 30
 
31
-#include "libavutil/audioconvert.h"
32 31
 #include "libavutil/audio_fifo.h"
33 32
 #include "libavutil/avassert.h"
34 33
 #include "libavutil/avstring.h"
34
+#include "libavutil/channel_layout.h"
35 35
 #include "libavutil/common.h"
36 36
 #include "libavutil/float_dsp.h"
37 37
 #include "libavutil/mathematics.h"
... ...
@@ -27,7 +27,7 @@
27 27
 #include <stddef.h>
28 28
 
29 29
 #include "libavutil/adler32.h"
30
-#include "libavutil/audioconvert.h"
30
+#include "libavutil/channel_layout.h"
31 31
 #include "libavutil/common.h"
32 32
 #include "libavutil/mem.h"
33 33
 #include "libavutil/timestamp.h"
... ...
@@ -25,8 +25,8 @@
25 25
 
26 26
 #include <ctype.h>
27 27
 
28
-#include "libavutil/audioconvert.h"
29 28
 #include "libavutil/avstring.h"
29
+#include "libavutil/channel_layout.h"
30 30
 #include "libavutil/common.h"
31 31
 #include "libavutil/mathematics.h"
32 32
 #include "libavutil/opt.h"
... ...
@@ -23,7 +23,7 @@
23 23
  * Split an audio stream into per-channel streams.
24 24
  */
25 25
 
26
-#include "libavutil/audioconvert.h"
26
+#include "libavutil/channel_layout.h"
27 27
 #include "libavutil/internal.h"
28 28
 #include "libavutil/opt.h"
29 29
 
... ...
@@ -25,8 +25,8 @@
25 25
  * a single output
26 26
  */
27 27
 
28
-#include "libavutil/audioconvert.h"
29 28
 #include "libavutil/avassert.h"
29
+#include "libavutil/channel_layout.h"
30 30
 #include "libavutil/common.h"
31 31
 #include "libavutil/opt.h"
32 32
 
... ...
@@ -27,14 +27,13 @@
27 27
 #include <inttypes.h>
28 28
 #include <stdio.h>
29 29
 
30
+#include "libavutil/channel_layout.h"
31
+#include "libavutil/internal.h"
32
+#include "libavutil/opt.h"
30 33
 #include "audio.h"
31 34
 #include "avfilter.h"
32 35
 #include "internal.h"
33 36
 
34
-#include "libavutil/audioconvert.h"
35
-#include "libavutil/internal.h"
36
-#include "libavutil/opt.h"
37
-
38 37
 typedef struct {
39 38
     const AVClass *class;
40 39
     char   *channel_layout_str;
... ...
@@ -20,7 +20,7 @@
20 20
  */
21 21
 
22 22
 #include "libavutil/avassert.h"
23
-#include "libavutil/audioconvert.h"
23
+#include "libavutil/channel_layout.h"
24 24
 #include "libavutil/common.h"
25 25
 
26 26
 #include "audio.h"
... ...
@@ -19,12 +19,12 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 
22
+#include "libavutil/avassert.h"
23
+#include "libavutil/avstring.h"
24
+#include "libavutil/channel_layout.h"
22 25
 #include "libavutil/common.h"
23 26
 #include "libavutil/pixdesc.h"
24 27
 #include "libavutil/rational.h"
25
-#include "libavutil/audioconvert.h"
26
-#include "libavutil/avassert.h"
27
-#include "libavutil/avstring.h"
28 28
 
29 29
 #include "avfilter.h"
30 30
 #include "formats.h"
... ...
@@ -534,7 +534,7 @@ struct AVFilterLink {
534 534
     int h;                      ///< agreed upon image height
535 535
     AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
536 536
     /* These parameters apply only to audio */
537
-    uint64_t channel_layout;    ///< channel layout of current buffer (see libavutil/audioconvert.h)
537
+    uint64_t channel_layout;    ///< channel layout of current buffer (see libavutil/channel_layout.h)
538 538
     int sample_rate;            ///< samples per second
539 539
 
540 540
     int format;                 ///< agreed upon media format
... ...
@@ -23,8 +23,8 @@
23 23
 #include <ctype.h>
24 24
 #include <string.h>
25 25
 
26
-#include "libavutil/audioconvert.h"
27 26
 #include "libavutil/avassert.h"
27
+#include "libavutil/channel_layout.h"
28 28
 #include "libavutil/pixdesc.h"
29 29
 #include "libavcodec/avcodec.h" // avcodec_find_best_pix_fmt_of_2()
30 30
 #include "avfilter.h"
... ...
@@ -32,11 +32,6 @@
32 32
 #include "formats.h"
33 33
 #include "internal.h"
34 34
 
35
-#include "libavutil/audioconvert.h"
36
-#include "libavutil/avassert.h"
37
-#include "libavutil/common.h"
38
-#include "libavutil/log.h"
39
-
40 35
 static const AVClass filtergraph_class = {
41 36
     .class_name = "AVFilterGraph",
42 37
     .item_name  = av_default_item_name,
... ...
@@ -20,7 +20,7 @@
20 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 21
  */
22 22
 
23
-#include "libavutil/audioconvert.h"
23
+#include "libavutil/channel_layout.h"
24 24
 #include "libavutil/avassert.h"
25 25
 #include "libavutil/common.h"
26 26
 #include "libavutil/imgutils.h"
... ...
@@ -24,8 +24,8 @@
24 24
  */
25 25
 
26 26
 #include "libavutil/audio_fifo.h"
27
-#include "libavutil/audioconvert.h"
28 27
 #include "libavutil/avassert.h"
28
+#include "libavutil/channel_layout.h"
29 29
 #include "libavutil/common.h"
30 30
 #include "libavutil/mathematics.h"
31 31
 
... ...
@@ -23,6 +23,12 @@
23 23
  * memory buffer source filter
24 24
  */
25 25
 
26
+#include "libavutil/channel_layout.h"
27
+#include "libavutil/common.h"
28
+#include "libavutil/fifo.h"
29
+#include "libavutil/imgutils.h"
30
+#include "libavutil/opt.h"
31
+#include "libavutil/samplefmt.h"
26 32
 #include "audio.h"
27 33
 #include "avfilter.h"
28 34
 #include "buffersrc.h"
... ...
@@ -31,13 +37,6 @@
31 31
 #include "video.h"
32 32
 #include "avcodec.h"
33 33
 
34
-#include "libavutil/audioconvert.h"
35
-#include "libavutil/common.h"
36
-#include "libavutil/fifo.h"
37
-#include "libavutil/imgutils.h"
38
-#include "libavutil/opt.h"
39
-#include "libavutil/samplefmt.h"
40
-
41 34
 typedef struct {
42 35
     const AVClass    *class;
43 36
     AVFifoBuffer     *fifo;
... ...
@@ -24,7 +24,7 @@
24 24
  */
25 25
 
26 26
 #include "libavutil/avassert.h"
27
-#include "libavutil/audioconvert.h"
27
+#include "libavutil/channel_layout.h"
28 28
 #include "libavutil/common.h"
29 29
 #include "libavutil/mathematics.h"
30 30
 #include "libavutil/samplefmt.h"
... ...
@@ -20,10 +20,10 @@
20 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 21
  */
22 22
 
23
+#include "libavutil/channel_layout.h"
24
+#include "libavutil/intreadwrite.h"
23 25
 #include "avformat.h"
24 26
 #include "pcm.h"
25
-#include "libavutil/intreadwrite.h"
26
-#include "libavutil/audioconvert.h"
27 27
 
28 28
 #define AT1_SU_SIZE     212
29 29
 
... ...
@@ -31,8 +31,8 @@
31 31
  * special FLIs from the PC games "Magic Carpet" and "X-COM: Terror from the Deep".
32 32
  */
33 33
 
34
+#include "libavutil/channel_layout.h"
34 35
 #include "libavutil/intreadwrite.h"
35
-#include "libavutil/audioconvert.h"
36 36
 #include "avformat.h"
37 37
 #include "internal.h"
38 38
 
... ...
@@ -24,7 +24,7 @@
24 24
  * G.723.1 demuxer
25 25
  */
26 26
 
27
-#include "libavutil/audioconvert.h"
27
+#include "libavutil/channel_layout.h"
28 28
 #include "avformat.h"
29 29
 #include "internal.h"
30 30
 
... ...
@@ -26,7 +26,7 @@
26 26
 //#define MOV_EXPORT_ALL_METADATA
27 27
 
28 28
 #include "libavutil/attributes.h"
29
-#include "libavutil/audioconvert.h"
29
+#include "libavutil/channel_layout.h"
30 30
 #include "libavutil/intreadwrite.h"
31 31
 #include "libavutil/intfloat.h"
32 32
 #include "libavutil/mathematics.h"
... ...
@@ -25,7 +25,7 @@
25 25
 
26 26
 #include <stdint.h>
27 27
 
28
-#include "libavutil/audioconvert.h"
28
+#include "libavutil/channel_layout.h"
29 29
 #include "libavcodec/avcodec.h"
30 30
 #include "mov_chan.h"
31 31
 
... ...
@@ -19,7 +19,7 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 
22
-#include "libavutil/audioconvert.h"
22
+#include "libavutil/channel_layout.h"
23 23
 #include "libavutil/intreadwrite.h"
24 24
 #include "libavutil/dict.h"
25 25
 #include "avformat.h"
... ...
@@ -93,8 +93,8 @@
93 93
  *  avresample_free().
94 94
  */
95 95
 
96
-#include "libavutil/audioconvert.h"
97 96
 #include "libavutil/avutil.h"
97
+#include "libavutil/channel_layout.h"
98 98
 #include "libavutil/dict.h"
99 99
 #include "libavutil/log.h"
100 100
 
... ...
@@ -14,6 +14,7 @@ HEADERS = adler32.h                                                     \
14 14
           blowfish.h                                                    \
15 15
           bprint.h                                                      \
16 16
           bswap.h                                                       \
17
+          channel_layout.h                                              \
17 18
           common.h                                                      \
18 19
           cpu.h                                                         \
19 20
           crc.h                                                         \
... ...
@@ -58,11 +59,11 @@ BUILT_HEADERS = avconfig.h
58 58
 OBJS = adler32.o                                                        \
59 59
        aes.o                                                            \
60 60
        audio_fifo.o                                                     \
61
-       audioconvert.o                                                   \
62 61
        avstring.o                                                       \
63 62
        base64.o                                                         \
64 63
        blowfish.o                                                       \
65 64
        bprint.o                                                         \
65
+       channel_layout.o                                                 \
66 66
        cpu.o                                                            \
67 67
        crc.o                                                            \
68 68
        des.o                                                            \
69 69
deleted file mode 100644
... ...
@@ -1,257 +0,0 @@
1
-/*
2
- * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3
- *
4
- * This file is part of FFmpeg.
5
- *
6
- * FFmpeg is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * FFmpeg is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with FFmpeg; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
- */
20
-
21
-/**
22
- * @file
23
- * audio conversion routines
24
- */
25
-
26
-#include "avstring.h"
27
-#include "avutil.h"
28
-#include "audioconvert.h"
29
-#include "bprint.h"
30
-#include "common.h"
31
-
32
-struct channel_name {
33
-    const char *name;
34
-    const char *description;
35
-};
36
-
37
-static const struct channel_name channel_names[] = {
38
-     [0] = { "FL",        "front left"            },
39
-     [1] = { "FR",        "front right"           },
40
-     [2] = { "FC",        "front center"          },
41
-     [3] = { "LFE",       "low frequency"         },
42
-     [4] = { "BL",        "back left"             },
43
-     [5] = { "BR",        "back right"            },
44
-     [6] = { "FLC",       "front left-of-center"  },
45
-     [7] = { "FRC",       "front right-of-center" },
46
-     [8] = { "BC",        "back center"           },
47
-     [9] = { "SL",        "side left"             },
48
-    [10] = { "SR",        "side right"            },
49
-    [11] = { "TC",        "top center"            },
50
-    [12] = { "TFL",       "top front left"        },
51
-    [13] = { "TFC",       "top front center"      },
52
-    [14] = { "TFR",       "top front right"       },
53
-    [15] = { "TBL",       "top back left"         },
54
-    [16] = { "TBC",       "top back center"       },
55
-    [17] = { "TBR",       "top back right"        },
56
-    [29] = { "DL",        "downmix left"          },
57
-    [30] = { "DR",        "downmix right"         },
58
-    [31] = { "WL",        "wide left"             },
59
-    [32] = { "WR",        "wide right"            },
60
-    [33] = { "SDL",       "surround direct left"  },
61
-    [34] = { "SDR",       "surround direct right" },
62
-    [35] = { "LFE2",      "low frequency 2"       },
63
-};
64
-
65
-static const char *get_channel_name(int channel_id)
66
-{
67
-    if (channel_id < 0 || channel_id >= FF_ARRAY_ELEMS(channel_names))
68
-        return NULL;
69
-    return channel_names[channel_id].name;
70
-}
71
-
72
-static const struct {
73
-    const char *name;
74
-    int         nb_channels;
75
-    uint64_t     layout;
76
-} channel_layout_map[] = {
77
-    { "mono",        1,  AV_CH_LAYOUT_MONO },
78
-    { "stereo",      2,  AV_CH_LAYOUT_STEREO },
79
-    { "2.1",         3,  AV_CH_LAYOUT_2POINT1 },
80
-    { "3.0",         3,  AV_CH_LAYOUT_SURROUND },
81
-    { "3.0(back)",   3,  AV_CH_LAYOUT_2_1 },
82
-    { "4.0",         4,  AV_CH_LAYOUT_4POINT0 },
83
-    { "quad",        4,  AV_CH_LAYOUT_QUAD },
84
-    { "quad(side)",  4,  AV_CH_LAYOUT_2_2 },
85
-    { "3.1",         4,  AV_CH_LAYOUT_3POINT1 },
86
-    { "5.0",         5,  AV_CH_LAYOUT_5POINT0_BACK },
87
-    { "5.0(side)",   5,  AV_CH_LAYOUT_5POINT0 },
88
-    { "4.1",         5,  AV_CH_LAYOUT_4POINT1 },
89
-    { "5.1",         6,  AV_CH_LAYOUT_5POINT1_BACK },
90
-    { "5.1(side)",   6,  AV_CH_LAYOUT_5POINT1 },
91
-    { "6.0",         6,  AV_CH_LAYOUT_6POINT0 },
92
-    { "6.0(front)",  6,  AV_CH_LAYOUT_6POINT0_FRONT },
93
-    { "hexagonal",   6,  AV_CH_LAYOUT_HEXAGONAL },
94
-    { "6.1",         7,  AV_CH_LAYOUT_6POINT1 },
95
-    { "6.1",         7,  AV_CH_LAYOUT_6POINT1_BACK },
96
-    { "6.1(front)",  7,  AV_CH_LAYOUT_6POINT1_FRONT },
97
-    { "7.0",         7,  AV_CH_LAYOUT_7POINT0 },
98
-    { "7.0(front)",  7,  AV_CH_LAYOUT_7POINT0_FRONT },
99
-    { "7.1",         8,  AV_CH_LAYOUT_7POINT1 },
100
-    { "7.1(wide)",   8,  AV_CH_LAYOUT_7POINT1_WIDE },
101
-    { "octagonal",   8,  AV_CH_LAYOUT_OCTAGONAL },
102
-    { "downmix",     2,  AV_CH_LAYOUT_STEREO_DOWNMIX, },
103
-};
104
-
105
-static uint64_t get_channel_layout_single(const char *name, int name_len)
106
-{
107
-    int i;
108
-    char *end;
109
-    int64_t layout;
110
-
111
-    for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++) {
112
-        if (strlen(channel_layout_map[i].name) == name_len &&
113
-            !memcmp(channel_layout_map[i].name, name, name_len))
114
-            return channel_layout_map[i].layout;
115
-    }
116
-    for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
117
-        if (channel_names[i].name &&
118
-            strlen(channel_names[i].name) == name_len &&
119
-            !memcmp(channel_names[i].name, name, name_len))
120
-            return (int64_t)1 << i;
121
-    i = strtol(name, &end, 10);
122
-    if (end - name == name_len ||
123
-        (end + 1 - name == name_len && *end  == 'c'))
124
-        return av_get_default_channel_layout(i);
125
-    layout = strtoll(name, &end, 0);
126
-    if (end - name == name_len)
127
-        return FFMAX(layout, 0);
128
-    return 0;
129
-}
130
-
131
-uint64_t av_get_channel_layout(const char *name)
132
-{
133
-    const char *n, *e;
134
-    const char *name_end = name + strlen(name);
135
-    int64_t layout = 0, layout_single;
136
-
137
-    for (n = name; n < name_end; n = e + 1) {
138
-        for (e = n; e < name_end && *e != '+' && *e != '|'; e++);
139
-        layout_single = get_channel_layout_single(n, e - n);
140
-        if (!layout_single)
141
-            return 0;
142
-        layout |= layout_single;
143
-    }
144
-    return layout;
145
-}
146
-
147
-void av_bprint_channel_layout(struct AVBPrint *bp,
148
-                              int nb_channels, uint64_t channel_layout)
149
-{
150
-    int i;
151
-
152
-    if (nb_channels <= 0)
153
-        nb_channels = av_get_channel_layout_nb_channels(channel_layout);
154
-
155
-    for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++)
156
-        if (nb_channels    == channel_layout_map[i].nb_channels &&
157
-            channel_layout == channel_layout_map[i].layout) {
158
-            av_bprintf(bp, "%s", channel_layout_map[i].name);
159
-            return;
160
-        }
161
-
162
-    av_bprintf(bp, "%d channels", nb_channels);
163
-    if (channel_layout) {
164
-        int i, ch;
165
-        av_bprintf(bp, " (");
166
-        for (i = 0, ch = 0; i < 64; i++) {
167
-            if ((channel_layout & (UINT64_C(1) << i))) {
168
-                const char *name = get_channel_name(i);
169
-                if (name) {
170
-                    if (ch > 0)
171
-                        av_bprintf(bp, "+");
172
-                    av_bprintf(bp, "%s", name);
173
-                }
174
-                ch++;
175
-            }
176
-        }
177
-        av_bprintf(bp, ")");
178
-    }
179
-}
180
-
181
-void av_get_channel_layout_string(char *buf, int buf_size,
182
-                                  int nb_channels, uint64_t channel_layout)
183
-{
184
-    AVBPrint bp;
185
-
186
-    av_bprint_init_for_buffer(&bp, buf, buf_size);
187
-    av_bprint_channel_layout(&bp, nb_channels, channel_layout);
188
-}
189
-
190
-int av_get_channel_layout_nb_channels(uint64_t channel_layout)
191
-{
192
-    return av_popcount64(channel_layout);
193
-}
194
-
195
-int64_t av_get_default_channel_layout(int nb_channels) {
196
-    int i;
197
-    for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++)
198
-        if (nb_channels == channel_layout_map[i].nb_channels)
199
-            return channel_layout_map[i].layout;
200
-    return 0;
201
-}
202
-
203
-int av_get_channel_layout_channel_index(uint64_t channel_layout,
204
-                                        uint64_t channel)
205
-{
206
-    if (!(channel_layout & channel) ||
207
-        av_get_channel_layout_nb_channels(channel) != 1)
208
-        return AVERROR(EINVAL);
209
-    channel_layout &= channel - 1;
210
-    return av_get_channel_layout_nb_channels(channel_layout);
211
-}
212
-
213
-const char *av_get_channel_name(uint64_t channel)
214
-{
215
-    int i;
216
-    if (av_get_channel_layout_nb_channels(channel) != 1)
217
-        return NULL;
218
-    for (i = 0; i < 64; i++)
219
-        if ((1ULL<<i) & channel)
220
-            return get_channel_name(i);
221
-    return NULL;
222
-}
223
-
224
-const char *av_get_channel_description(uint64_t channel)
225
-{
226
-    int i;
227
-    if (av_get_channel_layout_nb_channels(channel) != 1)
228
-        return NULL;
229
-    for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
230
-        if ((1ULL<<i) & channel)
231
-            return channel_names[i].description;
232
-    return NULL;
233
-}
234
-
235
-uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
236
-{
237
-    int i;
238
-
239
-    if (av_get_channel_layout_nb_channels(channel_layout) <= index)
240
-        return 0;
241
-
242
-    for (i = 0; i < 64; i++) {
243
-        if ((1ULL << i) & channel_layout && !index--)
244
-            return 1ULL << i;
245
-    }
246
-    return 0;
247
-}
248
-
249
-int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
250
-                                   const char **name)
251
-{
252
-    if (index >= FF_ARRAY_ELEMS(channel_layout_map))
253
-        return AVERROR_EOF;
254
-    if (layout) *layout = channel_layout_map[index].layout;
255
-    if (name)   *name   = channel_layout_map[index].name;
256
-    return 0;
257
-}
... ...
@@ -1,208 +1,6 @@
1
-/*
2
- * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3
- * Copyright (c) 2008 Peter Ross
4
- *
5
- * This file is part of FFmpeg.
6
- *
7
- * FFmpeg is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * FFmpeg is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with FFmpeg; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
- */
21 1
 
22
-#ifndef AVUTIL_AUDIOCONVERT_H
23
-#define AVUTIL_AUDIOCONVERT_H
2
+#include "version.h"
24 3
 
25
-#include <stdint.h>
26
-
27
-/**
28
- * @file
29
- * audio conversion routines
30
- */
31
-
32
-/**
33
- * @addtogroup lavu_audio
34
- * @{
35
- */
36
-
37
-/**
38
- * @defgroup channel_masks Audio channel masks
39
- * @{
40
- */
41
-#define AV_CH_FRONT_LEFT             0x00000001
42
-#define AV_CH_FRONT_RIGHT            0x00000002
43
-#define AV_CH_FRONT_CENTER           0x00000004
44
-#define AV_CH_LOW_FREQUENCY          0x00000008
45
-#define AV_CH_BACK_LEFT              0x00000010
46
-#define AV_CH_BACK_RIGHT             0x00000020
47
-#define AV_CH_FRONT_LEFT_OF_CENTER   0x00000040
48
-#define AV_CH_FRONT_RIGHT_OF_CENTER  0x00000080
49
-#define AV_CH_BACK_CENTER            0x00000100
50
-#define AV_CH_SIDE_LEFT              0x00000200
51
-#define AV_CH_SIDE_RIGHT             0x00000400
52
-#define AV_CH_TOP_CENTER             0x00000800
53
-#define AV_CH_TOP_FRONT_LEFT         0x00001000
54
-#define AV_CH_TOP_FRONT_CENTER       0x00002000
55
-#define AV_CH_TOP_FRONT_RIGHT        0x00004000
56
-#define AV_CH_TOP_BACK_LEFT          0x00008000
57
-#define AV_CH_TOP_BACK_CENTER        0x00010000
58
-#define AV_CH_TOP_BACK_RIGHT         0x00020000
59
-#define AV_CH_STEREO_LEFT            0x20000000  ///< Stereo downmix.
60
-#define AV_CH_STEREO_RIGHT           0x40000000  ///< See AV_CH_STEREO_LEFT.
61
-#define AV_CH_WIDE_LEFT              0x0000000080000000ULL
62
-#define AV_CH_WIDE_RIGHT             0x0000000100000000ULL
63
-#define AV_CH_SURROUND_DIRECT_LEFT   0x0000000200000000ULL
64
-#define AV_CH_SURROUND_DIRECT_RIGHT  0x0000000400000000ULL
65
-#define AV_CH_LOW_FREQUENCY_2        0x0000000800000000ULL
66
-
67
-/** Channel mask value used for AVCodecContext.request_channel_layout
68
-    to indicate that the user requests the channel order of the decoder output
69
-    to be the native codec channel order. */
70
-#define AV_CH_LAYOUT_NATIVE          0x8000000000000000ULL
71
-
72
-/**
73
- * @}
74
- * @defgroup channel_mask_c Audio channel convenience macros
75
- * @{
76
- * */
77
-#define AV_CH_LAYOUT_MONO              (AV_CH_FRONT_CENTER)
78
-#define AV_CH_LAYOUT_STEREO            (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
79
-#define AV_CH_LAYOUT_2POINT1           (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
80
-#define AV_CH_LAYOUT_2_1               (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
81
-#define AV_CH_LAYOUT_SURROUND          (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
82
-#define AV_CH_LAYOUT_3POINT1           (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
83
-#define AV_CH_LAYOUT_4POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
84
-#define AV_CH_LAYOUT_4POINT1           (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
85
-#define AV_CH_LAYOUT_2_2               (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
86
-#define AV_CH_LAYOUT_QUAD              (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
87
-#define AV_CH_LAYOUT_5POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
88
-#define AV_CH_LAYOUT_5POINT1           (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
89
-#define AV_CH_LAYOUT_5POINT0_BACK      (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
90
-#define AV_CH_LAYOUT_5POINT1_BACK      (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
91
-#define AV_CH_LAYOUT_6POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
92
-#define AV_CH_LAYOUT_6POINT0_FRONT     (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
93
-#define AV_CH_LAYOUT_HEXAGONAL         (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
94
-#define AV_CH_LAYOUT_6POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
95
-#define AV_CH_LAYOUT_6POINT1_BACK      (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
96
-#define AV_CH_LAYOUT_6POINT1_FRONT     (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
97
-#define AV_CH_LAYOUT_7POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
98
-#define AV_CH_LAYOUT_7POINT0_FRONT     (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
99
-#define AV_CH_LAYOUT_7POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
100
-#define AV_CH_LAYOUT_7POINT1_WIDE      (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
101
-#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
102
-#define AV_CH_LAYOUT_OCTAGONAL         (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
103
-#define AV_CH_LAYOUT_STEREO_DOWNMIX    (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
104
-
105
-enum AVMatrixEncoding {
106
-    AV_MATRIX_ENCODING_NONE,
107
-    AV_MATRIX_ENCODING_DOLBY,
108
-    AV_MATRIX_ENCODING_DPLII,
109
-    AV_MATRIX_ENCODING_NB
110
-};
111
-
112
-/**
113
- * @}
114
- */
115
-
116
-/**
117
- * Return a channel layout id that matches name, or 0 if no match is found.
118
- *
119
- * name can be one or several of the following notations,
120
- * separated by '+' or '|':
121
- * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
122
- *   5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
123
- * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
124
- *   SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
125
- * - a number of channels, in decimal, optionally followed by 'c', yielding
126
- *   the default channel layout for that number of channels (@see
127
- *   av_get_default_channel_layout);
128
- * - a channel layout mask, in hexadecimal starting with "0x" (see the
129
- *   AV_CH_* macros).
130
- *
131
- * Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7"
132
- */
133
-uint64_t av_get_channel_layout(const char *name);
134
-
135
-/**
136
- * Return a description of a channel layout.
137
- * If nb_channels is <= 0, it is guessed from the channel_layout.
138
- *
139
- * @param buf put here the string containing the channel layout
140
- * @param buf_size size in bytes of the buffer
141
- */
142
-void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
143
-
144
-struct AVBPrint;
145
-/**
146
- * Append a description of a channel layout to a bprint buffer.
147
- */
148
-void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
149
-
150
-/**
151
- * Return the number of channels in the channel layout.
152
- */
153
-int av_get_channel_layout_nb_channels(uint64_t channel_layout);
154
-
155
-/**
156
- * Return default channel layout for a given number of channels.
157
- */
158
-int64_t av_get_default_channel_layout(int nb_channels);
159
-
160
-/**
161
- * Get the index of a channel in channel_layout.
162
- *
163
- * @param channel a channel layout describing exactly one channel which must be
164
- *                present in channel_layout.
165
- *
166
- * @return index of channel in channel_layout on success, a negative AVERROR
167
- *         on error.
168
- */
169
-int av_get_channel_layout_channel_index(uint64_t channel_layout,
170
-                                        uint64_t channel);
171
-
172
-/**
173
- * Get the channel with the given index in channel_layout.
174
- */
175
-uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
176
-
177
-/**
178
- * Get the name of a given channel.
179
- *
180
- * @return channel name on success, NULL on error.
181
- */
182
-const char *av_get_channel_name(uint64_t channel);
183
-
184
-/**
185
- * Get the description of a given channel.
186
- *
187
- * @param channel  a channel layout with a single channel
188
- * @return  channel description on success, NULL on error
189
- */
190
-const char *av_get_channel_description(uint64_t channel);
191
-
192
-/**
193
- * Get the value and name of a standard channel layout.
194
- *
195
- * @param[in]  index   index in an internal list, starting at 0
196
- * @param[out] layout  channel layout mask
197
- * @param[out] name    name of the layout
198
- * @return  0  if the layout exists,
199
- *          <0 if index is beyond the limits
200
- */
201
-int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
202
-                                   const char **name);
203
-
204
-/**
205
- * @}
206
- */
207
-
208
-#endif /* AVUTIL_AUDIOCONVERT_H */
4
+#if FF_API_AUDIOCONVERT
5
+#include "channel_layout.h"
6
+#endif
209 7
new file mode 100644
... ...
@@ -0,0 +1,257 @@
0
+/*
1
+ * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
2
+ *
3
+ * This file is part of FFmpeg.
4
+ *
5
+ * FFmpeg is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * FFmpeg is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with FFmpeg; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+/**
21
+ * @file
22
+ * audio channel layout utility functions
23
+ */
24
+
25
+#include "avstring.h"
26
+#include "avutil.h"
27
+#include "channel_layout.h"
28
+#include "bprint.h"
29
+#include "common.h"
30
+
31
+struct channel_name {
32
+    const char *name;
33
+    const char *description;
34
+};
35
+
36
+static const struct channel_name channel_names[] = {
37
+     [0] = { "FL",        "front left"            },
38
+     [1] = { "FR",        "front right"           },
39
+     [2] = { "FC",        "front center"          },
40
+     [3] = { "LFE",       "low frequency"         },
41
+     [4] = { "BL",        "back left"             },
42
+     [5] = { "BR",        "back right"            },
43
+     [6] = { "FLC",       "front left-of-center"  },
44
+     [7] = { "FRC",       "front right-of-center" },
45
+     [8] = { "BC",        "back center"           },
46
+     [9] = { "SL",        "side left"             },
47
+    [10] = { "SR",        "side right"            },
48
+    [11] = { "TC",        "top center"            },
49
+    [12] = { "TFL",       "top front left"        },
50
+    [13] = { "TFC",       "top front center"      },
51
+    [14] = { "TFR",       "top front right"       },
52
+    [15] = { "TBL",       "top back left"         },
53
+    [16] = { "TBC",       "top back center"       },
54
+    [17] = { "TBR",       "top back right"        },
55
+    [29] = { "DL",        "downmix left"          },
56
+    [30] = { "DR",        "downmix right"         },
57
+    [31] = { "WL",        "wide left"             },
58
+    [32] = { "WR",        "wide right"            },
59
+    [33] = { "SDL",       "surround direct left"  },
60
+    [34] = { "SDR",       "surround direct right" },
61
+    [35] = { "LFE2",      "low frequency 2"       },
62
+};
63
+
64
+static const char *get_channel_name(int channel_id)
65
+{
66
+    if (channel_id < 0 || channel_id >= FF_ARRAY_ELEMS(channel_names))
67
+        return NULL;
68
+    return channel_names[channel_id].name;
69
+}
70
+
71
+static const struct {
72
+    const char *name;
73
+    int         nb_channels;
74
+    uint64_t     layout;
75
+} channel_layout_map[] = {
76
+    { "mono",        1,  AV_CH_LAYOUT_MONO },
77
+    { "stereo",      2,  AV_CH_LAYOUT_STEREO },
78
+    { "2.1",         3,  AV_CH_LAYOUT_2POINT1 },
79
+    { "3.0",         3,  AV_CH_LAYOUT_SURROUND },
80
+    { "3.0(back)",   3,  AV_CH_LAYOUT_2_1 },
81
+    { "4.0",         4,  AV_CH_LAYOUT_4POINT0 },
82
+    { "quad",        4,  AV_CH_LAYOUT_QUAD },
83
+    { "quad(side)",  4,  AV_CH_LAYOUT_2_2 },
84
+    { "3.1",         4,  AV_CH_LAYOUT_3POINT1 },
85
+    { "5.0",         5,  AV_CH_LAYOUT_5POINT0_BACK },
86
+    { "5.0(side)",   5,  AV_CH_LAYOUT_5POINT0 },
87
+    { "4.1",         5,  AV_CH_LAYOUT_4POINT1 },
88
+    { "5.1",         6,  AV_CH_LAYOUT_5POINT1_BACK },
89
+    { "5.1(side)",   6,  AV_CH_LAYOUT_5POINT1 },
90
+    { "6.0",         6,  AV_CH_LAYOUT_6POINT0 },
91
+    { "6.0(front)",  6,  AV_CH_LAYOUT_6POINT0_FRONT },
92
+    { "hexagonal",   6,  AV_CH_LAYOUT_HEXAGONAL },
93
+    { "6.1",         7,  AV_CH_LAYOUT_6POINT1 },
94
+    { "6.1",         7,  AV_CH_LAYOUT_6POINT1_BACK },
95
+    { "6.1(front)",  7,  AV_CH_LAYOUT_6POINT1_FRONT },
96
+    { "7.0",         7,  AV_CH_LAYOUT_7POINT0 },
97
+    { "7.0(front)",  7,  AV_CH_LAYOUT_7POINT0_FRONT },
98
+    { "7.1",         8,  AV_CH_LAYOUT_7POINT1 },
99
+    { "7.1(wide)",   8,  AV_CH_LAYOUT_7POINT1_WIDE },
100
+    { "octagonal",   8,  AV_CH_LAYOUT_OCTAGONAL },
101
+    { "downmix",     2,  AV_CH_LAYOUT_STEREO_DOWNMIX, },
102
+};
103
+
104
+static uint64_t get_channel_layout_single(const char *name, int name_len)
105
+{
106
+    int i;
107
+    char *end;
108
+    int64_t layout;
109
+
110
+    for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++) {
111
+        if (strlen(channel_layout_map[i].name) == name_len &&
112
+            !memcmp(channel_layout_map[i].name, name, name_len))
113
+            return channel_layout_map[i].layout;
114
+    }
115
+    for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
116
+        if (channel_names[i].name &&
117
+            strlen(channel_names[i].name) == name_len &&
118
+            !memcmp(channel_names[i].name, name, name_len))
119
+            return (int64_t)1 << i;
120
+    i = strtol(name, &end, 10);
121
+    if (end - name == name_len ||
122
+        (end + 1 - name == name_len && *end  == 'c'))
123
+        return av_get_default_channel_layout(i);
124
+    layout = strtoll(name, &end, 0);
125
+    if (end - name == name_len)
126
+        return FFMAX(layout, 0);
127
+    return 0;
128
+}
129
+
130
+uint64_t av_get_channel_layout(const char *name)
131
+{
132
+    const char *n, *e;
133
+    const char *name_end = name + strlen(name);
134
+    int64_t layout = 0, layout_single;
135
+
136
+    for (n = name; n < name_end; n = e + 1) {
137
+        for (e = n; e < name_end && *e != '+' && *e != '|'; e++);
138
+        layout_single = get_channel_layout_single(n, e - n);
139
+        if (!layout_single)
140
+            return 0;
141
+        layout |= layout_single;
142
+    }
143
+    return layout;
144
+}
145
+
146
+void av_bprint_channel_layout(struct AVBPrint *bp,
147
+                              int nb_channels, uint64_t channel_layout)
148
+{
149
+    int i;
150
+
151
+    if (nb_channels <= 0)
152
+        nb_channels = av_get_channel_layout_nb_channels(channel_layout);
153
+
154
+    for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++)
155
+        if (nb_channels    == channel_layout_map[i].nb_channels &&
156
+            channel_layout == channel_layout_map[i].layout) {
157
+            av_bprintf(bp, "%s", channel_layout_map[i].name);
158
+            return;
159
+        }
160
+
161
+    av_bprintf(bp, "%d channels", nb_channels);
162
+    if (channel_layout) {
163
+        int i, ch;
164
+        av_bprintf(bp, " (");
165
+        for (i = 0, ch = 0; i < 64; i++) {
166
+            if ((channel_layout & (UINT64_C(1) << i))) {
167
+                const char *name = get_channel_name(i);
168
+                if (name) {
169
+                    if (ch > 0)
170
+                        av_bprintf(bp, "+");
171
+                    av_bprintf(bp, "%s", name);
172
+                }
173
+                ch++;
174
+            }
175
+        }
176
+        av_bprintf(bp, ")");
177
+    }
178
+}
179
+
180
+void av_get_channel_layout_string(char *buf, int buf_size,
181
+                                  int nb_channels, uint64_t channel_layout)
182
+{
183
+    AVBPrint bp;
184
+
185
+    av_bprint_init_for_buffer(&bp, buf, buf_size);
186
+    av_bprint_channel_layout(&bp, nb_channels, channel_layout);
187
+}
188
+
189
+int av_get_channel_layout_nb_channels(uint64_t channel_layout)
190
+{
191
+    return av_popcount64(channel_layout);
192
+}
193
+
194
+int64_t av_get_default_channel_layout(int nb_channels) {
195
+    int i;
196
+    for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++)
197
+        if (nb_channels == channel_layout_map[i].nb_channels)
198
+            return channel_layout_map[i].layout;
199
+    return 0;
200
+}
201
+
202
+int av_get_channel_layout_channel_index(uint64_t channel_layout,
203
+                                        uint64_t channel)
204
+{
205
+    if (!(channel_layout & channel) ||
206
+        av_get_channel_layout_nb_channels(channel) != 1)
207
+        return AVERROR(EINVAL);
208
+    channel_layout &= channel - 1;
209
+    return av_get_channel_layout_nb_channels(channel_layout);
210
+}
211
+
212
+const char *av_get_channel_name(uint64_t channel)
213
+{
214
+    int i;
215
+    if (av_get_channel_layout_nb_channels(channel) != 1)
216
+        return NULL;
217
+    for (i = 0; i < 64; i++)
218
+        if ((1ULL<<i) & channel)
219
+            return get_channel_name(i);
220
+    return NULL;
221
+}
222
+
223
+const char *av_get_channel_description(uint64_t channel)
224
+{
225
+    int i;
226
+    if (av_get_channel_layout_nb_channels(channel) != 1)
227
+        return NULL;
228
+    for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
229
+        if ((1ULL<<i) & channel)
230
+            return channel_names[i].description;
231
+    return NULL;
232
+}
233
+
234
+uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
235
+{
236
+    int i;
237
+
238
+    if (av_get_channel_layout_nb_channels(channel_layout) <= index)
239
+        return 0;
240
+
241
+    for (i = 0; i < 64; i++) {
242
+        if ((1ULL << i) & channel_layout && !index--)
243
+            return 1ULL << i;
244
+    }
245
+    return 0;
246
+}
247
+
248
+int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
249
+                                   const char **name)
250
+{
251
+    if (index >= FF_ARRAY_ELEMS(channel_layout_map))
252
+        return AVERROR_EOF;
253
+    if (layout) *layout = channel_layout_map[index].layout;
254
+    if (name)   *name   = channel_layout_map[index].name;
255
+    return 0;
256
+}
0 257
new file mode 100644
... ...
@@ -0,0 +1,208 @@
0
+/*
1
+ * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
2
+ * Copyright (c) 2008 Peter Ross
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+#ifndef AVUTIL_CHANNEL_LAYOUT_H
22
+#define AVUTIL_CHANNEL_LAYOUT_H
23
+
24
+#include <stdint.h>
25
+
26
+/**
27
+ * @file
28
+ * audio channel layout utility functions
29
+ */
30
+
31
+/**
32
+ * @addtogroup lavu_audio
33
+ * @{
34
+ */
35
+
36
+/**
37
+ * @defgroup channel_masks Audio channel masks
38
+ * @{
39
+ */
40
+#define AV_CH_FRONT_LEFT             0x00000001
41
+#define AV_CH_FRONT_RIGHT            0x00000002
42
+#define AV_CH_FRONT_CENTER           0x00000004
43
+#define AV_CH_LOW_FREQUENCY          0x00000008
44
+#define AV_CH_BACK_LEFT              0x00000010
45
+#define AV_CH_BACK_RIGHT             0x00000020
46
+#define AV_CH_FRONT_LEFT_OF_CENTER   0x00000040
47
+#define AV_CH_FRONT_RIGHT_OF_CENTER  0x00000080
48
+#define AV_CH_BACK_CENTER            0x00000100
49
+#define AV_CH_SIDE_LEFT              0x00000200
50
+#define AV_CH_SIDE_RIGHT             0x00000400
51
+#define AV_CH_TOP_CENTER             0x00000800
52
+#define AV_CH_TOP_FRONT_LEFT         0x00001000
53
+#define AV_CH_TOP_FRONT_CENTER       0x00002000
54
+#define AV_CH_TOP_FRONT_RIGHT        0x00004000
55
+#define AV_CH_TOP_BACK_LEFT          0x00008000
56
+#define AV_CH_TOP_BACK_CENTER        0x00010000
57
+#define AV_CH_TOP_BACK_RIGHT         0x00020000
58
+#define AV_CH_STEREO_LEFT            0x20000000  ///< Stereo downmix.
59
+#define AV_CH_STEREO_RIGHT           0x40000000  ///< See AV_CH_STEREO_LEFT.
60
+#define AV_CH_WIDE_LEFT              0x0000000080000000ULL
61
+#define AV_CH_WIDE_RIGHT             0x0000000100000000ULL
62
+#define AV_CH_SURROUND_DIRECT_LEFT   0x0000000200000000ULL
63
+#define AV_CH_SURROUND_DIRECT_RIGHT  0x0000000400000000ULL
64
+#define AV_CH_LOW_FREQUENCY_2        0x0000000800000000ULL
65
+
66
+/** Channel mask value used for AVCodecContext.request_channel_layout
67
+    to indicate that the user requests the channel order of the decoder output
68
+    to be the native codec channel order. */
69
+#define AV_CH_LAYOUT_NATIVE          0x8000000000000000ULL
70
+
71
+/**
72
+ * @}
73
+ * @defgroup channel_mask_c Audio channel convenience macros
74
+ * @{
75
+ * */
76
+#define AV_CH_LAYOUT_MONO              (AV_CH_FRONT_CENTER)
77
+#define AV_CH_LAYOUT_STEREO            (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
78
+#define AV_CH_LAYOUT_2POINT1           (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
79
+#define AV_CH_LAYOUT_2_1               (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
80
+#define AV_CH_LAYOUT_SURROUND          (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
81
+#define AV_CH_LAYOUT_3POINT1           (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
82
+#define AV_CH_LAYOUT_4POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
83
+#define AV_CH_LAYOUT_4POINT1           (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
84
+#define AV_CH_LAYOUT_2_2               (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
85
+#define AV_CH_LAYOUT_QUAD              (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
86
+#define AV_CH_LAYOUT_5POINT0           (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
87
+#define AV_CH_LAYOUT_5POINT1           (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
88
+#define AV_CH_LAYOUT_5POINT0_BACK      (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
89
+#define AV_CH_LAYOUT_5POINT1_BACK      (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
90
+#define AV_CH_LAYOUT_6POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
91
+#define AV_CH_LAYOUT_6POINT0_FRONT     (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
92
+#define AV_CH_LAYOUT_HEXAGONAL         (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
93
+#define AV_CH_LAYOUT_6POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
94
+#define AV_CH_LAYOUT_6POINT1_BACK      (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
95
+#define AV_CH_LAYOUT_6POINT1_FRONT     (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
96
+#define AV_CH_LAYOUT_7POINT0           (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
97
+#define AV_CH_LAYOUT_7POINT0_FRONT     (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
98
+#define AV_CH_LAYOUT_7POINT1           (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
99
+#define AV_CH_LAYOUT_7POINT1_WIDE      (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
100
+#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
101
+#define AV_CH_LAYOUT_OCTAGONAL         (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
102
+#define AV_CH_LAYOUT_STEREO_DOWNMIX    (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
103
+
104
+enum AVMatrixEncoding {
105
+    AV_MATRIX_ENCODING_NONE,
106
+    AV_MATRIX_ENCODING_DOLBY,
107
+    AV_MATRIX_ENCODING_DPLII,
108
+    AV_MATRIX_ENCODING_NB
109
+};
110
+
111
+/**
112
+ * @}
113
+ */
114
+
115
+/**
116
+ * Return a channel layout id that matches name, or 0 if no match is found.
117
+ *
118
+ * name can be one or several of the following notations,
119
+ * separated by '+' or '|':
120
+ * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
121
+ *   5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
122
+ * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
123
+ *   SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
124
+ * - a number of channels, in decimal, optionally followed by 'c', yielding
125
+ *   the default channel layout for that number of channels (@see
126
+ *   av_get_default_channel_layout);
127
+ * - a channel layout mask, in hexadecimal starting with "0x" (see the
128
+ *   AV_CH_* macros).
129
+ *
130
+ * Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7"
131
+ */
132
+uint64_t av_get_channel_layout(const char *name);
133
+
134
+/**
135
+ * Return a description of a channel layout.
136
+ * If nb_channels is <= 0, it is guessed from the channel_layout.
137
+ *
138
+ * @param buf put here the string containing the channel layout
139
+ * @param buf_size size in bytes of the buffer
140
+ */
141
+void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
142
+
143
+struct AVBPrint;
144
+/**
145
+ * Append a description of a channel layout to a bprint buffer.
146
+ */
147
+void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout);
148
+
149
+/**
150
+ * Return the number of channels in the channel layout.
151
+ */
152
+int av_get_channel_layout_nb_channels(uint64_t channel_layout);
153
+
154
+/**
155
+ * Return default channel layout for a given number of channels.
156
+ */
157
+int64_t av_get_default_channel_layout(int nb_channels);
158
+
159
+/**
160
+ * Get the index of a channel in channel_layout.
161
+ *
162
+ * @param channel a channel layout describing exactly one channel which must be
163
+ *                present in channel_layout.
164
+ *
165
+ * @return index of channel in channel_layout on success, a negative AVERROR
166
+ *         on error.
167
+ */
168
+int av_get_channel_layout_channel_index(uint64_t channel_layout,
169
+                                        uint64_t channel);
170
+
171
+/**
172
+ * Get the channel with the given index in channel_layout.
173
+ */
174
+uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
175
+
176
+/**
177
+ * Get the name of a given channel.
178
+ *
179
+ * @return channel name on success, NULL on error.
180
+ */
181
+const char *av_get_channel_name(uint64_t channel);
182
+
183
+/**
184
+ * Get the description of a given channel.
185
+ *
186
+ * @param channel  a channel layout with a single channel
187
+ * @return  channel description on success, NULL on error
188
+ */
189
+const char *av_get_channel_description(uint64_t channel);
190
+
191
+/**
192
+ * Get the value and name of a standard channel layout.
193
+ *
194
+ * @param[in]  index   index in an internal list, starting at 0
195
+ * @param[out] layout  channel layout mask
196
+ * @param[out] name    name of the layout
197
+ * @return  0  if the layout exists,
198
+ *          <0 if index is beyond the limits
199
+ */
200
+int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
201
+                                   const char **name);
202
+
203
+/**
204
+ * @}
205
+ */
206
+
207
+#endif /* AVUTIL_CHANNEL_LAYOUT_H */
... ...
@@ -75,7 +75,7 @@
75 75
  */
76 76
 
77 77
 #define LIBAVUTIL_VERSION_MAJOR  52
78
-#define LIBAVUTIL_VERSION_MINOR   5
78
+#define LIBAVUTIL_VERSION_MINOR   6
79 79
 #define LIBAVUTIL_VERSION_MICRO 100
80 80
 
81 81
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
... ...
@@ -120,6 +120,9 @@
120 120
 #ifndef FF_API_AV_REVERSE
121 121
 #define FF_API_AV_REVERSE               (LIBAVUTIL_VERSION_MAJOR < 53)
122 122
 #endif
123
+#ifndef FF_API_AUDIOCONVERT
124
+#define FF_API_AUDIOCONVERT             (LIBAVUTIL_VERSION_MAJOR < 53)
125
+#endif
123 126
 
124 127
 /**
125 128
  * @}