1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2012 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_EXTENSION_SIZE 32768
28 DTS_SUBSTREAM_TYPE_NONE
= 0,
29 DTS_SUBSTREAM_TYPE_CORE
= 1,
30 DTS_SUBSTREAM_TYPE_EXTENSION
= 2,
35 uint32_t sampling_frequency
;
36 uint32_t frame_duration
;
38 uint16_t channel_layout
;
39 uint8_t channel_arrangement
;
40 uint8_t xxch_lower_planes
;
41 uint8_t extension_audio_descriptor
;
42 uint8_t pcm_resolution
;
47 uint32_t sampling_frequency
;
48 uint32_t frame_duration
;
49 uint16_t channel_layout
;
50 uint8_t xxch_lower_planes
;
51 uint8_t bStaticFieldsPresent
;
52 uint8_t bMixMetadataEnbl
;
53 uint8_t bOne2OneMapChannels2Speakers
;
54 uint8_t nuNumMixOutConfigs
;
55 uint8_t nNumMixOutCh
[4];
56 uint8_t number_of_assets
;
57 uint8_t stereo_downmix
;
58 uint8_t representation_type
;
59 uint8_t bit_resolution
;
60 } dts_extension_info_t
;
64 uint32_t sampling_frequency
;
65 uint32_t frame_duration
;
66 uint16_t channel_layout
;
68 } dts_lossless_info_t
;
72 uint32_t sampling_frequency
;
73 uint32_t frame_duration
;
74 uint16_t channel_layout
;
75 uint8_t stereo_downmix
;
77 uint8_t duration_modifier
;
83 dts_substream_type substream_type
;
84 lsmash_dts_construction_flag flags
;
85 lsmash_dts_specific_parameters_t ddts_param
;
87 dts_extension_info_t extension
;
88 dts_lossless_info_t lossless
;
90 uint8_t ddts_param_initialized
;
92 uint8_t extension_index
;
93 uint8_t extension_substream_count
;
94 uint32_t frame_duration
;
96 uint8_t buffer
[2 * DTS_MAX_EXTENSION_SIZE
];
100 lsmash_multiple_buffers_t
*au_buffers
;
103 uint8_t *incomplete_au
;
104 uint32_t incomplete_au_length
;
108 int dts_parse_core_substream( dts_info_t
*info
, uint8_t *data
, uint32_t data_length
);
109 int dts_parse_extension_substream( dts_info_t
*info
, uint8_t *data
, uint32_t data_length
);
110 int dts_get_channel_count_from_channel_layout( uint16_t channel_layout
);
111 dts_substream_type
dts_get_substream_type( dts_info_t
*info
);
112 int dts_get_extension_index( dts_info_t
*info
, uint8_t *extension_index
);
113 void dts_update_specific_param( dts_info_t
*info
);