1 /* 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef VP9_COMMON_VP9_FRAME_BUFFERS_H_ 12 #define VP9_COMMON_VP9_FRAME_BUFFERS_H_ 13 14 #include "vpx/vpx_frame_buffer.h" 15 #include "vpx/vpx_integer.h" 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 typedef struct InternalFrameBuffer { 22 uint8_t *data; 23 size_t size; 24 int in_use; 25 } InternalFrameBuffer; 26 27 typedef struct InternalFrameBufferList { 28 int num_internal_frame_buffers; 29 InternalFrameBuffer *int_fb; 30 } InternalFrameBufferList; 31 32 // Initializes |list|. Returns 0 on success. 33 int vp9_alloc_internal_frame_buffers(InternalFrameBufferList *list); 34 35 // Free any data allocated to the frame buffers. 36 void vp9_free_internal_frame_buffers(InternalFrameBufferList *list); 37 38 // Callback used by libvpx to request an external frame buffer. |cb_priv| 39 // Callback private data, which points to an InternalFrameBufferList. 40 // |min_size| is the minimum size in bytes needed to decode the next frame. 41 // |fb| pointer to the frame buffer. 42 int vp9_get_frame_buffer(void *cb_priv, size_t min_size, 43 vpx_codec_frame_buffer_t *fb); 44 45 // Callback used by libvpx when there are no references to the frame buffer. 46 // |cb_priv| is not used. |fb| pointer to the frame buffer. 47 int vp9_release_frame_buffer(void *cb_priv, vpx_codec_frame_buffer_t *fb); 48 49 #ifdef __cplusplus 50 } // extern "C" 51 #endif 52 53 #endif // VP9_COMMON_VP9_FRAME_BUFFERS_H_ 54