[FFmpeg-cvslog] dca: Move tables used outside of dcadec.c to a separate file.

Diego Biurrun git at videolan.org
Wed Aug 1 23:40:11 CEST 2012


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Tue Jul 31 20:09:23 2012 +0200| [9e4bca16f89bc12c58b58f4611d580a30d5f9638] | committer: Diego Biurrun

dca: Move tables used outside of dcadec.c to a separate file.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e4bca16f89bc12c58b58f4611d580a30d5f9638
---

 libavcodec/Makefile     |    5 +++--
 libavcodec/dca.c        |   29 +++++++++++++++++++++++++++++
 libavcodec/dca.h        |    4 ++++
 libavcodec/dca_parser.c |    3 +--
 libavcodec/dcadata.h    |    6 ------
 libavcodec/dcadec.c     |    2 +-
 libavformat/spdifenc.c  |    3 +--
 7 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 2d0006f..7fc5059 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -119,7 +119,7 @@ OBJS-$(CONFIG_CLJR_ENCODER)            += cljr.o
 OBJS-$(CONFIG_COOK_DECODER)            += cook.o
 OBJS-$(CONFIG_CSCD_DECODER)            += cscd.o
 OBJS-$(CONFIG_CYUV_DECODER)            += cyuv.o
-OBJS-$(CONFIG_DCA_DECODER)             += dcadec.o dcadsp.o            \
+OBJS-$(CONFIG_DCA_DECODER)             += dcadec.o dca.o dcadsp.o      \
                                           dca_parser.o synth_filter.o
 OBJS-$(CONFIG_DFA_DECODER)             += dfa.o
 OBJS-$(CONFIG_DNXHD_DECODER)           += dnxhddec.o dnxhddata.o
@@ -596,6 +596,7 @@ OBJS-$(CONFIG_OGG_DEMUXER)             += xiph.o flac.o flacdata.o     \
 OBJS-$(CONFIG_OGG_MUXER)               += xiph.o flac.o flacdata.o
 OBJS-$(CONFIG_RTP_MUXER)               += mpeg4audio.o mpegvideo.o xiph.o
 OBJS-$(CONFIG_SPDIF_DEMUXER)           += aacadtsdec.o mpeg4audio.o
+OBJS-$(CONFIG_SPDIF_MUXER)             += dca.o
 OBJS-$(CONFIG_WEBM_MUXER)              += mpeg4audio.o mpegaudiodata.o  \
                                           xiph.o flac.o flacdata.o
 OBJS-$(CONFIG_WTV_DEMUXER)             += mpeg4audio.o mpegaudiodata.o
@@ -641,7 +642,7 @@ OBJS-$(CONFIG_AC3_PARSER)              += ac3_parser.o ac3tab.o \
 OBJS-$(CONFIG_ADX_PARSER)              += adx_parser.o adx.o
 OBJS-$(CONFIG_CAVSVIDEO_PARSER)        += cavs_parser.o
 OBJS-$(CONFIG_COOK_PARSER)             += cook_parser.o
-OBJS-$(CONFIG_DCA_PARSER)              += dca_parser.o
+OBJS-$(CONFIG_DCA_PARSER)              += dca_parser.o dca.o
 OBJS-$(CONFIG_DIRAC_PARSER)            += dirac_parser.o
 OBJS-$(CONFIG_DNXHD_PARSER)            += dnxhd_parser.o
 OBJS-$(CONFIG_DVBSUB_PARSER)           += dvbsub_parser.o
diff --git a/libavcodec/dca.c b/libavcodec/dca.c
new file mode 100644
index 0000000..4194f58
--- /dev/null
+++ b/libavcodec/dca.c
@@ -0,0 +1,29 @@
+/*
+ * DCA compatible decoder data
+ *
+ * This file is part of Libav.
+ *
+ * Libav 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.
+ *
+ * Libav 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 Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+
+#include "dca.h"
+
+const uint32_t ff_dca_sample_rates[16] =
+{
+    0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
+    12000, 24000, 48000, 96000, 192000
+};
diff --git a/libavcodec/dca.h b/libavcodec/dca.h
index 8ea6049..9235fa4 100644
--- a/libavcodec/dca.h
+++ b/libavcodec/dca.h
@@ -25,6 +25,8 @@
 #ifndef AVCODEC_DCA_H
 #define AVCODEC_DCA_H
 
+#include <stdint.h>
+
 /** DCA syncwords, also used for bitstream type detection */
 #define DCA_MARKER_RAW_BE 0x7FFE8001
 #define DCA_MARKER_RAW_LE 0xFE7F0180
@@ -34,4 +36,6 @@
 /** DCA-HD specific block starts with this marker. */
 #define DCA_HD_MARKER     0x64582025
 
+extern const uint32_t ff_dca_sample_rates[16];
+
 #endif /* AVCODEC_DCA_H */
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index e7b2ce4..553e69c 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -24,7 +24,6 @@
 
 #include "parser.h"
 #include "dca.h"
-#include "dcadata.h"
 #include "dca_parser.h"
 #include "get_bits.h"
 #include "put_bits.h"
@@ -162,7 +161,7 @@ static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration,
 
     skip_bits(&gb, 20);
     sr_code = get_bits(&gb, 4);
-    *sample_rate = dca_sample_rates[sr_code];
+    *sample_rate = ff_dca_sample_rates[sr_code];
     if (*sample_rate == 0)
         return AVERROR_INVALIDDATA;
 
diff --git a/libavcodec/dcadata.h b/libavcodec/dcadata.h
index 4b58ef7..324e40f 100644
--- a/libavcodec/dcadata.h
+++ b/libavcodec/dcadata.h
@@ -28,12 +28,6 @@
 
 /* Generic tables */
 
-static const uint32_t dca_sample_rates[16] =
-{
-    0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
-    12000, 24000, 48000, 96000, 192000
-};
-
 static const uint32_t dca_bit_rates[32] =
 {
     32000, 56000, 64000, 96000, 112000, 128000,
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index b37dc49..f488da6 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -561,7 +561,7 @@ static int dca_parse_frame_header(DCAContext *s)
     if (s->frame_size < 95)
         return AVERROR_INVALIDDATA;
     s->amode             = get_bits(&s->gb, 6);
-    s->sample_rate       = dca_sample_rates[get_bits(&s->gb, 4)];
+    s->sample_rate       = ff_dca_sample_rates[get_bits(&s->gb, 4)];
     if (!s->sample_rate)
         return AVERROR_INVALIDDATA;
     s->bit_rate_index    = get_bits(&s->gb, 5);
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index b25c7fa..c563008 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -49,7 +49,6 @@
 #include "spdif.h"
 #include "libavcodec/ac3.h"
 #include "libavcodec/dca.h"
-#include "libavcodec/dcadata.h"
 #include "libavcodec/aacadtsdec.h"
 #include "libavutil/opt.h"
 
@@ -253,7 +252,7 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
     case DCA_MARKER_RAW_BE:
         blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f;
         core_size = ((AV_RB24(pkt->data + 5) >> 4) & 0x3fff) + 1;
-        sample_rate = dca_sample_rates[(pkt->data[8] >> 2) & 0x0f];
+        sample_rate = ff_dca_sample_rates[(pkt->data[8] >> 2) & 0x0f];
         break;
     case DCA_MARKER_RAW_LE:
         blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f;



More information about the ffmpeg-cvslog mailing list