8 #ifndef mp4parse_rust_mp4parse_h
9 #error "Don't include this file directly, instead include mp4parse.h"
23 typedef enum Mp4parseImir {
28 MP4PARSE_IMIR_TOP_BOTTOM,
33 MP4PARSE_IMIR_LEFT_RIGHT,
41 typedef enum Mp4parseIrot {
60 typedef enum Mp4ParseEncryptionSchemeType {
61 MP4_PARSE_ENCRYPTION_SCHEME_TYPE_NONE,
62 MP4_PARSE_ENCRYPTION_SCHEME_TYPE_CENC,
63 MP4_PARSE_ENCRYPTION_SCHEME_TYPE_CBC1,
64 MP4_PARSE_ENCRYPTION_SCHEME_TYPE_CENS,
65 MP4_PARSE_ENCRYPTION_SCHEME_TYPE_CBCS,
66 } Mp4ParseEncryptionSchemeType;
68 typedef enum Mp4parseCodec {
69 MP4PARSE_CODEC_UNKNOWN,
83 #if defined(MP4PARSE_FEATURE_3GPP)
86 #if defined(MP4PARSE_FEATURE_3GPP)
92 typedef enum Mp4parseTrackType {
93 MP4PARSE_TRACK_TYPE_VIDEO = 0,
94 MP4PARSE_TRACK_TYPE_AUDIO = 1,
95 MP4PARSE_TRACK_TYPE_METADATA = 2,
98 typedef enum Mp4parseStrictness {
99 MP4PARSE_STRICTNESS_PERMISSIVE,
100 MP4PARSE_STRICTNESS_NORMAL,
101 MP4PARSE_STRICTNESS_STRICT,
102 } Mp4parseStrictness;
109 typedef enum Mp4parseStatus {
110 MP4PARSE_STATUS_OK = 0,
111 MP4PARSE_STATUS_BAD_ARG = 1,
112 MP4PARSE_STATUS_INVALID = 2,
113 MP4PARSE_STATUS_UNSUPPORTED = 3,
114 MP4PARSE_STATUS_EOF = 4,
115 MP4PARSE_STATUS_IO = 5,
116 MP4PARSE_STATUS_OOM = 6,
117 MP4PARSE_STATUS_UNSUPPORTED_A1LX,
118 MP4PARSE_STATUS_UNSUPPORTED_A1OP,
119 MP4PARSE_STATUS_UNSUPPORTED_CLAP,
120 MP4PARSE_STATUS_UNSUPPORTED_GRID,
121 MP4PARSE_STATUS_UNSUPPORTED_IPRO,
122 MP4PARSE_STATUS_UNSUPPORTED_LSEL,
125 typedef struct Mp4parseAvifParser Mp4parseAvifParser;
127 typedef struct Mp4parseParser Mp4parseParser;
130 intptr_t (*read)(uint8_t *buffer, uintptr_t size,
void *userdata);
134 #if defined(MP4PARSE_UNSTABLE_API)
139 typedef int64_t CheckedInteger_i64;
143 enum Mp4parseTrackType track_type;
146 CheckedInteger_i64 media_time;
149 #if defined(MP4PARSE_UNSTABLE_API)
154 typedef uint64_t CheckedInteger_u64;
157 #if defined(MP4PARSE_UNSTABLE_API)
163 typedef struct Mp4parseIndice {
167 CheckedInteger_u64 start_offset;
174 CheckedInteger_u64 end_offset;
179 CheckedInteger_i64 start_composition;
185 CheckedInteger_i64 end_composition;
190 CheckedInteger_i64 start_decode;
203 const struct Mp4parseIndice *indices;
206 enum OptionalFourCc_Tag
211 OPTIONAL_FOUR_CC_NONE,
212 OPTIONAL_FOUR_CC_SOME,
215 typedef uint8_t OptionalFourCc_Tag;
219 OptionalFourCc_Tag tag;
221 OptionalFourCc_Tag some_tag;
228 enum Mp4ParseEncryptionSchemeType scheme_type;
229 uint8_t is_encrypted;
232 uint8_t crypt_byte_block;
233 uint8_t skip_byte_block;
238 enum Mp4parseCodec codec_type;
241 uint32_t sample_rate;
243 uint16_t extended_profile;
250 uint32_t sample_info_count;
255 uint16_t image_width;
256 uint16_t image_height;
263 enum Mp4parseCodec codec_type;
264 uint16_t image_width;
265 uint16_t image_height;
271 uint32_t display_width;
272 uint32_t display_height;
274 uint32_t sample_info_count;
284 uint32_t image_width;
285 uint32_t image_height;
298 uint8_t colour_primaries;
299 uint8_t transfer_characteristics;
300 uint8_t matrix_coefficients;
301 bool full_range_flag;
312 enum Mp4parseIrot image_rotation;
313 const enum Mp4parseImir *image_mirror;
318 bool premultiplied_alpha;
322 uint64_t fragment_duration;
363 Mp4parseStatus mp4parse_new(
const struct Mp4parseIo *io,
struct Mp4parseParser **parser_out);
376 Mp4parseStatus mp4parse_avif_new(
const struct Mp4parseIo *io,
377 enum Mp4parseStrictness strictness,
378 struct Mp4parseAvifParser **parser_out);
389 void mp4parse_free(
struct Mp4parseParser *parser);
400 void mp4parse_avif_free(
struct Mp4parseAvifParser *parser);
412 Mp4parseStatus mp4parse_get_track_count(
const struct Mp4parseParser *parser, uint32_t *count);
424 Mp4parseStatus mp4parse_get_track_info(
struct Mp4parseParser *parser,
425 uint32_t track_index,
438 Mp4parseStatus mp4parse_get_track_audio_info(
struct Mp4parseParser *parser,
439 uint32_t track_index,
449 Mp4parseStatus mp4parse_get_track_raw_info(
struct Mp4parseParser *parser,
450 uint32_t track_index,
463 Mp4parseStatus mp4parse_get_track_video_info(
struct Mp4parseParser *parser,
464 uint32_t track_index,
481 Mp4parseStatus mp4parse_avif_get_image(
const struct Mp4parseAvifParser *parser,
494 Mp4parseStatus mp4parse_get_indice_table(
struct Mp4parseParser *parser,
508 Mp4parseStatus mp4parse_get_fragment_info(
struct Mp4parseParser *parser,
522 Mp4parseStatus mp4parse_is_fragmented(
struct Mp4parseParser *parser,
524 uint8_t *fragmented);
542 Mp4parseStatus mp4parse_get_pssh_info(
struct Mp4parseParser *parser,
struct Mp4parsePsshInfo *info);
551 Mp4parseStatus mp4parse_get_craw_header(
struct Mp4parseParser *parser,
562 Mp4parseStatus mp4parse_get_craw_table_entry(
struct Mp4parseParser *parser,
struct Mp4parseAvifImageItem alpha_image
const struct Mp4parseImageSpatialExtents * spatial_extents