Add context API <gst_vaapi_context_get_surface_pool>
[profile/ivi/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapicontext.h
1 /*
2  *  gstvaapicontext.h - VA context abstraction
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *  Copyright (C) 2011 Intel Corporation
6  *
7  *  This library is free software; you can redistribute it and/or
8  *  modify it under the terms of the GNU Lesser General Public License
9  *  as published by the Free Software Foundation; either version 2.1
10  *  of the License, or (at your option) any later version.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public
18  *  License along with this library; if not, write to the Free
19  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  *  Boston, MA 02110-1301 USA
21  */
22
23 #ifndef GST_VAAPI_CONTEXT_H
24 #define GST_VAAPI_CONTEXT_H
25
26 #include <gst/vaapi/gstvaapiobject.h>
27 #include <gst/vaapi/gstvaapiprofile.h>
28 #include <gst/vaapi/gstvaapidisplay.h>
29 #include <gst/vaapi/gstvaapisurface.h>
30 #include <gst/video/video-overlay-composition.h>
31 #include <gst/vaapi/gstvaapisurfacepool.h>
32
33 G_BEGIN_DECLS
34
35 #define GST_VAAPI_TYPE_CONTEXT \
36     (gst_vaapi_context_get_type())
37
38 #define GST_VAAPI_CONTEXT(obj)                          \
39     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
40                                 GST_VAAPI_TYPE_CONTEXT, \
41                                 GstVaapiContext))
42
43 #define GST_VAAPI_CONTEXT_CLASS(klass)                  \
44     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
45                              GST_VAAPI_TYPE_CONTEXT,    \
46                              GstVaapiContextClass))
47
48 #define GST_VAAPI_IS_CONTEXT(obj) \
49     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_CONTEXT))
50
51 #define GST_VAAPI_IS_CONTEXT_CLASS(klass) \
52     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_CONTEXT))
53
54 #define GST_VAAPI_CONTEXT_GET_CLASS(obj)                \
55     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
56                                GST_VAAPI_TYPE_CONTEXT,  \
57                                GstVaapiContextClass))
58
59 typedef struct _GstVaapiContext                 GstVaapiContext;
60 typedef struct _GstVaapiContextInfo             GstVaapiContextInfo;
61 typedef struct _GstVaapiContextPrivate          GstVaapiContextPrivate;
62 typedef struct _GstVaapiContextClass            GstVaapiContextClass;
63
64 /**
65  * GstVaapiContextInfo:
66  *
67  * Structure holding VA context info like encoded size, decoder
68  * profile and entry-point to use, and maximum number of reference
69  * frames reported by the bitstream.
70  */
71 struct _GstVaapiContextInfo {
72     GstVaapiProfile     profile;
73     GstVaapiEntrypoint  entrypoint;
74     guint               width;
75     guint               height;
76     guint               ref_frames;
77 };
78
79 /**
80  * GstVaapiContext:
81  *
82  * A VA context wrapper.
83  */
84 struct _GstVaapiContext {
85     /*< private >*/
86     GstVaapiObject parent_instance;
87
88     GstVaapiContextPrivate *priv;
89 };
90
91 /**
92  * GstVaapiContextClass:
93  *
94  * A VA context wrapper class.
95  */
96 struct _GstVaapiContextClass {
97     /*< private >*/
98     GstVaapiObjectClass parent_class;
99 };
100
101 GType
102 gst_vaapi_context_get_type(void) G_GNUC_CONST;
103
104 GstVaapiContext *
105 gst_vaapi_context_new(
106     GstVaapiDisplay    *display,
107     GstVaapiProfile     profile,
108     GstVaapiEntrypoint  entrypoint,
109     guint               width,
110     guint               height
111 );
112
113 GstVaapiContext *
114 gst_vaapi_context_new_full(GstVaapiDisplay *display, GstVaapiContextInfo *cip);
115
116 gboolean
117 gst_vaapi_context_reset(
118     GstVaapiContext    *context,
119     GstVaapiProfile     profile,
120     GstVaapiEntrypoint  entrypoint,
121     guint               width,
122     guint               height
123 );
124
125 gboolean
126 gst_vaapi_context_reset_full(GstVaapiContext *context, GstVaapiContextInfo *cip);
127
128 GstVaapiID
129 gst_vaapi_context_get_id(GstVaapiContext *context);
130
131 GstVaapiProfile
132 gst_vaapi_context_get_profile(GstVaapiContext *context);
133
134 gboolean
135 gst_vaapi_context_set_profile(GstVaapiContext *context, GstVaapiProfile profile);
136
137 GstVaapiEntrypoint
138 gst_vaapi_context_get_entrypoint(GstVaapiContext *context);
139
140 void
141 gst_vaapi_context_get_size(
142     GstVaapiContext *context,
143     guint           *pwidth,
144     guint           *pheight
145 );
146
147 GstVaapiSurface *
148 gst_vaapi_context_get_surface(GstVaapiContext *context);
149
150 GstVaapiSurfacePool *
151 gst_vaapi_context_get_surface_pool(GstVaapiContext *context);
152
153
154 guint
155 gst_vaapi_context_get_surface_count(GstVaapiContext *context);
156
157 void
158 gst_vaapi_context_put_surface(GstVaapiContext *context, GstVaapiSurface *surface);
159
160 GstVaapiSurface *
161 gst_vaapi_context_find_surface_by_id(GstVaapiContext *context, GstVaapiID id);
162
163 gboolean
164 gst_vaapi_context_apply_composition(
165     GstVaapiContext            *context,
166     GstVideoOverlayComposition *composition
167 );
168
169 G_END_DECLS
170
171 #endif /* GST_VAAPI_CONTEXT_H */