remuxer: Add --max-chunk-size.
[L-SMASH.git] / codecs / vc1.h
blob88d3b319039ba88effea2d32e652fbe6e4aec83a
1 /*****************************************************************************
2 * vc1.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 VC1_DEFAULT_BUFFER_SIZE (1<<16)
24 #define VC1_START_CODE_PREFIX_LENGTH 3 /* 0x000001 */
25 #define VC1_START_CODE_SUFFIX_LENGTH 1 /* BDU type */
26 #define VC1_START_CODE_LENGTH (VC1_START_CODE_PREFIX_LENGTH + VC1_START_CODE_SUFFIX_LENGTH) /* = 4 */
28 typedef struct
30 uint8_t hrd_num_leaky_buckets;
31 } vc1_hrd_param_t;
33 typedef struct
35 uint8_t present;
36 uint8_t profile;
37 uint8_t level;
38 uint8_t colordiff_format; /* currently 4:2:0 only */
39 uint8_t interlace;
40 uint8_t color_prim;
41 uint8_t transfer_char;
42 uint8_t matrix_coef;
43 uint8_t hrd_param_flag;
44 uint8_t aspect_width;
45 uint8_t aspect_height;
46 uint8_t framerate_flag;
47 uint32_t framerate_numerator;
48 uint32_t framerate_denominator;
49 uint16_t max_coded_width;
50 uint16_t max_coded_height;
51 uint16_t disp_horiz_size;
52 uint16_t disp_vert_size;
53 vc1_hrd_param_t hrd_param;
54 } vc1_sequence_header_t;
56 typedef struct
58 uint8_t present;
59 uint8_t closed_entry_point;
60 } vc1_entry_point_t;
62 typedef struct
64 uint8_t present;
65 uint8_t frame_coding_mode;
66 uint8_t type;
67 uint8_t closed_gop;
68 uint8_t start_of_sequence;
69 uint8_t random_accessible;
70 } vc1_picture_info_t;
72 typedef struct
74 uint8_t random_accessible;
75 uint8_t closed_gop;
76 uint8_t independent;
77 uint8_t non_bipredictive;
78 uint8_t disposable;
79 uint8_t *data;
80 uint32_t data_length;
81 uint8_t *incomplete_data;
82 uint32_t incomplete_data_length;
83 uint32_t number;
84 } vc1_access_unit_t;
86 typedef struct vc1_info_tag vc1_info_t;
88 typedef struct
90 lsmash_multiple_buffers_t *bank;
91 uint8_t *rbdu;
92 } vc1_stream_buffer_t;
94 struct vc1_info_tag
96 lsmash_vc1_specific_parameters_t dvc1_param;
97 vc1_sequence_header_t sequence;
98 vc1_entry_point_t entry_point;
99 vc1_picture_info_t picture;
100 vc1_access_unit_t access_unit;
101 uint8_t prev_bdu_type;
102 uint64_t ebdu_head_pos;
103 lsmash_bits_t *bits;
104 vc1_stream_buffer_t buffer;
107 int vc1_setup_parser
109 vc1_info_t *info,
110 int parse_only
113 uint64_t vc1_find_next_start_code_prefix
115 lsmash_bs_t *bs,
116 uint8_t *bdu_type,
117 uint64_t *trailing_zero_bytes
120 int vc1_check_next_start_code_suffix
122 lsmash_bs_t *bs,
123 uint8_t *p_bdu_type
126 void vc1_cleanup_parser( vc1_info_t *info );
127 int vc1_parse_sequence_header( vc1_info_t *info, uint8_t *ebdu, uint64_t ebdu_size, int probe );
128 int vc1_parse_entry_point_header( vc1_info_t *info, uint8_t *ebdu, uint64_t ebdu_size, int probe );
129 int vc1_parse_advanced_picture( lsmash_bits_t *bits,
130 vc1_sequence_header_t *sequence, vc1_picture_info_t *picture,
131 uint8_t *rbdu_buffer, uint8_t *ebdu, uint64_t ebdu_size );
132 void vc1_update_au_property( vc1_access_unit_t *access_unit, vc1_picture_info_t *picture );
133 int vc1_find_au_delimit_by_bdu_type( uint8_t bdu_type, uint8_t prev_bdu_type );
134 int vc1_supplement_buffer( vc1_stream_buffer_t *buffer, vc1_access_unit_t *access_unit, uint32_t size );