libopenraw  0.3.7
mp4parse_ffi.h
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 http://mozilla.org/MPL/2.0/. */
4 
5 /* Generated with cbindgen:0.24.3 */
6 
7 /* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen. */
8 #ifndef mp4parse_rust_mp4parse_h
9 #error "Don't include this file directly, instead include mp4parse.h"
10 #endif
11 
12 
13 #include <stdarg.h>
14 #include <stdbool.h>
15 #include <stdint.h>
16 #include <stdlib.h>
17 
23 typedef enum Mp4parseImir {
28  MP4PARSE_IMIR_TOP_BOTTOM,
33  MP4PARSE_IMIR_LEFT_RIGHT,
34 } Mp4parseImir;
35 
41 typedef enum Mp4parseIrot {
45  MP4PARSE_IROT_D0,
49  MP4PARSE_IROT_D90,
53  MP4PARSE_IROT_D180,
57  MP4PARSE_IROT_D270,
58 } Mp4parseIrot;
59 
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;
67 
68 typedef enum Mp4parseCodec {
69  MP4PARSE_CODEC_UNKNOWN,
70  MP4PARSE_CODEC_AAC,
71  MP4PARSE_CODEC_FLAC,
72  MP4PARSE_CODEC_OPUS,
73  MP4PARSE_CODEC_AVC,
74  MP4PARSE_CODEC_VP9,
75  MP4PARSE_CODEC_AV1,
76  MP4PARSE_CODEC_MP3,
77  MP4PARSE_CODEC_MP4V,
78  MP4PARSE_CODEC_JPEG,
79  MP4PARSE_CODEC_AC3,
80  MP4PARSE_CODEC_EC3,
81  MP4PARSE_CODEC_ALAC,
82  MP4PARSE_CODEC_H263,
83 #if defined(MP4PARSE_FEATURE_3GPP)
84  MP4PARSE_CODEC_AMRNB,
85 #endif
86 #if defined(MP4PARSE_FEATURE_3GPP)
87  MP4PARSE_CODEC_AMRWB,
88 #endif
89  MP4PARSE_CODEC_CRAW,
90 } Mp4parseCodec;
91 
92 typedef enum Mp4parseTrackType {
93  MP4PARSE_TRACK_TYPE_VIDEO = 0,
94  MP4PARSE_TRACK_TYPE_AUDIO = 1,
95  MP4PARSE_TRACK_TYPE_METADATA = 2,
96 } Mp4parseTrackType;
97 
98 typedef enum Mp4parseStrictness {
99  MP4PARSE_STRICTNESS_PERMISSIVE,
100  MP4PARSE_STRICTNESS_NORMAL,
101  MP4PARSE_STRICTNESS_STRICT,
102 } Mp4parseStrictness;
103 
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,
123 } Mp4parseStatus;
124 
125 typedef struct Mp4parseAvifParser Mp4parseAvifParser;
126 
127 typedef struct Mp4parseParser Mp4parseParser;
128 
129 typedef struct Mp4parseIo {
130  intptr_t (*read)(uint8_t *buffer, uintptr_t size, void *userdata);
131  void *userdata;
132 } Mp4parseIo;
133 
134 #if defined(MP4PARSE_UNSTABLE_API)
139 typedef int64_t CheckedInteger_i64;
140 #endif
141 
142 typedef struct Mp4parseTrackInfo {
143  enum Mp4parseTrackType track_type;
144  uint32_t track_id;
145  uint64_t duration;
146  CheckedInteger_i64 media_time;
148 
149 #if defined(MP4PARSE_UNSTABLE_API)
154 typedef uint64_t CheckedInteger_u64;
155 #endif
156 
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;
196  bool sync;
197 } Mp4parseIndice;
198 #endif
199 
200 typedef struct Mp4parseByteData {
201  uintptr_t length;
202  const uint8_t *data;
203  const struct Mp4parseIndice *indices;
205 
206 enum OptionalFourCc_Tag
207 #ifdef __cplusplus
208  : uint8_t
209 #endif // __cplusplus
210  {
211  OPTIONAL_FOUR_CC_NONE,
212  OPTIONAL_FOUR_CC_SOME,
213 };
214 #ifndef __cplusplus
215 typedef uint8_t OptionalFourCc_Tag;
216 #endif // __cplusplus
217 
218 typedef union OptionalFourCc {
219  OptionalFourCc_Tag tag;
220  struct {
221  OptionalFourCc_Tag some_tag;
222  uint8_t some[4];
223  };
225 
226 typedef struct Mp4parseSinfInfo {
227  union OptionalFourCc original_format;
228  enum Mp4ParseEncryptionSchemeType scheme_type;
229  uint8_t is_encrypted;
230  uint8_t iv_size;
231  struct Mp4parseByteData kid;
232  uint8_t crypt_byte_block;
233  uint8_t skip_byte_block;
234  struct Mp4parseByteData constant_iv;
236 
238  enum Mp4parseCodec codec_type;
239  uint16_t channels;
240  uint16_t bit_depth;
241  uint32_t sample_rate;
242  uint16_t profile;
243  uint16_t extended_profile;
244  struct Mp4parseByteData codec_specific_config;
245  struct Mp4parseByteData extra_data;
246  struct Mp4parseSinfInfo protected_data;
248 
249 typedef struct Mp4parseTrackAudioInfo {
250  uint32_t sample_info_count;
251  const struct Mp4parseTrackAudioSampleInfo *sample_info;
253 
254 typedef struct Mp4parseTrackRawInfo {
255  uint16_t image_width;
256  uint16_t image_height;
257  bool is_jpeg;
258  uint64_t offset;
259  uint64_t size;
261 
263  enum Mp4parseCodec codec_type;
264  uint16_t image_width;
265  uint16_t image_height;
266  struct Mp4parseByteData extra_data;
267  struct Mp4parseSinfInfo protected_data;
269 
270 typedef struct Mp4parseTrackVideoInfo {
271  uint32_t display_width;
272  uint32_t display_height;
273  uint16_t rotation;
274  uint32_t sample_info_count;
275  const struct Mp4parseTrackVideoSampleInfo *sample_info;
277 
278 typedef struct Mp4parseAvifImageItem {
279  struct Mp4parseByteData coded_data;
280  struct Mp4parseByteData bits_per_channel;
282 
284  uint32_t image_width;
285  uint32_t image_height;
287 
298  uint8_t colour_primaries;
299  uint8_t transfer_characteristics;
300  uint8_t matrix_coefficients;
301  bool full_range_flag;
303 
304 typedef struct Mp4parseAvifImage {
305  struct Mp4parseAvifImageItem primary_image;
310  const struct Mp4parseNclxColourInformation *nclx_colour_information;
311  struct Mp4parseByteData icc_colour_information;
312  enum Mp4parseIrot image_rotation;
313  const enum Mp4parseImir *image_mirror;
318  bool premultiplied_alpha;
320 
321 typedef struct Mp4parseFragmentInfo {
322  uint64_t fragment_duration;
324 
325 typedef struct Mp4parsePsshInfo {
326  struct Mp4parseByteData data;
328 
329 typedef struct Mp4parseCrawHeader {
330  struct Mp4parseByteData cncv;
331  uint16_t thumb_w;
332  uint16_t thumb_h;
333  struct Mp4parseByteData thumbnail;
334  struct Mp4parseByteData meta1;
335  struct Mp4parseByteData meta2;
336  struct Mp4parseByteData meta3;
337  struct Mp4parseByteData meta4;
339 
340 #ifdef __cplusplus
341 extern "C" {
342 #endif // __cplusplus
343 
363 Mp4parseStatus mp4parse_new(const struct Mp4parseIo *io, struct Mp4parseParser **parser_out);
364 
376 Mp4parseStatus mp4parse_avif_new(const struct Mp4parseIo *io,
377  enum Mp4parseStrictness strictness,
378  struct Mp4parseAvifParser **parser_out);
379 
389 void mp4parse_free(struct Mp4parseParser *parser);
390 
400 void mp4parse_avif_free(struct Mp4parseAvifParser *parser);
401 
412 Mp4parseStatus mp4parse_get_track_count(const struct Mp4parseParser *parser, uint32_t *count);
413 
424 Mp4parseStatus mp4parse_get_track_info(struct Mp4parseParser *parser,
425  uint32_t track_index,
426  struct Mp4parseTrackInfo *info);
427 
438 Mp4parseStatus mp4parse_get_track_audio_info(struct Mp4parseParser *parser,
439  uint32_t track_index,
440  struct Mp4parseTrackAudioInfo *info);
441 
449 Mp4parseStatus mp4parse_get_track_raw_info(struct Mp4parseParser *parser,
450  uint32_t track_index,
451  struct Mp4parseTrackRawInfo *info);
452 
463 Mp4parseStatus mp4parse_get_track_video_info(struct Mp4parseParser *parser,
464  uint32_t track_index,
465  struct Mp4parseTrackVideoInfo *info);
466 
481 Mp4parseStatus mp4parse_avif_get_image(const struct Mp4parseAvifParser *parser,
482  struct Mp4parseAvifImage *avif_image);
483 
494 Mp4parseStatus mp4parse_get_indice_table(struct Mp4parseParser *parser,
495  uint32_t track_id,
496  struct Mp4parseByteData *indices);
497 
508 Mp4parseStatus mp4parse_get_fragment_info(struct Mp4parseParser *parser,
509  struct Mp4parseFragmentInfo *info);
510 
522 Mp4parseStatus mp4parse_is_fragmented(struct Mp4parseParser *parser,
523  uint32_t track_id,
524  uint8_t *fragmented);
525 
542 Mp4parseStatus mp4parse_get_pssh_info(struct Mp4parseParser *parser, struct Mp4parsePsshInfo *info);
543 
551 Mp4parseStatus mp4parse_get_craw_header(struct Mp4parseParser *parser,
552  struct Mp4parseCrawHeader *header);
553 
562 Mp4parseStatus mp4parse_get_craw_table_entry(struct Mp4parseParser *parser,
563  uintptr_t idx,
564  uint64_t *offset,
565  uint64_t *size);
566 
567 #ifdef __cplusplus
568 } // extern "C"
569 #endif // __cplusplus
struct Mp4parseAvifImageItem alpha_image
Definition: mp4parse_ffi.h:317
const struct Mp4parseImageSpatialExtents * spatial_extents
Definition: mp4parse_ffi.h:309