[PATCH] Move sample format definitions from libavcodec to libavutil.
Stefano Sabatini
stefano.sabatini-lala
Sat Apr 3 19:50:19 CEST 2010
---
libavcodec/avcodec.h | 58 --------------------------------
libavutil/Makefile | 1 +
libavutil/avutil.h | 1 +
libavutil/samplefmt.h | 87 +++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 89 insertions(+), 58 deletions(-)
create mode 100644 libavutil/samplefmt.h
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index add4b10..09145a5 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -367,64 +367,6 @@ enum CodecID {
#define CODEC_TYPE_NB AVMEDIA_TYPE_NB
#endif
-/**
- * all in native-endian format
- */
-enum SampleFormat {
- SAMPLE_FMT_NONE = -1,
- SAMPLE_FMT_U8, ///< unsigned 8 bits
- SAMPLE_FMT_S16, ///< signed 16 bits
- SAMPLE_FMT_S32, ///< signed 32 bits
- SAMPLE_FMT_FLT, ///< float
- SAMPLE_FMT_DBL, ///< double
- SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
-};
-
-/* Audio channel masks */
-#define CH_FRONT_LEFT 0x00000001
-#define CH_FRONT_RIGHT 0x00000002
-#define CH_FRONT_CENTER 0x00000004
-#define CH_LOW_FREQUENCY 0x00000008
-#define CH_BACK_LEFT 0x00000010
-#define CH_BACK_RIGHT 0x00000020
-#define CH_FRONT_LEFT_OF_CENTER 0x00000040
-#define CH_FRONT_RIGHT_OF_CENTER 0x00000080
-#define CH_BACK_CENTER 0x00000100
-#define CH_SIDE_LEFT 0x00000200
-#define CH_SIDE_RIGHT 0x00000400
-#define CH_TOP_CENTER 0x00000800
-#define CH_TOP_FRONT_LEFT 0x00001000
-#define CH_TOP_FRONT_CENTER 0x00002000
-#define CH_TOP_FRONT_RIGHT 0x00004000
-#define CH_TOP_BACK_LEFT 0x00008000
-#define CH_TOP_BACK_CENTER 0x00010000
-#define CH_TOP_BACK_RIGHT 0x00020000
-#define CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
-#define CH_STEREO_RIGHT 0x40000000 ///< See CH_STEREO_LEFT.
-
-/** Channel mask value used for AVCodecContext.request_channel_layout
- to indicate that the user requests the channel order of the decoder output
- to be the native codec channel order. */
-#define CH_LAYOUT_NATIVE 0x8000000000000000LL
-
-/* Audio channel convenience macros */
-#define CH_LAYOUT_MONO (CH_FRONT_CENTER)
-#define CH_LAYOUT_STEREO (CH_FRONT_LEFT|CH_FRONT_RIGHT)
-#define CH_LAYOUT_2_1 (CH_LAYOUT_STEREO|CH_BACK_CENTER)
-#define CH_LAYOUT_SURROUND (CH_LAYOUT_STEREO|CH_FRONT_CENTER)
-#define CH_LAYOUT_4POINT0 (CH_LAYOUT_SURROUND|CH_BACK_CENTER)
-#define CH_LAYOUT_2_2 (CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT)
-#define CH_LAYOUT_QUAD (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT)
-#define CH_LAYOUT_5POINT0 (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIGHT)
-#define CH_LAYOUT_5POINT1 (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY)
-#define CH_LAYOUT_5POINT0_BACK (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIGHT)
-#define CH_LAYOUT_5POINT1_BACK (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY)
-#define CH_LAYOUT_7POINT0 (CH_LAYOUT_5POINT0|CH_BACK_LEFT|CH_BACK_RIGHT)
-#define CH_LAYOUT_7POINT1 (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT)
-#define CH_LAYOUT_7POINT1_WIDE (CH_LAYOUT_5POINT1_BACK|\
- CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER)
-#define CH_LAYOUT_STEREO_DOWNMIX (CH_STEREO_LEFT|CH_STEREO_RIGHT)
-
/* in bytes */
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 79506c0..1ac1732 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -20,6 +20,7 @@ HEADERS = adler32.h \
pixdesc.h \
pixfmt.h \
rational.h \
+ samplefmt.h \
sha1.h \
BUILT_HEADERS = avconfig.h
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 1523de6..818ee9d 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -85,5 +85,6 @@ enum AVMediaType {
#include "intfloat_readwrite.h"
#include "log.h"
#include "pixfmt.h"
+#include "samplefmt.h"
#endif /* AVUTIL_AVUTIL_H */
diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h
new file mode 100644
index 0000000..bf158e7
--- /dev/null
+++ b/libavutil/samplefmt.h
@@ -0,0 +1,87 @@
+/*
+ * 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
+ */
+
+#ifndef AVUTIL_SAMPLEFMT_H
+#define AVUTIL_SAMPLEFMT_H
+
+/**
+ * @file libavutil/samplefmt.h
+ * audio sample format definitions
+ *
+ * @warning This file has to be considered an internal but installed
+ * header, so it should not be directly included in your projects.
+ */
+
+/**
+ * all in native-endian format
+ */
+enum SampleFormat {
+ SAMPLE_FMT_NONE = -1,
+ SAMPLE_FMT_U8, ///< unsigned 8 bits
+ SAMPLE_FMT_S16, ///< signed 16 bits
+ SAMPLE_FMT_S32, ///< signed 32 bits
+ SAMPLE_FMT_FLT, ///< float
+ SAMPLE_FMT_DBL, ///< double
+ SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
+};
+
+/* Audio channel masks */
+#define CH_FRONT_LEFT 0x00000001
+#define CH_FRONT_RIGHT 0x00000002
+#define CH_FRONT_CENTER 0x00000004
+#define CH_LOW_FREQUENCY 0x00000008
+#define CH_BACK_LEFT 0x00000010
+#define CH_BACK_RIGHT 0x00000020
+#define CH_FRONT_LEFT_OF_CENTER 0x00000040
+#define CH_FRONT_RIGHT_OF_CENTER 0x00000080
+#define CH_BACK_CENTER 0x00000100
+#define CH_SIDE_LEFT 0x00000200
+#define CH_SIDE_RIGHT 0x00000400
+#define CH_TOP_CENTER 0x00000800
+#define CH_TOP_FRONT_LEFT 0x00001000
+#define CH_TOP_FRONT_CENTER 0x00002000
+#define CH_TOP_FRONT_RIGHT 0x00004000
+#define CH_TOP_BACK_LEFT 0x00008000
+#define CH_TOP_BACK_CENTER 0x00010000
+#define CH_TOP_BACK_RIGHT 0x00020000
+#define CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
+#define CH_STEREO_RIGHT 0x40000000 ///< See CH_STEREO_LEFT.
+
+/** Channel mask value used for AVCodecContext.request_channel_layout
+ to indicate that the user requests the channel order of the decoder output
+ to be the native codec channel order. */
+#define CH_LAYOUT_NATIVE 0x8000000000000000LL
+
+/* Audio channel convenience macros */
+#define CH_LAYOUT_MONO (CH_FRONT_CENTER)
+#define CH_LAYOUT_STEREO (CH_FRONT_LEFT|CH_FRONT_RIGHT)
+#define CH_LAYOUT_2_1 (CH_LAYOUT_STEREO|CH_BACK_CENTER)
+#define CH_LAYOUT_SURROUND (CH_LAYOUT_STEREO|CH_FRONT_CENTER)
+#define CH_LAYOUT_4POINT0 (CH_LAYOUT_SURROUND|CH_BACK_CENTER)
+#define CH_LAYOUT_2_2 (CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT)
+#define CH_LAYOUT_QUAD (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT)
+#define CH_LAYOUT_5POINT0 (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIGHT)
+#define CH_LAYOUT_5POINT1 (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY)
+#define CH_LAYOUT_5POINT0_BACK (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIGHT)
+#define CH_LAYOUT_5POINT1_BACK (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY)
+#define CH_LAYOUT_7POINT0 (CH_LAYOUT_5POINT0|CH_BACK_LEFT|CH_BACK_RIGHT)
+#define CH_LAYOUT_7POINT1 (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT)
+#define CH_LAYOUT_7POINT1_WIDE (CH_LAYOUT_5POINT1_BACK|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER)
+#define CH_LAYOUT_STEREO_DOWNMIX (CH_STEREO_LEFT|CH_STEREO_RIGHT)
+
+#endif /* AVUTIL_SAMPLEFMT_H */
--
1.7.0
--45Z9DzgjV8m4Oswq--
More information about the ffmpeg-devel
mailing list