[FFmpeg-devel] [PATCH] avcodec/vorbis: Split data declarations out into new header

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri Sep 30 00:34:33 EEST 2022


vorbis.h currently contains stuff only used by the native
Vorbis codecs and some Vorbis tables, which are also used by
Opus and libvorbis. Therefore split the data out into a header
of its own.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/libopusdec.c   |  2 +-
 libavcodec/libopusenc.c   |  2 +-
 libavcodec/libvorbisenc.c |  1 -
 libavcodec/opus.c         |  2 +-
 libavcodec/vorbis.c       |  1 +
 libavcodec/vorbis.h       | 10 ++--------
 libavcodec/vorbis_data.c  |  2 +-
 libavcodec/vorbis_data.h  | 34 ++++++++++++++++++++++++++++++++++
 libavcodec/vorbisdec.c    |  1 +
 libavcodec/vorbisenc.c    |  1 +
 10 files changed, 43 insertions(+), 13 deletions(-)
 create mode 100644 libavcodec/vorbis_data.h

diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c
index 31a04dfbeb..9b9a610343 100644
--- a/libavcodec/libopusdec.c
+++ b/libavcodec/libopusdec.c
@@ -31,9 +31,9 @@
 #include "codec_internal.h"
 #include "decode.h"
 #include "internal.h"
-#include "vorbis.h"
 #include "mathops.h"
 #include "libopus.h"
+#include "vorbis_data.h"
 
 struct libopus_context {
     AVClass *class;
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index 81e765403f..75bc491c9e 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -29,8 +29,8 @@
 #include "codec_internal.h"
 #include "encode.h"
 #include "libopus.h"
-#include "vorbis.h"
 #include "audio_frame_queue.h"
+#include "vorbis_data.h"
 
 typedef struct LibopusEncOpts {
     int vbr;
diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c
index f78a88bbcd..6331cf0d79 100644
--- a/libavcodec/libvorbisenc.c
+++ b/libavcodec/libvorbisenc.c
@@ -29,7 +29,6 @@
 #include "codec_internal.h"
 #include "encode.h"
 #include "version.h"
-#include "vorbis.h"
 #include "vorbis_parser.h"
 
 
diff --git a/libavcodec/opus.c b/libavcodec/opus.c
index 3540206347..b91f57dec3 100644
--- a/libavcodec/opus.c
+++ b/libavcodec/opus.c
@@ -33,7 +33,7 @@
 #include "opus_celt.h"
 #include "opustab.h"
 #include "internal.h"
-#include "vorbis.h"
+#include "vorbis_data.h"
 
 static const uint16_t opus_frame_duration[32] = {
     480, 960, 1920, 2880,
diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c
index cca2aa7c63..d0b660b44a 100644
--- a/libavcodec/vorbis.c
+++ b/libavcodec/vorbis.c
@@ -30,6 +30,7 @@
 
 #include "avcodec.h"
 #include "vorbis.h"
+#include "vorbis_data.h"
 
 
 /* Helper functions */
diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h
index 0dd109dd2e..aa1ec5719d 100644
--- a/libavcodec/vorbis.h
+++ b/libavcodec/vorbis.h
@@ -21,15 +21,9 @@
 #ifndef AVCODEC_VORBIS_H
 #define AVCODEC_VORBIS_H
 
-#include "avcodec.h"
+#include <stdint.h>
 
-extern const float ff_vorbis_floor1_inverse_db_table[256];
-extern const float * const ff_vorbis_vwin[8];
-extern const uint8_t ff_vorbis_channel_layout_offsets[8][8];
-#if FF_API_OLD_CHANNEL_LAYOUT
-extern const uint64_t ff_vorbis_channel_layouts[9];
-#endif
-extern const AVChannelLayout ff_vorbis_ch_layouts[9];
+#include "avcodec.h"
 
 typedef struct vorbis_floor1_entry {
     uint16_t x;
diff --git a/libavcodec/vorbis_data.c b/libavcodec/vorbis_data.c
index 4f4ea03f15..1ebe146d8f 100644
--- a/libavcodec/vorbis_data.c
+++ b/libavcodec/vorbis_data.c
@@ -21,7 +21,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/mem_internal.h"
 
-#include "vorbis.h"
+#include "vorbis_data.h"
 
 const uint8_t ff_vorbis_channel_layout_offsets[8][8] = {
     { 0 },
diff --git a/libavcodec/vorbis_data.h b/libavcodec/vorbis_data.h
new file mode 100644
index 0000000000..0fe19e509f
--- /dev/null
+++ b/libavcodec/vorbis_data.h
@@ -0,0 +1,34 @@
+/*
+ * 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 AVCODEC_VORBIS_DATA_H
+#define AVCODEC_VORBIS_DATA_H
+
+#include <stdint.h>
+
+#include "libavutil/channel_layout.h"
+
+extern const float ff_vorbis_floor1_inverse_db_table[256];
+extern const float * const ff_vorbis_vwin[8];
+extern const uint8_t ff_vorbis_channel_layout_offsets[8][8];
+#if FF_API_OLD_CHANNEL_LAYOUT
+extern const uint64_t ff_vorbis_channel_layouts[9];
+#endif
+extern const AVChannelLayout ff_vorbis_ch_layouts[9];
+
+#endif /* AVCODEC_VORBIS_DATA_H */
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 4a85500c10..715a7f7d03 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -40,6 +40,7 @@
 #include "get_bits.h"
 #include "vorbis.h"
 #include "vorbisdsp.h"
+#include "vorbis_data.h"
 #include "xiph.h"
 
 #define V_NB_BITS 8
diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index b33d758e44..dcafe7d591 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -33,6 +33,7 @@
 #include "fft.h"
 #include "mathops.h"
 #include "vorbis.h"
+#include "vorbis_data.h"
 #include "vorbis_enc_data.h"
 
 #include "audio_frame_queue.h"
-- 
2.34.1



More information about the ffmpeg-devel mailing list