blob: e7341cfdd3540b7a01bb25197212e3277210119e [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu2ab7ff02016-09-02 12:04:54 -07004 * 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 Xuc27fc142016-08-22 16:08:15 -070010 */
11
Yaowu Xuf883b422016-08-30 14:01:10 -070012#ifndef AV1_COMMON_FRAME_BUFFERS_H_
13#define AV1_COMMON_FRAME_BUFFERS_H_
Yaowu Xuc27fc142016-08-22 16:08:15 -070014
Yaowu Xuf883b422016-08-30 14:01:10 -070015#include "aom/aom_frame_buffer.h"
16#include "aom/aom_integer.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070017
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22typedef struct InternalFrameBuffer {
23 uint8_t *data;
24 size_t size;
25 int in_use;
26} InternalFrameBuffer;
27
28typedef struct InternalFrameBufferList {
29 int num_internal_frame_buffers;
30 InternalFrameBuffer *int_fb;
31} InternalFrameBufferList;
32
33// Initializes |list|. Returns 0 on success.
Yaowu Xuf883b422016-08-30 14:01:10 -070034int av1_alloc_internal_frame_buffers(InternalFrameBufferList *list);
Yaowu Xuc27fc142016-08-22 16:08:15 -070035
36// Free any data allocated to the frame buffers.
Yaowu Xuf883b422016-08-30 14:01:10 -070037void av1_free_internal_frame_buffers(InternalFrameBufferList *list);
Yaowu Xuc27fc142016-08-22 16:08:15 -070038
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 Xuf883b422016-08-30 14:01:10 -070043int av1_get_frame_buffer(void *cb_priv, size_t min_size,
44 aom_codec_frame_buffer_t *fb);
Yaowu Xuc27fc142016-08-22 16:08:15 -070045
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 Xuf883b422016-08-30 14:01:10 -070048int av1_release_frame_buffer(void *cb_priv, aom_codec_frame_buffer_t *fb);
Yaowu Xuc27fc142016-08-22 16:08:15 -070049
50#ifdef __cplusplus
51} // extern "C"
52#endif
53
Yaowu Xuf883b422016-08-30 14:01:10 -070054#endif // AV1_COMMON_FRAME_BUFFERS_H_