1 /* 2 INTEL CONFIDENTIAL 3 Copyright 2009 Intel Corporation All Rights Reserved. 4 The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licensors. The Material contains trade secrets and proprietary and confidential information of Intel or its suppliers and licensors. The Material is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without Intel’s prior express written permission. 5 6 No license under any patent, copyright, trade secret or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual property rights must be express and approved by Intel in writing. 7 */ 8 9 #ifndef __MIX_BUFFERPOOL_H__ 10 #define __MIX_BUFFERPOOL_H__ 11 12 #include <mixparams.h> 13 #include "mixvideodef.h" 14 #include "mixbuffer.h" 15 16 #include <va/va.h> 17 18 G_BEGIN_DECLS 19 20 /** 21 * MIX_TYPE_BUFFERPOOL: 22 * 23 * Get type of class. 24 */ 25 #define MIX_TYPE_BUFFERPOOL (mix_bufferpool_get_type ()) 26 27 /** 28 * MIX_BUFFERPOOL: 29 * @obj: object to be type-casted. 30 */ 31 #define MIX_BUFFERPOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_BUFFERPOOL, MixBufferPool)) 32 33 /** 34 * MIX_IS_BUFFERPOOL: 35 * @obj: an object. 36 * 37 * Checks if the given object is an instance of #MixBufferPool 38 */ 39 #define MIX_IS_BUFFERPOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_BUFFERPOOL)) 40 41 /** 42 * MIX_BUFFERPOOL_CLASS: 43 * @klass: class to be type-casted. 44 */ 45 #define MIX_BUFFERPOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_BUFFERPOOL, MixBufferPoolClass)) 46 47 /** 48 * MIX_IS_BUFFERPOOL_CLASS: 49 * @klass: a class. 50 * 51 * Checks if the given class is #MixBufferPoolClass 52 */ 53 #define MIX_IS_BUFFERPOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_BUFFERPOOL)) 54 55 /** 56 * MIX_BUFFERPOOL_GET_CLASS: 57 * @obj: a #MixBufferPool object. 58 * 59 * Get the class instance of the object. 60 */ 61 #define MIX_BUFFERPOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_BUFFERPOOL, MixBufferPoolClass)) 62 63 typedef struct _MixBufferPool MixBufferPool; 64 typedef struct _MixBufferPoolClass MixBufferPoolClass; 65 66 /** 67 * MixBufferPool: 68 * 69 * MI-X Video Buffer Pool object 70 */ 71 struct _MixBufferPool 72 { 73 /*< public > */ 74 MixParams parent; 75 76 /*< public > */ 77 GSList *free_list; /* list of free buffers */ 78 GSList *in_use_list; /* list of buffers in use */ 79 gulong free_list_max_size; /* initial size of the free list */ 80 gulong high_water_mark; /* most buffers in use at one time */ 81 82 void *reserved1; 83 void *reserved2; 84 void *reserved3; 85 void *reserved4; 86 87 /*< private > */ 88 GMutex *objectlock; 89 90 }; 91 92 /** 93 * MixBufferPoolClass: 94 * 95 * MI-X Video Buffer Pool object class 96 */ 97 struct _MixBufferPoolClass 98 { 99 /*< public > */ 100 MixParamsClass parent_class; 101 102 /* class members */ 103 }; 104 105 /** 106 * mix_bufferpool_get_type: 107 * @returns: type 108 * 109 * Get the type of object. 110 */ 111 GType mix_bufferpool_get_type (void); 112 113 /** 114 * mix_bufferpool_new: 115 * @returns: A newly allocated instance of #MixBufferPool 116 * 117 * Use this method to create new instance of #MixBufferPool 118 */ 119 MixBufferPool *mix_bufferpool_new (void); 120 /** 121 * mix_bufferpool_ref: 122 * @mix: object to add reference 123 * @returns: the MixBufferPool instance where reference count has been increased. 124 * 125 * Add reference count. 126 */ 127 MixBufferPool *mix_bufferpool_ref (MixBufferPool * mix); 128 129 /** 130 * mix_bufferpool_unref: 131 * @obj: object to unref. 132 * 133 * Decrement reference count of the object. 134 */ 135 #define mix_bufferpool_unref(obj) mix_params_unref(MIX_PARAMS(obj)) 136 137 /* Class Methods */ 138 139 MIX_RESULT mix_bufferpool_initialize (MixBufferPool * obj, 140 guint num_buffers); 141 MIX_RESULT mix_bufferpool_put (MixBufferPool * obj, 142 MixBuffer * buffer); 143 144 MIX_RESULT mix_bufferpool_get (MixBufferPool * obj, 145 MixBuffer ** buffer); 146 MIX_RESULT mix_bufferpool_deinitialize (MixBufferPool * obj); 147 148 G_END_DECLS 149 150 #endif /* __MIX_BUFFERPOOL_H__ */ 151