Browse code

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

Diego Biurrun authored on 2012/08/01 03:09:23
Showing 7 changed files
... ...
@@ -119,7 +119,7 @@ OBJS-$(CONFIG_CLJR_ENCODER)            += cljr.o
119 119
 OBJS-$(CONFIG_COOK_DECODER)            += cook.o
120 120
 OBJS-$(CONFIG_CSCD_DECODER)            += cscd.o
121 121
 OBJS-$(CONFIG_CYUV_DECODER)            += cyuv.o
122
-OBJS-$(CONFIG_DCA_DECODER)             += dcadec.o dcadsp.o            \
122
+OBJS-$(CONFIG_DCA_DECODER)             += dcadec.o dca.o dcadsp.o      \
123 123
                                           dca_parser.o synth_filter.o
124 124
 OBJS-$(CONFIG_DFA_DECODER)             += dfa.o
125 125
 OBJS-$(CONFIG_DNXHD_DECODER)           += dnxhddec.o dnxhddata.o
... ...
@@ -596,6 +596,7 @@ OBJS-$(CONFIG_OGG_DEMUXER)             += xiph.o flac.o flacdata.o     \
596 596
 OBJS-$(CONFIG_OGG_MUXER)               += xiph.o flac.o flacdata.o
597 597
 OBJS-$(CONFIG_RTP_MUXER)               += mpeg4audio.o mpegvideo.o xiph.o
598 598
 OBJS-$(CONFIG_SPDIF_DEMUXER)           += aacadtsdec.o mpeg4audio.o
599
+OBJS-$(CONFIG_SPDIF_MUXER)             += dca.o
599 600
 OBJS-$(CONFIG_WEBM_MUXER)              += mpeg4audio.o mpegaudiodata.o  \
600 601
                                           xiph.o flac.o flacdata.o
601 602
 OBJS-$(CONFIG_WTV_DEMUXER)             += mpeg4audio.o mpegaudiodata.o
... ...
@@ -641,7 +642,7 @@ OBJS-$(CONFIG_AC3_PARSER)              += ac3_parser.o ac3tab.o \
641 641
 OBJS-$(CONFIG_ADX_PARSER)              += adx_parser.o adx.o
642 642
 OBJS-$(CONFIG_CAVSVIDEO_PARSER)        += cavs_parser.o
643 643
 OBJS-$(CONFIG_COOK_PARSER)             += cook_parser.o
644
-OBJS-$(CONFIG_DCA_PARSER)              += dca_parser.o
644
+OBJS-$(CONFIG_DCA_PARSER)              += dca_parser.o dca.o
645 645
 OBJS-$(CONFIG_DIRAC_PARSER)            += dirac_parser.o
646 646
 OBJS-$(CONFIG_DNXHD_PARSER)            += dnxhd_parser.o
647 647
 OBJS-$(CONFIG_DVBSUB_PARSER)           += dvbsub_parser.o
648 648
new file mode 100644
... ...
@@ -0,0 +1,29 @@
0
+/*
1
+ * DCA compatible decoder data
2
+ *
3
+ * This file is part of Libav.
4
+ *
5
+ * Libav 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
+ * Libav 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 Libav; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+#include <stdint.h>
21
+
22
+#include "dca.h"
23
+
24
+const uint32_t ff_dca_sample_rates[16] =
25
+{
26
+    0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
27
+    12000, 24000, 48000, 96000, 192000
28
+};
... ...
@@ -25,6 +25,8 @@
25 25
 #ifndef AVCODEC_DCA_H
26 26
 #define AVCODEC_DCA_H
27 27
 
28
+#include <stdint.h>
29
+
28 30
 /** DCA syncwords, also used for bitstream type detection */
29 31
 #define DCA_MARKER_RAW_BE 0x7FFE8001
30 32
 #define DCA_MARKER_RAW_LE 0xFE7F0180
... ...
@@ -34,4 +36,6 @@
34 34
 /** DCA-HD specific block starts with this marker. */
35 35
 #define DCA_HD_MARKER     0x64582025
36 36
 
37
+extern const uint32_t ff_dca_sample_rates[16];
38
+
37 39
 #endif /* AVCODEC_DCA_H */
... ...
@@ -24,7 +24,6 @@
24 24
 
25 25
 #include "parser.h"
26 26
 #include "dca.h"
27
-#include "dcadata.h"
28 27
 #include "dca_parser.h"
29 28
 #include "get_bits.h"
30 29
 #include "put_bits.h"
... ...
@@ -162,7 +161,7 @@ static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration,
162 162
 
163 163
     skip_bits(&gb, 20);
164 164
     sr_code = get_bits(&gb, 4);
165
-    *sample_rate = dca_sample_rates[sr_code];
165
+    *sample_rate = ff_dca_sample_rates[sr_code];
166 166
     if (*sample_rate == 0)
167 167
         return AVERROR_INVALIDDATA;
168 168
 
... ...
@@ -28,12 +28,6 @@
28 28
 
29 29
 /* Generic tables */
30 30
 
31
-static const uint32_t dca_sample_rates[16] =
32
-{
33
-    0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
34
-    12000, 24000, 48000, 96000, 192000
35
-};
36
-
37 31
 static const uint32_t dca_bit_rates[32] =
38 32
 {
39 33
     32000, 56000, 64000, 96000, 112000, 128000,
... ...
@@ -561,7 +561,7 @@ static int dca_parse_frame_header(DCAContext *s)
561 561
     if (s->frame_size < 95)
562 562
         return AVERROR_INVALIDDATA;
563 563
     s->amode             = get_bits(&s->gb, 6);
564
-    s->sample_rate       = dca_sample_rates[get_bits(&s->gb, 4)];
564
+    s->sample_rate       = ff_dca_sample_rates[get_bits(&s->gb, 4)];
565 565
     if (!s->sample_rate)
566 566
         return AVERROR_INVALIDDATA;
567 567
     s->bit_rate_index    = get_bits(&s->gb, 5);
... ...
@@ -49,7 +49,6 @@
49 49
 #include "spdif.h"
50 50
 #include "libavcodec/ac3.h"
51 51
 #include "libavcodec/dca.h"
52
-#include "libavcodec/dcadata.h"
53 52
 #include "libavcodec/aacadtsdec.h"
54 53
 #include "libavutil/opt.h"
55 54
 
... ...
@@ -253,7 +252,7 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
253 253
     case DCA_MARKER_RAW_BE:
254 254
         blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f;
255 255
         core_size = ((AV_RB24(pkt->data + 5) >> 4) & 0x3fff) + 1;
256
-        sample_rate = dca_sample_rates[(pkt->data[8] >> 2) & 0x0f];
256
+        sample_rate = ff_dca_sample_rates[(pkt->data[8] >> 2) & 0x0f];
257 257
         break;
258 258
     case DCA_MARKER_RAW_LE:
259 259
         blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f;