Tizen 2.0 Release
[framework/multimedia/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapivideopool.h
1 /*
2  *  gstvaapivideopool.h - Video object pool abstraction
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *
6  *  This library is free software; you can redistribute it and/or
7  *  modify it under the terms of the GNU Lesser General Public License
8  *  as published by the Free Software Foundation; either version 2.1
9  *  of the License, or (at your option) any later version.
10  *
11  *  This library is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *  Lesser General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Lesser General Public
17  *  License along with this library; if not, write to the Free
18  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  *  Boston, MA 02110-1301 USA
20  */
21
22 #ifndef GST_VAAPI_VIDEO_POOL_H
23 #define GST_VAAPI_VIDEO_POOL_H
24
25 #include <glib.h>
26 #include <gst/gstcaps.h>
27 #include <gst/vaapi/gstvaapidisplay.h>
28
29 G_BEGIN_DECLS
30
31 #define GST_VAAPI_TYPE_VIDEO_POOL \
32     (gst_vaapi_video_pool_get_type())
33
34 #define GST_VAAPI_VIDEO_POOL(obj)                               \
35     (G_TYPE_CHECK_INSTANCE_CAST((obj),                          \
36                                 GST_VAAPI_TYPE_VIDEO_POOL,      \
37                                 GstVaapiVideoPool))
38
39 #define GST_VAAPI_VIDEO_POOL_CLASS(klass)                       \
40     (G_TYPE_CHECK_CLASS_CAST((klass),                           \
41                              GST_VAAPI_TYPE_VIDEO_POOL,         \
42                              GstVaapiVideoPoolClass))
43
44 #define GST_VAAPI_IS_VIDEO_POOL(obj) \
45     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_VIDEO_POOL))
46
47 #define GST_VAAPI_IS_VIDEO_POOL_CLASS(klass) \
48     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_VIDEO_POOL))
49
50 #define GST_VAAPI_VIDEO_POOL_GET_CLASS(obj)                     \
51     (G_TYPE_INSTANCE_GET_CLASS((obj),                           \
52                                GST_VAAPI_TYPE_VIDEO_POOL,       \
53                                GstVaapiVideoPoolClass))
54
55 typedef struct _GstVaapiVideoPool               GstVaapiVideoPool;
56 typedef struct _GstVaapiVideoPoolPrivate        GstVaapiVideoPoolPrivate;
57 typedef struct _GstVaapiVideoPoolClass          GstVaapiVideoPoolClass;
58
59 /**
60  * GstVaapiVideoPool:
61  *
62  * A pool of lazily allocated video objects. e.g. surfaces, images.
63  */
64 struct _GstVaapiVideoPool {
65     /*< private >*/
66     GObject parent_instance;
67
68     GstVaapiVideoPoolPrivate *priv;
69 };
70
71 /**
72  * GstVaapiVideoPoolClass:
73  * @set_caps: virtual function for notifying the subclass of the
74  *   negotiated caps
75  * @alloc_object: virtual function for allocating a video pool object
76  *
77  * A pool base class used to hold video objects. e.g. surfaces, images.
78  */
79 struct _GstVaapiVideoPoolClass {
80     /*< private >*/
81     GObjectClass parent_class;
82
83     /*< public >*/
84     void     (*set_caps)    (GstVaapiVideoPool *pool, GstCaps *caps);
85     gpointer (*alloc_object)(GstVaapiVideoPool *pool, GstVaapiDisplay *display);
86 };
87
88 GType
89 gst_vaapi_video_pool_get_type(void) G_GNUC_CONST;
90
91 GstVaapiDisplay *
92 gst_vaapi_video_pool_get_display(GstVaapiVideoPool *pool);
93
94 GstCaps *
95 gst_vaapi_video_pool_get_caps(GstVaapiVideoPool *pool);
96
97 gpointer
98 gst_vaapi_video_pool_get_object(GstVaapiVideoPool *pool);
99
100 void
101 gst_vaapi_video_pool_put_object(GstVaapiVideoPool *pool, gpointer object);
102
103 gboolean
104 gst_vaapi_video_pool_add_object(GstVaapiVideoPool *pool, gpointer object);
105
106 gboolean
107 gst_vaapi_video_pool_add_objects(GstVaapiVideoPool *pool, GPtrArray *objects);
108
109 guint
110 gst_vaapi_video_pool_get_size(GstVaapiVideoPool *pool);
111
112 gboolean
113 gst_vaapi_video_pool_reserve(GstVaapiVideoPool *pool, guint n);
114
115 guint
116 gst_vaapi_video_pool_get_capacity(GstVaapiVideoPool *pool);
117
118 void
119 gst_vaapi_video_pool_set_capacity(GstVaapiVideoPool *pool, guint capacity);
120
121 G_END_DECLS
122
123 #endif /* GST_VAAPI_VIDEO_POOL_H */