.gitignore: Add version script.
[L-SMASH.git] / codecs / a52.h
blob4e5879adea0ebba29c97f16206a860b55ef3688b
1 /*****************************************************************************
2 * a52.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 AC3_MIN_SYNCFRAME_LENGTH 128
24 #define AC3_MAX_SYNCFRAME_LENGTH 3840
25 #define EAC3_MAX_SYNCFRAME_LENGTH 4096
27 typedef struct
29 lsmash_ac3_specific_parameters_t dac3_param;
30 lsmash_bits_t *bits;
31 } ac3_info_t;
33 typedef struct
35 lsmash_eac3_specific_parameters_t dec3_param;
36 lsmash_eac3_substream_info_t independent_info[8];
37 lsmash_eac3_substream_info_t dependent_info;
38 uint8_t dec3_param_initialized;
39 uint8_t strmtyp;
40 uint8_t substreamid;
41 uint8_t current_independent_substream_id;
42 uint8_t fscod2;
43 uint8_t numblkscod;
44 uint8_t number_of_audio_blocks;
45 uint8_t number_of_independent_substreams;
46 uint32_t syncframe_count;
47 uint32_t frame_size;
48 lsmash_bits_t *bits;
49 } eac3_info_t;
51 extern const uint32_t ac3_sample_rate_table [4];
52 extern const uint32_t ac3_channel_count_table[8];
53 extern const uint8_t eac3_audio_block_table [4];
55 static inline uint32_t ac3_get_channel_count
57 lsmash_ac3_specific_parameters_t *dac3_param
60 return ac3_channel_count_table[ dac3_param->acmod ] + dac3_param->lfeon;
63 uint32_t ac3_get_sample_rate
65 lsmash_ac3_specific_parameters_t *dac3_param
68 int ac3_parse_syncframe_header
70 ac3_info_t *info
73 int eac3_parse_syncframe
75 eac3_info_t *info
78 void eac3_update_specific_param
80 eac3_info_t *info
83 void eac3_update_sample_rate
85 uint32_t *frequency,
86 lsmash_eac3_specific_parameters_t *dec3_param,
87 uint8_t *fscod2
90 void eac3_update_channel_count
92 uint32_t *channels,
93 lsmash_eac3_specific_parameters_t *dec3_param