Extend GstVaapiImage API with *_get_image(), *_is_linear(), *_get_data_size().
[profile/ivi/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapiimage.h
1 /*
2  *  gstvaapiimage.h - VA image 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_IMAGE_H
22 #define GST_VAAPI_IMAGE_H
23
24 #include <gst/gstbuffer.h>
25 #include <gst/vaapi/gstvaapidisplay.h>
26 #include <gst/vaapi/gstvaapiimageformat.h>
27
28 G_BEGIN_DECLS
29
30 #define GST_VAAPI_TYPE_IMAGE \
31     (gst_vaapi_image_get_type())
32
33 #define GST_VAAPI_IMAGE(obj)                            \
34     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
35                                 GST_VAAPI_TYPE_IMAGE,   \
36                                 GstVaapiImage))
37
38 #define GST_VAAPI_IMAGE_CLASS(klass)                    \
39     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
40                              GST_VAAPI_TYPE_IMAGE,      \
41                              GstVaapiImageClass))
42
43 #define GST_VAAPI_IS_IMAGE(obj) \
44     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_IMAGE))
45
46 #define GST_VAAPI_IS_IMAGE_CLASS(klass) \
47     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_IMAGE))
48
49 #define GST_VAAPI_IMAGE_GET_CLASS(obj)                  \
50     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
51                                GST_VAAPI_TYPE_IMAGE,    \
52                                GstVaapiImageClass))
53
54 #define GST_VAAPI_IMAGE_FORMAT(img)     gst_vaapi_image_get_format(img)
55 #define GST_VAAPI_IMAGE_WIDTH(img)      gst_vaapi_image_get_width(img)
56 #define GST_VAAPI_IMAGE_HEIGHT(img)     gst_vaapi_image_get_height(img)
57
58 typedef struct _GstVaapiImage                   GstVaapiImage;
59 typedef struct _GstVaapiImagePrivate            GstVaapiImagePrivate;
60 typedef struct _GstVaapiImageClass              GstVaapiImageClass;
61
62 struct _GstVaapiImage {
63     /*< private >*/
64     GObject parent_instance;
65
66     GstVaapiImagePrivate *priv;
67 };
68
69 struct _GstVaapiImageClass {
70     /*< private >*/
71     GObjectClass parent_class;
72 };
73
74 GType
75 gst_vaapi_image_get_type(void);
76
77 GstVaapiImage *
78 gst_vaapi_image_new(
79     GstVaapiDisplay    *display,
80     GstVaapiImageFormat format,
81     guint               width,
82     guint               height
83 );
84
85 VAImageID
86 gst_vaapi_image_get_id(GstVaapiImage *image);
87
88 gboolean
89 gst_vaapi_image_get_image(GstVaapiImage *image, VAImage *va_image);
90
91 GstVaapiDisplay *
92 gst_vaapi_image_get_display(GstVaapiImage *image);
93
94 GstVaapiImageFormat
95 gst_vaapi_image_get_format(GstVaapiImage *image);
96
97 guint
98 gst_vaapi_image_get_width(GstVaapiImage *image);
99
100 guint
101 gst_vaapi_image_get_height(GstVaapiImage *image);
102
103 void
104 gst_vaapi_image_get_size(GstVaapiImage *image, guint *pwidth, guint *pheight);
105
106 gboolean
107 gst_vaapi_image_is_linear(GstVaapiImage *image);
108
109 gboolean
110 gst_vaapi_image_is_mapped(GstVaapiImage *image);
111
112 gboolean
113 gst_vaapi_image_map(GstVaapiImage *image);
114
115 gboolean
116 gst_vaapi_image_unmap(GstVaapiImage *image);
117
118 guint
119 gst_vaapi_image_get_plane_count(GstVaapiImage *image);
120
121 guchar *
122 gst_vaapi_image_get_plane(GstVaapiImage *image, guint plane);
123
124 guint
125 gst_vaapi_image_get_pitch(GstVaapiImage *image, guint plane);
126
127 guint
128 gst_vaapi_image_get_data_size(GstVaapiImage *image);
129
130 gboolean
131 gst_vaapi_image_update_from_buffer(GstVaapiImage *image, GstBuffer *buffer);
132
133 G_END_DECLS
134
135 #endif /* GST_VAAPI_IMAGE_H */