1 /*
2 * DCA compatible decoder
3 * Copyright (C) 2004 Gildas Bazin
4 * Copyright (C) 2004 Benjamin Zores
5 * Copyright (C) 2006 Benjamin Larsson
6 * Copyright (C) 2007 Konstantin Shishkov
7 * Copyright (C) 2016 foo86
8 *
9 * This file is part of FFmpeg.
10 *
11 * FFmpeg is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * FFmpeg is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with FFmpeg; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26 #ifndef AVCODEC_DCA_H
27 #define AVCODEC_DCA_H
28
29 #include <stdint.h>
30
33
35
36 #define DCA_CORE_FRAME_HEADER_SIZE 18
37
48 };
49
57 uint8_t
sr_code;
///< Core audio sampling frequency
58 uint8_t
br_code;
///< Transmission bit rate
65 uint8_t
sync_ssf;
///< Audio sync word insertion flag
74 uint8_t
dn_code;
///< Dialog normalization / unspecified
76
86
88 };
89
119 };
120
121 #define DCA_SPEAKER_LAYOUT_MONO (DCA_SPEAKER_MASK_C)
122 #define DCA_SPEAKER_LAYOUT_STEREO (DCA_SPEAKER_MASK_L | DCA_SPEAKER_MASK_R)
123 #define DCA_SPEAKER_LAYOUT_2POINT1 (DCA_SPEAKER_LAYOUT_STEREO | DCA_SPEAKER_MASK_LFE1)
124 #define DCA_SPEAKER_LAYOUT_3_0 (DCA_SPEAKER_LAYOUT_STEREO | DCA_SPEAKER_MASK_C)
125 #define DCA_SPEAKER_LAYOUT_2_1 (DCA_SPEAKER_LAYOUT_STEREO | DCA_SPEAKER_MASK_Cs)
126 #define DCA_SPEAKER_LAYOUT_3_1 (DCA_SPEAKER_LAYOUT_3_0 | DCA_SPEAKER_MASK_Cs)
127 #define DCA_SPEAKER_LAYOUT_2_2 (DCA_SPEAKER_LAYOUT_STEREO | DCA_SPEAKER_MASK_Ls | DCA_SPEAKER_MASK_Rs)
128 #define DCA_SPEAKER_LAYOUT_5POINT0 (DCA_SPEAKER_LAYOUT_3_0 | DCA_SPEAKER_MASK_Ls | DCA_SPEAKER_MASK_Rs)
129 #define DCA_SPEAKER_LAYOUT_5POINT1 (DCA_SPEAKER_LAYOUT_5POINT0 | DCA_SPEAKER_MASK_LFE1)
130 #define DCA_SPEAKER_LAYOUT_7POINT0_WIDE (DCA_SPEAKER_LAYOUT_5POINT0 | DCA_SPEAKER_MASK_Lw | DCA_SPEAKER_MASK_Rw)
131 #define DCA_SPEAKER_LAYOUT_7POINT1_WIDE (DCA_SPEAKER_LAYOUT_7POINT0_WIDE | DCA_SPEAKER_MASK_LFE1)
132
133 #define DCA_HAS_STEREO(mask) \
134 ((mask & DCA_SPEAKER_LAYOUT_STEREO) == DCA_SPEAKER_LAYOUT_STEREO)
135
153 };
154
155 /**
156 * Return number of individual channels in DCASpeakerPair mask
157 */
159 {
161 }
162
166 };
167
183 };
184
193
195 };
196
201
202
203 /**
204 * Convert bitstream to one representation based on sync marker
205 */
207 int max_size);
208
209 /**
210 * Parse and validate core frame header
211 * @param[out] h Pointer to struct where header info is written.
212 * @param[in] buf Pointer to the data buffer
213 * @param[in] size Size of the data buffer
214 * @return 0 on success, negative AVERROR code on failure
215 */
217
218 /**
219 * Parse and validate core frame header
220 * @param[out] h Pointer to struct where header info is written.
221 * @param[in] gbc BitContext containing the first 120 bits of the frame.
222 * @return 0 on success, negative DCA_PARSE_ERROR_ code on failure
223 */
225
226 #endif /* AVCODEC_DCA_H */