remuxer: Add --max-chunk-size.
[L-SMASH.git] / codecs / dts.h
blob45850829ff406a6950508adbfe4e978ed6a39175
1 /*****************************************************************************
2 * dts.h
3 *****************************************************************************
4 * Copyright (C) 2012-2017 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 uint8_t dtsx_extension_present;
63 } dts_xll_info_t;
65 typedef struct
67 uint16_t size;
68 uint16_t channel_layout;
69 uint32_t sampling_frequency;
70 uint32_t frame_duration;
71 uint8_t stereo_downmix;
72 uint8_t lfe_present;
73 uint8_t duration_modifier;
74 uint8_t sample_size;
75 } dts_lbr_info_t;
77 typedef struct
79 uint32_t size;
80 uint16_t channel_layout;
81 uint8_t bOne2OneMapChannels2Speakers;
82 uint8_t nuRepresentationType;
83 uint8_t nuCodingMode;
84 lsmash_dts_construction_flag nuCoreExtensionMask;
85 dts_core_info_t core;
86 dts_xll_info_t xll;
87 dts_lbr_info_t lbr;
88 uint16_t xbr_size;
89 uint16_t x96_size;
90 uint16_t aux_size;
91 } dts_audio_asset_t;
93 typedef struct
95 uint32_t sampling_frequency;
96 uint32_t frame_duration;
97 uint8_t nuBits4ExSSFsize;
98 uint8_t bStaticFieldsPresent;
99 uint8_t bMixMetadataEnbl;
100 uint8_t nuNumMixOutConfigs;
101 uint8_t nNumMixOutCh[4];
102 uint8_t nuNumAudioPresnt;
103 uint8_t nuNumAssets;
104 uint8_t nuActiveExSSMask[8];
105 uint8_t nuActiveAssetMask[8][4];
106 uint8_t bBcCorePresent[8];
107 uint8_t nuBcCoreExtSSIndex[8];
108 uint8_t nuBcCoreAssetIndex[8];
109 uint8_t stereo_downmix;
110 uint8_t bit_resolution;
111 dts_audio_asset_t asset[8];
112 } dts_extension_info_t;
114 typedef struct
116 dts_substream_type substream_type;
117 lsmash_dts_construction_flag flags;
118 lsmash_dts_specific_parameters_t ddts_param;
119 dts_core_info_t core; /* core component and its extensions in core substream */
120 dts_extension_info_t exss[4]; /* extension substreams */
121 uint8_t ddts_param_initialized;
122 uint8_t exss_index;
123 uint8_t exss_count;
124 uint32_t frame_duration;
125 uint32_t frame_size; /* size of substream */
126 lsmash_bits_t *bits;
127 } dts_info_t;
129 void dts_setup_parser( dts_info_t *info );
130 int dts_parse_core_substream( dts_info_t *info );
131 int dts_parse_extension_substream( dts_info_t *info );
132 int dts_get_max_channel_count( dts_info_t *info );
133 dts_substream_type dts_get_substream_type( dts_info_t *info );
134 int dts_get_exss_index( dts_info_t *info, uint8_t *exss_index );
135 void dts_update_specific_param( dts_info_t *info );