Debian Codegraph @

src/videofilters/av1/obu/obuparse.h

raw symbols SCIP
1 /*
2 * Copyright (c) 2020, Derek Buitenhuis
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef OBUPARSE_H
18 #define OBUPARSE_H
19
20 #include <stddef.h>
21 #include <stdint.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /*********************************************
28 * Various enums from the AV1 specification. *
29 *********************************************/
30
31 /*
32 * OBU types.
33 */
34 typedef enum {
35 /* 0 Reserved */
36 OBP_OBU_SEQUENCE_HEADER = 1,
37 OBP_OBU_TEMPORAL_DELIMITER = 2,
38 OBP_OBU_FRAME_HEADER = 3,
39 OBP_OBU_TILE_GROUP = 4,
40 OBP_OBU_METADATA = 5,
41 OBP_OBU_FRAME = 6,
42 OBP_OBU_REDUNDANT_FRAME_HEADER = 7,
43 OBP_OBU_TILE_LIST = 8,
44 /* 9-14 Reserved */
45 OBP_OBU_PADDING = 15
46 } OBPOBUType;
47
48 /*
49 * Metadata types for the Metadata OBU.
50 */
51 typedef enum {
52 /* 0 Reserved */
53 OBP_METADATA_TYPE_HDR_CLL = 1,
54 OBP_METADATA_TYPE_HDR_MDCV = 2,
55 OBP_METADATA_TYPE_SCALABILITY = 3,
56 OBP_METADATA_TYPE_ITUT_T35 = 4,
57 OBP_METADATA_TYPE_TIMECODE = 5
58 /* 6-31 Unregistered user private */
59 /* 32 and greater Reserved for AOM use */
60 } OBPMetadataType;
61
62 /*
63 * Color primaries.
64 *
65 * These match ISO/IEC 23091-4/ITU-T H.273.
66 */
67 typedef enum {
68 OBP_CP_BT_709 = 1,
69 OBP_CP_UNSPECIFIED = 2,
70 OBP_CP_BT_470_M = 4,
71 OBP_CP_BT_470_B_G = 5,
72 OBP_CP_BT_601 = 6,
73 OBP_CP_SMPTE_240 = 7,
74 OBP_CP_GENERIC_FILM = 8,
75 OBP_CP_BT_2020 = 9,
76 OBP_CP_XYZ = 10,
77 OBP_CP_SMPTE_431 = 11,
78 OBP_CP_SMPTE_432 = 12,
79 OBP_CP_EBU_3213 = 22
80 } OBPColorPrimaries;
81
82 /*
83 * Transfer characteristics.
84 *
85 * These match ISO/IEC 23091-4/ITU-T H.273.
86 */
87 typedef enum {
88 OBP_TC_RESERVED_0 = 0,
89 OBP_TC_BT_709 = 1,
90 OBP_TC_UNSPECIFIED = 2,
91 OBP_TC_RESERVED_3 = 3,
92 OBP_TC_BT_470_M = 4,
93 OBP_TC_BT_470_B_G = 5,
94 OBP_TC_BT_601 = 6,
95 OBP_TC_SMPTE_240 = 7,
96 OBP_TC_LINEAR = 8,
97 OBP_TC_LOG_100 = 9,
98 OBP_TC_LOG_100_SQRT10 = 10,
99 OBP_TC_IEC_61966 = 11,
100 OBP_TC_BT_1361 = 12,
101 OBP_TC_SRGB = 13,
102 OBP_TC_BT_2020_10_BIT = 14,
103 OBP_TC_BT_2020_12_BIT = 15,
104 OBP_TC_SMPTE_2084 = 16,
105 OBP_TC_SMPTE_428 = 17,
106 OBP_TC_HLG = 18
107 } OBPTransferCharacteristics;
108
109 /*
110 * Color matrix coefficients.
111 *
112 * These match ISO/IEC 23091-4/ITU-T H.273.
113 */
114 typedef enum {
115 OBP_MC_IDENTITY = 0,
116 OBP_MC_BT_709 = 1,
117 OBP_MC_UNSPECIFIED = 2,
118 OBP_MC_RESERVED_3 = 3,
119 OBP_MC_FCC = 4,
120 OBP_MC_BT_470_B_G = 5,
121 OBP_MC_BT_601 = 6,
122 OBP_MC_SMPTE_240 = 7,
123 OBP_MC_SMPTE_YCGCO = 8,
124 OBP_MC_BT_2020_NCL = 9,
125 OBP_MC_BT_2020_CL = 10,
126 OBP_MC_SMPTE_2085 = 11,
127 OBP_MC_CHROMAT_NCL = 12,
128 OBP_MC_CHROMAT_CL = 13,
129 OBP_MC_ICTCP = 14
130 } OBPMatrixCoefficients;
131
132 /*
133 * Chroma sample position.
134 */
135 typedef enum {
136 OBP_CSP_UNKNOWN = 0,
137 OBP_CSP_VERTICAL = 1,
138 OBP_CSP_COLOCATED = 2
139 /* 3 Reserved */
140 } OBPChromaSamplePosition;
141
142 /*
143 * Frame types.
144 */
145 typedef enum { OBP_KEY_FRAME = 0, OBP_INTER_FRAME = 1, OBP_INTRA_ONLY_FRAME = 2, OBP_SWITCH_FRAME = 3 } OBPFrameType;
146
147 /**************************************************
148 * Various structures from the AV1 specification. *
149 **************************************************/
150
151 /*
152 * Sequence Header OBU
153 */
154 typedef struct OBPSequenceHeader {
155 uint8_t seq_profile;
156 int still_picture;
157 int reduced_still_picture_header;
158 int timing_info_present_flag;
159 struct {
160 uint32_t num_units_in_display_tick;
161 uint32_t time_scale;
162 int equal_picture_interval;
163 uint32_t num_ticks_per_picture_minus_1;
164 } timing_info;
165 int decoder_model_info_present_flag;
166 struct {
167 uint8_t buffer_delay_length_minus_1;
168 uint32_t num_units_in_decoding_tick;
169 uint8_t buffer_removal_time_length_minus_1;
170 uint8_t frame_presentation_time_length_minus_1;
171 } decoder_model_info;
172 int initial_display_delay_present_flag;
173 uint8_t operating_points_cnt_minus_1;
174 uint8_t operating_point_idc[32];
175 uint8_t seq_level_idx[32];
176 uint8_t seq_tier[32];
177 int decoder_model_present_for_this_op[32];
178 struct {
179 uint64_t decoder_buffer_delay;
180 uint64_t encoder_buffer_delay;
181 int low_delay_mode_flag;
182 } operating_parameters_info[32];
183 int initial_display_delay_present_for_this_op[32];
184 uint8_t initial_display_delay_minus_1[32];
185 uint8_t frame_width_bits_minus_1;
186 uint8_t frame_height_bits_minus_1;
187 uint32_t max_frame_width_minus_1;
188 uint32_t max_frame_height_minus_1;
189 int frame_id_numbers_present_flag;
190 uint8_t delta_frame_id_length_minus_2;
191 uint8_t additional_frame_id_length_minus_1;
192 int use_128x128_superblock;
193 int enable_filter_intra;
194 int enable_intra_edge_filter;
195 int enable_interintra_compound;
196 int enable_masked_compound;
197 int enable_warped_motion;
198 int enable_dual_filter;
199 int enable_order_hint;
200 int enable_jnt_comp;
201 int enable_ref_frame_mvs;
202 int seq_choose_screen_content_tools;
203 int seq_force_screen_content_tools;
204 int seq_choose_integer_mv;
205 int seq_force_integer_mv;
206 uint8_t order_hint_bits_minus_1;
207 uint8_t OrderHintBits;
208 int enable_superres;
209 int enable_cdef;
210 int enable_restoration;
211 struct {
212 int high_bitdepth;
213 int twelve_bit;
214 uint8_t BitDepth;
215 int mono_chrome;
216 uint8_t NumPlanes;
217 int color_description_present_flag;
218 OBPColorPrimaries color_primaries;
219 OBPTransferCharacteristics transfer_characteristics;
220 OBPMatrixCoefficients matrix_coefficients;
221 int color_range;
222 int subsampling_x;
223 int subsampling_y;
224 OBPChromaSamplePosition chroma_sample_position;
225 int separate_uv_delta_q;
226 } color_config;
227 int film_grain_params_present;
228 } OBPSequenceHeader;
229
230 /*
231 * Film Grain Parameters.
232 */
233 typedef struct OBPFilmGrainParameters {
234 int apply_grain;
235 uint16_t grain_seed;
236 int update_grain;
237 uint8_t film_grain_params_ref_idx;
238 uint8_t num_y_points;
239 uint8_t point_y_value[16];
240 uint8_t point_y_scaling[16];
241 int chroma_scaling_from_luma;
242 uint8_t num_cb_points;
243 uint8_t point_cb_value[16];
244 uint8_t point_cb_scaling[16];
245 uint8_t num_cr_points;
246 uint8_t point_cr_value[16];
247 uint8_t point_cr_scaling[16];
248 uint8_t grain_scaling_minus_8;
249 uint8_t ar_coeff_lag;
250 uint8_t ar_coeffs_y_plus_128[24];
251 uint8_t ar_coeffs_cb_plus_128[25];
252 uint8_t ar_coeffs_cr_plus_128[25];
253 uint8_t ar_coeff_shift_minus_6;
254 uint8_t grain_scale_shift;
255 uint8_t cb_mult;
256 uint8_t cb_luma_mult;
257 uint16_t cb_offset;
258 uint8_t cr_mult;
259 uint8_t cr_luma_mult;
260 uint16_t cr_offset;
261 int overlap_flag;
262 int clip_to_restricted_range;
263 } OBPFilmGrainParameters;
264
265 /*
266 * Frame Header OBU
267 */
268 typedef struct OBPFrameHeader {
269 int show_existing_frame;
270 uint8_t frame_to_show_map_idx;
271 struct {
272 uint32_t frame_presentation_time;
273 } temporal_point_info;
274 uint32_t display_frame_id;
275 /* load_grain_params() unimplemented. */
276 OBPFrameType frame_type;
277 int show_frame;
278 int showable_frame;
279 int error_resilient_mode;
280 int disable_cdf_update;
281 int allow_screen_content_tools;
282 int force_integer_mv;
283 uint32_t current_frame_id;
284 int frame_size_override_flag;
285 uint8_t order_hint;
286 uint8_t primary_ref_frame;
287 int buffer_removal_time_present_flag;
288 uint32_t buffer_removal_time[32];
289 uint8_t refresh_frame_flags;
290 uint8_t ref_order_hint[8];
291 uint32_t frame_width_minus_1;
292 uint32_t frame_height_minus_1;
293 struct {
294 int use_superres;
295 uint8_t coded_denom;
296 } superres_params;
297 int render_and_frame_size_different;
298 uint16_t render_width_minus_1;
299 uint16_t render_height_minus_1;
300 uint32_t RenderWidth;
301 uint32_t RenderHeight;
302 int allow_intrabc;
303 int frame_refs_short_signaling;
304 uint8_t last_frame_idx;
305 uint8_t gold_frame_idx;
306 uint8_t ref_frame_idx[7];
307 uint8_t delta_frame_id_minus_1[7];
308 int found_ref;
309 int allow_high_precision_mv;
310 struct {
311 int is_filter_switchable;
312 uint8_t interpolation_filter;
313 } interpolation_filter;
314 int is_motion_mode_switchable;
315 int use_ref_frame_mvs;
316 int disable_frame_end_update_cdf;
317 struct {
318 int uniform_tile_spacing_flag;
319 uint16_t TileRows;
320 uint16_t TileCols;
321 uint32_t context_update_tile_id;
322 uint8_t tile_size_bytes_minus_1;
323 } tile_info;
324 struct {
325 uint8_t base_q_idx;
326 int diff_uv_delta;
327 int using_qmatrix;
328 uint8_t qm_y;
329 uint8_t qm_u;
330 uint8_t qm_v;
331 } quantization_params;
332 struct {
333 int segmentation_enabled;
334 int segmentation_update_map;
335 int segmentation_temporal_update;
336 int segmentation_update_data;
337 } segmentation_params;
338 struct {
339 int delta_q_present;
340 uint8_t delta_q_res;
341 } delta_q_params;
342 struct {
343 int delta_lf_present;
344 uint8_t delta_lf_res;
345 int delta_lf_multi;
346 } delta_lf_params;
347 struct {
348 uint8_t loop_filter_level[4];
349 uint8_t loop_filter_sharpness;
350 int loop_filter_delta_enabled;
351 int loop_filter_delta_update;
352 int update_ref_delta[8];
353 int8_t loop_filter_ref_deltas[8];
354 int update_mode_delta[8];
355 int8_t loop_filter_mode_deltas[8];
356 } loop_filter_params;
357 struct {
358 uint8_t cdef_damping_minus_3;
359 uint8_t cdef_bits;
360 uint8_t cdef_y_pri_strength[8];
361 uint8_t cdef_y_sec_strength[8];
362 uint8_t cdef_uv_pri_strength[8];
363 uint8_t cdef_uv_sec_strength[8];
364 } cdef_params;
365 struct {
366 uint8_t lr_type[3];
367 uint8_t lr_unit_shift;
368 int lr_uv_shift;
369 } lr_params;
370 int tx_mode_select;
371 int skip_mode_present;
372 int reference_select;
373 int allow_warped_motion;
374 int reduced_tx_set;
375 struct {
376 uint8_t gm_type[8];
377 int32_t gm_params[8][6];
378 uint32_t prev_gm_params[8][6];
379 } global_motion_params;
380 OBPFilmGrainParameters film_grain_params;
381 } OBPFrameHeader;
382
383 /*
384 * Tile Group OBU.
385 */
386 typedef struct OBPTileGroup {
387 uint16_t NumTiles;
388 int tile_start_and_end_present_flag;
389 uint16_t tg_start;
390 uint16_t tg_end;
391 uint64_t TileSize[4096];
392 } OBPTileGroup;
393
394 /*
395 * Tile List OBU
396 */
397 typedef struct OBPTileList {
398 uint8_t output_frame_width_in_tiles_minus_1;
399 uint8_t output_frame_height_in_tiles_minus_1;
400 uint16_t tile_count_minus_1;
401 struct {
402 uint8_t anchor_frame_idx;
403 uint8_t anchor_tile_row;
404 uint8_t anchor_tile_col;
405 uint16_t tile_data_size_minus_1;
406 uint8_t *coded_tile_data;
407 size_t coded_tile_data_size;
408 } tile_list_entry[65536];
409 } OBPTileList;
410
411 /*
412 * Metadata OBU
413 */
414 typedef struct OBPMetadata {
415 OBPMetadataType metadata_type;
416 struct {
417 uint8_t itu_t_t35_country_code; /* Annex A of Recommendation ITU-T T.35. */
418 uint8_t itu_t_t35_country_code_extension_byte;
419 uint8_t *itu_t_t35_payload_bytes;
420 size_t itu_t_t35_payload_bytes_size;
421 } metadata_itut_t35;
422 struct {
423 uint16_t max_cll;
424 uint16_t max_fall;
425 } metadata_hdr_cll;
426 struct {
427 uint16_t primary_chromaticity_x[3];
428 uint16_t primary_chromaticity_y[3];
429 uint16_t white_point_chromaticity_x;
430 uint16_t white_point_chromaticity_y;
431 uint32_t luminance_max;
432 uint32_t luminance_min;
433 } metadata_hdr_mdcv;
434 struct {
435 uint8_t scalability_mode_idc;
436 struct {
437 uint8_t spatial_layers_cnt_minus_1;
438 int spatial_layer_dimensions_present_flag;
439 int spatial_layer_description_present_flag;
440 int temporal_group_description_present_flag;
441 uint8_t scalability_structure_reserved_3bits;
442 uint16_t spatial_layer_max_width[3];
443 uint16_t spatial_layer_max_height[3];
444 uint8_t spatial_layer_ref_id[3];
445 uint8_t temporal_group_size;
446 uint8_t temporal_group_temporal_id[256];
447 int temporal_group_temporal_switching_up_point_flag[256];
448 int temporal_group_spatial_switching_up_point_flag[256];
449 uint8_t temporal_group_ref_cnt[256];
450 uint8_t temporal_group_ref_pic_diff[256][8];
451 } scalability_structure;
452 } metadata_scalability;
453 struct {
454 uint8_t counting_type;
455 int full_timestamp_flag;
456 int discontinuity_flag;
457 int cnt_dropped_flag;
458 uint16_t n_frames;
459 uint8_t seconds_value;
460 uint8_t minutes_value;
461 uint8_t hours_value;
462 int seconds_flag;
463 int minutes_flag;
464 int hours_flag;
465 uint8_t time_offset_length;
466 uint32_t time_offset_value;
467 } metadata_timecode;
468 struct {
469 uint8_t *buf;
470 size_t buf_size;
471 } unregistered;
472 } OBPMetadata;
473
474 /*******************
475 * API structures. *
476 *******************/
477
478 /*
479 * OBPError contains a user-provided buffer and buffer size
480 * where obuparse can write error messages to.
481 */
482 typedef struct OBPError {
483 char *error;
484 size_t size;
485 } OBPError;
486
487 /***************************
488 * Private API Structures. *
489 ***************************/
490
491 /*
492 * Various bits of state required for parsing uncompressed_header(), such as reference
493 * management.
494 *
495 * Do not touch the values of these members. They are for internal obuparser use only.
496 */
497 typedef struct OBPState {
498 /* Redundant Frame Header things. */
499 OBPFrameHeader prev;
500 int prev_filled;
501
502 /* For use only on OBU_FRAME parsing. */
503 size_t frame_header_end_pos;
504
505 /* Frame state. */
506 OBPFrameType RefFrameType[8];
507 uint8_t RefValid[8];
508 uint8_t RefOrderHint[8];
509 uint8_t OrderHint[8];
510 uint8_t RefFrameId[8];
511 uint32_t RefUpscaledWidth[8];
512 uint32_t RefFrameHeight[8];
513 uint32_t RefRenderWidth[8];
514 uint32_t RefRenderHeight[8];
515 int32_t RefFrameSignBias[8];
516 OBPFilmGrainParameters RefGrainParams[8];
517 uint8_t order_hint;
518 uint32_t SavedGmParams[8][8][6];
519 int SavedFeatureEnabled[8][8][8];
520 int16_t SavedFeatureData[8][8][8];
521 int8_t SavedLoopFilterRefDeltas[8][8];
522 int8_t SavedLoopFilterModeDeltas[8][8];
523 } OBPState;
524
525 /******************
526 * API functions. *
527 ******************/
528
529 /*
530 * obp_get_next_obu parses the next OBU header in a packet containing a set of one or more OBUs
531 * (e.g. an IVF or ISOBMFF packet) and returns its location in the buffer, as well as all
532 * relevant data from the header.
533 *
534 * Input:
535 * buf - Input packet buffer.
536 * buf_size - Size of the input packet buffer.
537 * err - An error buffer and buffer size to write any error messages into.
538 *
539 * Output:
540 * obu_type - The type of OBU.
541 * offset - The offset into the buffer where this OBU starts, excluding the OBU header.
542 * obu_size - The size of the OBU, excluding the size of the OBU header.
543 * temporal_id - The temporal ID of the OBU.
544 * spatial_id - The spatial ID of the OBU.
545 *
546 * Returns:
547 * 0 on success, -1 on error.
548 */
549 int obp_get_next_obu(uint8_t *buf,
550 size_t buf_size,
551 OBPOBUType *obu_type,
552 ptrdiff_t *offset,
553 size_t *obu_size,
554 int *temporal_id,
555 int *spatial_id,
556 OBPError *err);
557
558 /*
559 * obp_parse_sequence_header parses a sequence header OBU and fills out the fields in a
560 * user-provided OBPSequenceHeader structure.
561 *
562 * Input:
563 * buf - Input OBU buffer. This is expected to *NOT* contain the OBU header.
564 * buf_size - Size of the input OBU buffer.
565 * err - An error buffer and buffer size to write any error messages into.
566 *
567 * Output:
568 * seq_header - A user provided structure that will be filled in with all the parsed data.
569 *
570 * Returns:
571 * 0 on success, -1 on error.
572 */
573 int obp_parse_sequence_header(uint8_t *buf, size_t buf_size, OBPSequenceHeader *seq_header, OBPError *err);
574
575 /*
576 * obp_parse_frame_header parses a frame header OBU and fills out the fields in a user-provided
577 * OBPFrameHeader structure.
578 *
579 * Input:
580 * buf - Input OBU buffer. This is expected to *NOT* contain the OBU header.
581 * buf_size - Size of the input OBU buffer.
582 * state - An opaque state structure. Must be zeroed by the user on first use.
583 * temporal_id - A temporal ID previously obtained from obu_parse_sequence header.
584 * spatial_id - A spatial ID previously obtained from obu_parse_sequence header.
585 * err - An error buffer and buffer size to write any error messages into.
586 *
587 * Output:
588 * frame_header - A user provided structure that will be filled in with all the parsed data.
589 * SeenFrameHeader - Whether or not a frame header has beee seen. Tracking variable as per AV1 spec.
590 *
591 * Returns:
592 * 0 on success, -1 on error.
593 */
594 int obp_parse_frame_header(uint8_t *buf,
595 size_t buf_size,
596 OBPSequenceHeader *seq_header,
597 OBPState *state,
598 int temporal_id,
599 int spatial_id,
600 OBPFrameHeader *frame_header,
601 int *SeenFrameHeader,
602 OBPError *err);
603
604 /*
605 * obp_parse_frame parses a frame OBU and fills out the fields in user-provided OBPFrameHeader
606 * and OBPTileGroup structures.
607 *
608 * Input:
609 * buf - Input OBU buffer. This is expected to *NOT* contain the OBU header.
610 * buf_size - Size of the input OBU buffer.
611 * state - An opaque state structure. Must be zeroed by the user on first use.
612 * temporal_id - A temporal ID previously obtained from obu_parse_sequence header.
613 * spatial_id - A spatial ID previously obtained from obu_parse_sequence header.
614 * err - An error buffer and buffer size to write any error messages into.
615 *
616 * Output:
617 * frame_header - A user provided structure that will be filled in with all the parsed data.
618 * tile_group - A user provided structure that will be filled in with all the parsed data.
619 * SeenFrameHeader - Whether or not a frame header has been seen. Tracking variable as per AV1 spec.
620 *
621 * Returns:
622 * 0 on success, -1 on error.
623 */
624 int obp_parse_frame(uint8_t *buf,
625 size_t buf_size,
626 OBPSequenceHeader *seq_header,
627 OBPState *state,
628 int temporal_id,
629 int spatial_id,
630 OBPFrameHeader *frame_header,
631 OBPTileGroup *tile_group,
632 int *SeenFrameHeader,
633 OBPError *err);
634
635 /*
636 * obp_parse_tile_group parses a tile group OBU and fills out the fields in a
637 * user-provided OBPTileGroup structure.
638 *
639 * Input:
640 * buf - Input OBU buffer. This is expected to *NOT* contain the OBU header.
641 * buf_size - Size of the input OBU buffer.
642 * frame_header - A filled in frame header OBU previously seen.
643 * err - An error buffer and buffer size to write any error messages into.
644 *
645 * Output:
646 * tile_group - A user provided structure that will be filled in with all the parsed data.
647 * SeenFrameHeader - Whether or not a frame header has been seen. Tracking variable as per AV1 spec.
648 *
649 * Returns:
650 * 0 on success, -1 on error.
651 */
652 int obp_parse_tile_group(uint8_t *buf,
653 size_t buf_size,
654 OBPFrameHeader *frame_header,
655 OBPTileGroup *tile_group,
656 int *SeenFrameHeader,
657 OBPError *err);
658
659 /*
660 * obp_parse_metadata parses a metadata OBU and fills out the fields in a user-provided OBPMetadata
661 * structure. This OBU's returned payload is *NOT* safe to use once the user-provided 'buf' has
662 * been freed, since it may fill the structure with pointers to offsets in that data.
663 *
664 * Input:
665 * buf - Input OBU buffer. This is expected to *NOT* contain the OBU header.
666 * buf_size - Size of the input OBU buffer.
667 * err - An error buffer and buffer size to write any error messages into.
668 *
669 * Output:
670 * metadata - A user provided structure that will be filled in with all the parsed data.
671 *
672 * Returns:
673 * 0 on success, -1 on error.
674 */
675 int obp_parse_metadata(uint8_t *buf, size_t buf_size, OBPMetadata *metadata, OBPError *err);
676
677 /*
678 * obp_parse_tile_list parses a tile list OBU and fills out the fields in a user-provided OBPTileList
679 * structure. This OBU's returned payload is *NOT* safe to use once the user-provided 'buf' has
680 * been freed, since it may fill the structure with pointers to offsets in that data.
681 *
682 * Input:
683 * buf - Input OBU buffer. This is expected to *NOT* contain the OBU header.
684 * buf_size - Size of the input OBU buffer.
685 * err - An error buffer and buffer size to write any error messages into.
686 *
687 * Output:
688 * tile_list - A user provided structure that will be filled in with all the parsed data.
689 *
690 * Returns:
691 * 0 on success, -1 on error.
692 */
693 int obp_parse_tile_list(uint8_t *buf, size_t buf_size, OBPTileList *tile_list, OBPError *err);
694
695 #ifdef __cplusplus
696 }
697 #endif
698
699 #endif