Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 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. |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 12 | #ifndef AV1_COMMON_FRAME_BUFFERS_H_ |
| 13 | #define AV1_COMMON_FRAME_BUFFERS_H_ |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 14 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 15 | #include "aom/aom_frame_buffer.h" |
| 16 | #include "aom/aom_integer.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
| 22 | typedef struct InternalFrameBuffer { |
| 23 | uint8_t *data; |
| 24 | size_t size; |
| 25 | int in_use; |
| 26 | } InternalFrameBuffer; |
| 27 | |
| 28 | typedef struct InternalFrameBufferList { |
| 29 | int num_internal_frame_buffers; |
| 30 | InternalFrameBuffer *int_fb; |
| 31 | } InternalFrameBufferList; |
| 32 | |
| 33 | // Initializes |list|. Returns 0 on success. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 34 | int av1_alloc_internal_frame_buffers(InternalFrameBufferList *list); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 35 | |
| 36 | // Free any data allocated to the frame buffers. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 37 | void av1_free_internal_frame_buffers(InternalFrameBufferList *list); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 38 | |
| 39 | // Callback used by libaom to request an external frame buffer. |cb_priv| |
| 40 | // Callback private data, which points to an InternalFrameBufferList. |
| 41 | // |min_size| is the minimum size in bytes needed to decode the next frame. |
| 42 | // |fb| pointer to the frame buffer. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 43 | int av1_get_frame_buffer(void *cb_priv, size_t min_size, |
| 44 | aom_codec_frame_buffer_t *fb); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 45 | |
| 46 | // Callback used by libaom when there are no references to the frame buffer. |
| 47 | // |cb_priv| is not used. |fb| pointer to the frame buffer. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 48 | int av1_release_frame_buffer(void *cb_priv, aom_codec_frame_buffer_t *fb); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 49 | |
| 50 | #ifdef __cplusplus |
| 51 | } // extern "C" |
| 52 | #endif |
| 53 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 54 | #endif // AV1_COMMON_FRAME_BUFFERS_H_ |