Add gst_vaapi_surface_derive_image() API.
[profile/ivi/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapisurface.h
1 /*
2  *  gstvaapisurface.h - VA surface abstraction
3  *
4  *  gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program 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
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
19  */
20
21 #ifndef GST_VAAPI_SURFACE_H
22 #define GST_VAAPI_SURFACE_H
23
24 #include <gst/vaapi/gstvaapiimage.h>
25 #include <gst/vaapi/gstvaapidisplay.h>
26
27 G_BEGIN_DECLS
28
29 typedef enum _GstVaapiChromaType                GstVaapiChromaType;
30
31 enum _GstVaapiChromaType {
32     GST_VAAPI_CHROMA_TYPE_YUV420 = 1,
33     GST_VAAPI_CHROMA_TYPE_YUV422,
34     GST_VAAPI_CHROMA_TYPE_YUV444
35 };
36
37 #define GST_VAAPI_TYPE_SURFACE \
38     (gst_vaapi_surface_get_type())
39
40 #define GST_VAAPI_SURFACE(obj)                          \
41     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
42                                 GST_VAAPI_TYPE_SURFACE, \
43                                 GstVaapiSurface))
44
45 #define GST_VAAPI_SURFACE_CLASS(klass)                  \
46     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
47                              GST_VAAPI_TYPE_SURFACE,    \
48                              GstVaapiSurfaceClass))
49
50 #define GST_VAAPI_IS_SURFACE(obj) \
51     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_SURFACE))
52
53 #define GST_VAAPI_IS_SURFACE_CLASS(klass) \
54     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_SURFACE))
55
56 #define GST_VAAPI_SURFACE_GET_CLASS(obj)                \
57     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
58                                GST_VAAPI_TYPE_SURFACE,  \
59                                GstVaapiSurfaceClass))
60
61 typedef struct _GstVaapiSurface                 GstVaapiSurface;
62 typedef struct _GstVaapiSurfacePrivate          GstVaapiSurfacePrivate;
63 typedef struct _GstVaapiSurfaceClass            GstVaapiSurfaceClass;
64
65 struct _GstVaapiSurface {
66     /*< private >*/
67     GObject parent_instance;
68
69     GstVaapiSurfacePrivate *priv;
70 };
71
72 struct _GstVaapiSurfaceClass {
73     /*< private >*/
74     GObjectClass parent_class;
75 };
76
77 GType
78 gst_vaapi_surface_get_type(void);
79
80 GstVaapiSurface *
81 gst_vaapi_surface_new(
82     GstVaapiDisplay    *display,
83     GstVaapiChromaType  chroma_type,
84     guint               width,
85     guint               height
86 );
87
88 VASurfaceID
89 gst_vaapi_surface_get_id(GstVaapiSurface *surface);
90
91 GstVaapiDisplay *
92 gst_vaapi_surface_get_display(GstVaapiSurface *surface);
93
94 GstVaapiChromaType
95 gst_vaapi_surface_get_chroma_type(GstVaapiSurface *surface);
96
97 guint
98 gst_vaapi_surface_get_width(GstVaapiSurface *surface);
99
100 guint
101 gst_vaapi_surface_get_height(GstVaapiSurface *surface);
102
103 void
104 gst_vaapi_surface_get_size(
105     GstVaapiSurface *surface,
106     guint           *pwidth,
107     guint           *pheight
108 );
109
110 GstVaapiImage *
111 gst_vaapi_surface_derive_image(GstVaapiSurface *surface);
112
113 gboolean
114 gst_vaapi_surface_get_image(GstVaapiSurface *surface, GstVaapiImage *image);
115
116 gboolean
117 gst_vaapi_surface_put_image(GstVaapiSurface *surface, GstVaapiImage *image);
118
119 gboolean
120 gst_vaapi_surface_sync(GstVaapiSurface *surface);
121
122 G_END_DECLS
123
124 #endif /* GST_VAAPI_SURFACE_H */