1 /* 2 * Copyright (c) 2018, Alliance for Open Media. All rights reserved 3 * 4 * This source code is subject to the terms of the BSD 2 Clause License and 5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 * was not distributed with this source code in the LICENSE file, you can 7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8 * Media Patent License 1.0 was not distributed with this source code in the 9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10 */ 11 #ifndef AOM_AV1_COMMON_OBU_UTIL_H_ 12 #define AOM_AV1_COMMON_OBU_UTIL_H_ 13 14 #include "aom/aom_codec.h" 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 typedef struct { 21 size_t size; // Size (1 or 2 bytes) of the OBU header (including the 22 // optional OBU extension header) in the bitstream. 23 OBU_TYPE type; 24 int has_size_field; 25 int has_extension; 26 // The following fields come from the OBU extension header and therefore are 27 // only used if has_extension is true. 28 int temporal_layer_id; 29 int spatial_layer_id; 30 } ObuHeader; 31 32 aom_codec_err_t aom_read_obu_header(uint8_t *buffer, size_t buffer_length, 33 size_t *consumed, ObuHeader *header, 34 int is_annexb); 35 36 aom_codec_err_t aom_read_obu_header_and_size(const uint8_t *data, 37 size_t bytes_available, 38 int is_annexb, 39 ObuHeader *obu_header, 40 size_t *const payload_size, 41 size_t *const bytes_read); 42 43 #ifdef __cplusplus 44 } // extern "C" 45 #endif 46 47 #endif // AOM_AV1_COMMON_OBU_UTIL_H_ 48