Bug 1568126 - Part 1: Use the contextual WalkerFront in _hideHighlighterIfDeadNode...
[gecko.git] / media / mp4parse-rust / mp4parse.h
blobb941b1c99e940ba6a1c7534fafc014499e0dc7f8
1 // This Source Code Form is subject to the terms of the Mozilla Public
2 // License, v. 2.0. If a copy of the MPL was not distributed with this
3 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
9 #ifndef MP4PARSE_CAPI_H
10 #define MP4PARSE_CAPI_H
12 // THIS FILE IS AUTOGENERATED BY mp4parse_capi/build.rs - DO NOT EDIT
14 #include <stdint.h>
15 #include <stdlib.h>
16 #include <stdbool.h>
18 typedef enum {
19 MP4_PARSE_ENCRYPTION_SCHEME_TYPE_NONE,
20 MP4_PARSE_ENCRYPTION_SCHEME_TYPE_CENC,
21 MP4_PARSE_ENCRYPTION_SCHEME_TYPE_CBC1,
22 MP4_PARSE_ENCRYPTION_SCHEME_TYPE_CENS,
23 MP4_PARSE_ENCRYPTION_SCHEME_TYPE_CBCS,
24 } Mp4ParseEncryptionSchemeType;
26 typedef enum {
27 MP4PARSE_CODEC_UNKNOWN,
28 MP4PARSE_CODEC_AAC,
29 MP4PARSE_CODEC_FLAC,
30 MP4PARSE_CODEC_OPUS,
31 MP4PARSE_CODEC_AVC,
32 MP4PARSE_CODEC_VP9,
33 MP4PARSE_CODEC_AV1,
34 MP4PARSE_CODEC_MP3,
35 MP4PARSE_CODEC_MP4V,
36 MP4PARSE_CODEC_JPEG,
37 MP4PARSE_CODEC_AC3,
38 MP4PARSE_CODEC_EC3,
39 MP4PARSE_CODEC_ALAC,
40 } Mp4parseCodec;
42 typedef enum {
43 MP4PARSE_STATUS_OK = 0,
44 MP4PARSE_STATUS_BAD_ARG = 1,
45 MP4PARSE_STATUS_INVALID = 2,
46 MP4PARSE_STATUS_UNSUPPORTED = 3,
47 MP4PARSE_STATUS_EOF = 4,
48 MP4PARSE_STATUS_IO = 5,
49 MP4PARSE_STATUS_OOM = 6,
50 } Mp4parseStatus;
52 typedef enum {
53 MP4PARSE_TRACK_TYPE_VIDEO = 0,
54 MP4PARSE_TRACK_TYPE_AUDIO = 1,
55 MP4PARSE_TRACK_TYPE_METADATA = 2,
56 } Mp4parseTrackType;
58 typedef struct Mp4parseParser Mp4parseParser;
60 typedef struct {
61 uint64_t fragment_duration;
62 } Mp4parseFragmentInfo;
64 typedef struct {
65 uint64_t start_offset;
66 uint64_t end_offset;
67 int64_t start_composition;
68 int64_t end_composition;
69 int64_t start_decode;
70 bool sync;
71 } Mp4parseIndice;
73 typedef struct {
74 uint32_t length;
75 const uint8_t *data;
76 const Mp4parseIndice *indices;
77 } Mp4parseByteData;
79 typedef struct {
80 Mp4parseByteData data;
81 } Mp4parsePsshInfo;
83 typedef struct {
84 Mp4ParseEncryptionSchemeType scheme_type;
85 uint8_t is_encrypted;
86 uint8_t iv_size;
87 Mp4parseByteData kid;
88 uint8_t crypt_byte_block;
89 uint8_t skip_byte_block;
90 Mp4parseByteData constant_iv;
91 } Mp4parseSinfInfo;
93 typedef struct {
94 Mp4parseCodec codec_type;
95 uint16_t channels;
96 uint16_t bit_depth;
97 uint32_t sample_rate;
98 uint16_t profile;
99 uint16_t extended_profile;
100 Mp4parseByteData codec_specific_config;
101 Mp4parseByteData extra_data;
102 Mp4parseSinfInfo protected_data;
103 } Mp4parseTrackAudioSampleInfo;
105 typedef struct {
106 uint32_t sample_info_count;
107 const Mp4parseTrackAudioSampleInfo *sample_info;
108 } Mp4parseTrackAudioInfo;
110 typedef struct {
111 Mp4parseTrackType track_type;
112 uint32_t track_id;
113 uint64_t duration;
114 int64_t media_time;
115 } Mp4parseTrackInfo;
117 typedef struct {
118 Mp4parseCodec codec_type;
119 uint16_t image_width;
120 uint16_t image_height;
121 Mp4parseByteData extra_data;
122 Mp4parseSinfInfo protected_data;
123 } Mp4parseTrackVideoSampleInfo;
125 typedef struct {
126 uint32_t display_width;
127 uint32_t display_height;
128 uint16_t rotation;
129 uint32_t sample_info_count;
130 const Mp4parseTrackVideoSampleInfo *sample_info;
131 } Mp4parseTrackVideoInfo;
133 typedef struct {
134 intptr_t (*read)(uint8_t*, uintptr_t, void*);
135 void *userdata;
136 } Mp4parseIo;
138 // THIS FILE IS AUTOGENERATED BY mp4parse_capi/build.rs - DO NOT EDIT
141 * Free an `Mp4parseParser*` allocated by `mp4parse_new()`.
143 void mp4parse_free(Mp4parseParser *parser);
146 * Fill the supplied `Mp4parseFragmentInfo` with metadata from fragmented file.
148 Mp4parseStatus mp4parse_get_fragment_info(Mp4parseParser *parser, Mp4parseFragmentInfo *info);
150 Mp4parseStatus mp4parse_get_indice_table(Mp4parseParser *parser,
151 uint32_t track_id,
152 Mp4parseByteData *indices);
155 * Get 'pssh' system id and 'pssh' box content for eme playback.
157 * The data format of the `info` struct passed to gecko is:
159 * - system id (16 byte uuid)
160 * - pssh box size (32-bit native endian)
161 * - pssh box content (including header)
163 Mp4parseStatus mp4parse_get_pssh_info(Mp4parseParser *parser, Mp4parsePsshInfo *info);
166 * Fill the supplied `Mp4parseTrackAudioInfo` with metadata for `track`.
168 Mp4parseStatus mp4parse_get_track_audio_info(Mp4parseParser *parser,
169 uint32_t track_index,
170 Mp4parseTrackAudioInfo *info);
173 * Return the number of tracks parsed by previous `mp4parse_read()` call.
175 Mp4parseStatus mp4parse_get_track_count(const Mp4parseParser *parser, uint32_t *count);
178 * Fill the supplied `Mp4parseTrackInfo` with metadata for `track`.
180 Mp4parseStatus mp4parse_get_track_info(Mp4parseParser *parser,
181 uint32_t track_index,
182 Mp4parseTrackInfo *info);
185 * Fill the supplied `Mp4parseTrackVideoInfo` with metadata for `track`.
187 Mp4parseStatus mp4parse_get_track_video_info(Mp4parseParser *parser,
188 uint32_t track_index,
189 Mp4parseTrackVideoInfo *info);
192 * A fragmented file needs mvex table and contains no data in stts, stsc, and stco boxes.
194 Mp4parseStatus mp4parse_is_fragmented(Mp4parseParser *parser,
195 uint32_t track_id,
196 uint8_t *fragmented);
199 * Allocate an `Mp4parseParser*` to read from the supplied `Mp4parseIo`.
201 Mp4parseParser *mp4parse_new(const Mp4parseIo *io);
204 * Run the `Mp4parseParser*` allocated by `mp4parse_new()` until EOF or error.
206 Mp4parseStatus mp4parse_read(Mp4parseParser *parser);
208 // THIS FILE IS AUTOGENERATED BY mp4parse_capi/build.rs - DO NOT EDIT
210 #endif /* MP4PARSE_CAPI_H */
212 #ifdef __cplusplus
213 } /* extern "C" */
214 #endif