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_SURFACEPOOL_H__ 10 #define __MIX_SURFACEPOOL_H__ 11 12 #include <mixparams.h> 13 #include "mixvideodef.h" 14 #include "mixvideoframe.h" 15 16 #include <va/va.h> 17 18 G_BEGIN_DECLS 19 20 /** 21 * MIX_TYPE_SURFACEPOOL: 22 * 23 * Get type of class. 24 */ 25 #define MIX_TYPE_SURFACEPOOL (mix_surfacepool_get_type ()) 26 27 /** 28 * MIX_SURFACEPOOL: 29 * @obj: object to be type-casted. 30 */ 31 #define MIX_SURFACEPOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_SURFACEPOOL, MixSurfacePool)) 32 33 /** 34 * MIX_IS_SURFACEPOOL: 35 * @obj: an object. 36 * 37 * Checks if the given object is an instance of #MixSurfacePool 38 */ 39 #define MIX_IS_SURFACEPOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_SURFACEPOOL)) 40 41 /** 42 * MIX_SURFACEPOOL_CLASS: 43 * @klass: class to be type-casted. 44 */ 45 #define MIX_SURFACEPOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_SURFACEPOOL, MixSurfacePoolClass)) 46 47 /** 48 * MIX_IS_SURFACEPOOL_CLASS: 49 * @klass: a class. 50 * 51 * Checks if the given class is #MixSurfacePoolClass 52 */ 53 #define MIX_IS_SURFACEPOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_SURFACEPOOL)) 54 55 /** 56 * MIX_SURFACEPOOL_GET_CLASS: 57 * @obj: a #MixSurfacePool object. 58 * 59 * Get the class instance of the object. 60 */ 61 #define MIX_SURFACEPOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_SURFACEPOOL, MixSurfacePoolClass)) 62 63 typedef struct _MixSurfacePool MixSurfacePool; 64 typedef struct _MixSurfacePoolClass MixSurfacePoolClass; 65 66 /** 67 * MixSurfacePool: 68 * 69 * MI-X Video Surface Pool object 70 */ 71 struct _MixSurfacePool 72 { 73 /*< public > */ 74 MixParams parent; 75 76 /*< public > */ 77 GSList *free_list; /* list of free surfaces */ 78 GSList *in_use_list; /* list of surfaces in use */ 79 gulong free_list_max_size; /* initial size of the free list */ 80 gulong free_list_cur_size; /* current size of the free list */ 81 gulong high_water_mark; /* most surfaces in use at one time */ 82 // guint64 timestamp; 83 84 void *reserved1; 85 void *reserved2; 86 void *reserved3; 87 void *reserved4; 88 89 /*< private > */ 90 GMutex *objectlock; 91 92 }; 93 94 /** 95 * MixSurfacePoolClass: 96 * 97 * MI-X Video Surface Pool object class 98 */ 99 struct _MixSurfacePoolClass 100 { 101 /*< public > */ 102 MixParamsClass parent_class; 103 104 /* class members */ 105 }; 106 107 /** 108 * mix_surfacepool_get_type: 109 * @returns: type 110 * 111 * Get the type of object. 112 */ 113 GType mix_surfacepool_get_type (void); 114 115 /** 116 * mix_surfacepool_new: 117 * @returns: A newly allocated instance of #MixSurfacePool 118 * 119 * Use this method to create new instance of #MixSurfacePool 120 */ 121 MixSurfacePool *mix_surfacepool_new (void); 122 /** 123 * mix_surfacepool_ref: 124 * @mix: object to add reference 125 * @returns: the MixSurfacePool instance where reference count has been increased. 126 * 127 * Add reference count. 128 */ 129 MixSurfacePool *mix_surfacepool_ref (MixSurfacePool * mix); 130 131 /** 132 * mix_surfacepool_unref: 133 * @obj: object to unref. 134 * 135 * Decrement reference count of the object. 136 */ 137 #define mix_surfacepool_unref(obj) mix_params_unref(MIX_PARAMS(obj)) 138 139 /* Class Methods */ 140 141 MIX_RESULT mix_surfacepool_initialize (MixSurfacePool * obj, 142 VASurfaceID *surfaces, guint num_surfaces); 143 MIX_RESULT mix_surfacepool_put (MixSurfacePool * obj, 144 MixVideoFrame * frame); 145 146 MIX_RESULT mix_surfacepool_get (MixSurfacePool * obj, 147 MixVideoFrame ** frame); 148 149 MIX_RESULT mix_surfacepool_get_frame_with_ci_frameidx (MixSurfacePool * obj, 150 MixVideoFrame ** frame, MixVideoFrame *in_frame); 151 152 MIX_RESULT mix_surfacepool_check_available (MixSurfacePool * obj); 153 154 MIX_RESULT mix_surfacepool_deinitialize (MixSurfacePool * obj); 155 156 G_END_DECLS 157 158 #endif /* __MIX_SURFACEPOOL_H__ */ 159