.gitignore: Add version script.
[L-SMASH.git] / codecs / dts.h
blob4a7e3bb876deea3d8361cbe959ceac9a2dd2761c
1 /*****************************************************************************
2 * dts.h:
3 *****************************************************************************
4 * Copyright (C) 2012-2015 L-SMASH project
6 * Authors: Yusuke Nakamura <muken.the.vfrmaniac@gmail.com>
8 * Permission to use, copy, modify, and/or distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 *****************************************************************************/
21 /* This file is available under an ISC license. */
23 #define DTS_MAX_CORE_SIZE 16384
24 #define DTS_MAX_EXSS_SIZE 32768
25 #define DTS_MAX_NUM_EXSS 4 /* the maximum number of extension substreams */
27 typedef enum
29 DTS_SUBSTREAM_TYPE_NONE = 0,
30 DTS_SUBSTREAM_TYPE_CORE = 1,
31 DTS_SUBSTREAM_TYPE_EXTENSION = 2,
32 } dts_substream_type;
34 typedef struct
36 uint16_t size;
37 uint16_t channel_layout;
38 uint8_t lower_planes; /* CL, LL and RL */
39 } dts_xxch_info_t;
41 typedef struct
43 uint32_t sampling_frequency;
44 uint32_t frame_duration;
45 uint16_t frame_size;
46 uint16_t channel_layout;
47 uint8_t channel_arrangement;
48 uint8_t extension_audio_descriptor;
49 uint8_t pcm_resolution;
50 dts_xxch_info_t xxch;
51 } dts_core_info_t;
53 typedef struct
55 uint16_t size;
56 uint16_t channel_layout;
57 uint32_t sampling_frequency;
58 uint32_t frame_duration;
59 uint8_t pcm_resolution;
60 uint8_t stereo_downmix;
61 uint8_t lower_planes; /* CL, LL and RL */
62 } dts_xll_info_t;
64 typedef struct
66 uint16_t size;
67 uint16_t channel_layout;
68 uint32_t sampling_frequency;
69 uint32_t frame_duration;
70 uint8_t stereo_downmix;
71 uint8_t lfe_present;
72 uint8_t duration_modifier;
73 uint8_t sample_size;
74 } dts_lbr_info_t;
76 typedef struct
78 uint32_t size;
79 uint16_t channel_layout;
80 uint8_t bOne2OneMapChannels2Speakers;
81 uint8_t nuRepresentationType;
82 uint8_t nuCodingMode;
83 lsmash_dts_construction_flag nuCoreExtensionMask;
84 dts_core_info_t core;
85 dts_xll_info_t xll;
86 dts_lbr_info_t lbr;
87 uint16_t xbr_size;
88 uint16_t x96_size;
89 uint16_t aux_size;
90 } dts_audio_asset_t;
92 typedef struct
94 uint32_t sampling_frequency;
95 uint32_t frame_duration;
96 uint8_t nuBits4ExSSFsize;
97 uint8_t bStaticFieldsPresent;
98 uint8_t bMixMetadataEnbl;
99 uint8_t nuNumMixOutConfigs;
100 uint8_t nNumMixOutCh[4];
101 uint8_t nuNumAudioPresnt;
102 uint8_t nuNumAssets;
103 uint8_t nuActiveExSSMask[8];
104 uint8_t nuActiveAssetMask[8][4];
105 uint8_t bBcCorePresent[8];
106 uint8_t nuBcCoreExtSSIndex[8];
107 uint8_t nuBcCoreAssetIndex[8];
108 uint8_t stereo_downmix;
109 uint8_t bit_resolution;
110 dts_audio_asset_t asset[8];
111 } dts_extension_info_t;
113 typedef struct
115 dts_substream_type substream_type;
116 lsmash_dts_construction_flag flags;
117 lsmash_dts_specific_parameters_t ddts_param;
118 dts_core_info_t core; /* core component and its extensions in core substream */
119 dts_extension_info_t exss[4]; /* extension substreams */
120 uint8_t ddts_param_initialized;
121 uint8_t exss_index;
122 uint8_t exss_count;
123 uint32_t frame_duration;
124 uint32_t frame_size; /* size of substream */
125 lsmash_bits_t *bits;
126 } dts_info_t;
128 void dts_setup_parser( dts_info_t *info );
129 int dts_parse_core_substream( dts_info_t *info );
130 int dts_parse_extension_substream( dts_info_t *info );
131 int dts_get_max_channel_count( dts_info_t *info );
132 dts_substream_type dts_get_substream_type( dts_info_t *info );
133 int dts_get_exss_index( dts_info_t *info, uint8_t *exss_index );
134 void dts_update_specific_param( dts_info_t *info );