Add display size accessors.
[profile/ivi/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapidisplay.h
1 /*
2  *  gstvaapidisplay.h - VA display 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_DISPLAY_H
22 #define GST_VAAPI_DISPLAY_H
23
24 #include <va/va.h>
25 #include <gst/gst.h>
26 #include <gst/vaapi/gstvaapiimageformat.h>
27
28 G_BEGIN_DECLS
29
30 #define GST_VAAPI_TYPE_DISPLAY \
31     (gst_vaapi_display_get_type())
32
33 #define GST_VAAPI_DISPLAY(obj)                          \
34     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
35                                 GST_VAAPI_TYPE_DISPLAY, \
36                                 GstVaapiDisplay))
37
38 #define GST_VAAPI_DISPLAY_CLASS(klass)                  \
39     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
40                              GST_VAAPI_TYPE_DISPLAY,    \
41                              GstVaapiDisplayClass))
42
43 #define GST_VAAPI_IS_DISPLAY(obj) \
44     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_DISPLAY))
45
46 #define GST_VAAPI_IS_DISPLAY_CLASS(klass) \
47     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_DISPLAY))
48
49 #define GST_VAAPI_DISPLAY_GET_CLASS(obj)                \
50     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
51                                GST_VAAPI_TYPE_DISPLAY,  \
52                                GstVaapiDisplayClass))
53
54 /**
55  * GST_VAAPI_DISPLAY_VADISPLAY:
56  * @display: a #GstVaapiDisplay
57  *
58  * Macro that evaluates to the #VADisplay bound to @display
59  */
60 #define GST_VAAPI_DISPLAY_VADISPLAY(display) \
61     gst_vaapi_display_get_display(display)
62
63 /**
64  * GST_VAAPI_DISPLAY_LOCK:
65  * @display: a #GstVaapiDisplay
66  *
67  * Locks @display
68  */
69 #define GST_VAAPI_DISPLAY_LOCK(display) \
70     gst_vaapi_display_lock(display)
71
72 /**
73  * GST_VAAPI_DISPLAY_UNLOCK:
74  * @display: a #GstVaapiDisplay
75  *
76  * Unlocks @display
77  */
78 #define GST_VAAPI_DISPLAY_UNLOCK(display) \
79     gst_vaapi_display_unlock(display)
80
81 typedef struct _GstVaapiDisplay                 GstVaapiDisplay;
82 typedef struct _GstVaapiDisplayPrivate          GstVaapiDisplayPrivate;
83 typedef struct _GstVaapiDisplayClass            GstVaapiDisplayClass;
84
85 /**
86  * GstVaapiDisplay:
87  *
88  * Base class for VA displays.
89  */
90 struct _GstVaapiDisplay {
91     /*< private >*/
92     GObject parent_instance;
93
94     GstVaapiDisplayPrivate *priv;
95 };
96
97 /**
98  * GstVaapiDisplayClass:
99  * @open_display: virtual function to open a display
100  * @close_display: virtual function to close a display
101  * @lock_display: virtual function to lock a display
102  * @unlock_display: virtual function to unlock a display
103  * @get_display: virtual function to retrieve the #VADisplay
104  * @get_size: virtual function to retrieve the display dimensions
105  *
106  * Base class for VA displays.
107  */
108 struct _GstVaapiDisplayClass {
109     /*< private >*/
110     GObjectClass parent_class;
111
112     /*< public >*/
113     gboolean   (*open_display)  (GstVaapiDisplay *display);
114     void       (*close_display) (GstVaapiDisplay *display);
115     void       (*lock_display)  (GstVaapiDisplay *display);
116     void       (*unlock_display)(GstVaapiDisplay *display);
117     VADisplay  (*get_display)   (GstVaapiDisplay *display);
118     void       (*get_size)      (GstVaapiDisplay *display, guint *pw, guint *ph);
119 };
120
121 GType
122 gst_vaapi_display_get_type(void);
123
124 GstVaapiDisplay *
125 gst_vaapi_display_new_with_display(VADisplay va_display);
126
127 void
128 gst_vaapi_display_lock(GstVaapiDisplay *display);
129
130 void
131 gst_vaapi_display_unlock(GstVaapiDisplay *display);
132
133 VADisplay
134 gst_vaapi_display_get_display(GstVaapiDisplay *display);
135
136 guint
137 gst_vaapi_display_get_width(GstVaapiDisplay *display);
138
139 guint
140 gst_vaapi_display_get_height(GstVaapiDisplay *display);
141
142 void
143 gst_vaapi_display_get_size(GstVaapiDisplay *display, guint *pwidth, guint *pheight);
144
145 gboolean
146 gst_vaapi_display_has_profile(GstVaapiDisplay *display, VAProfile profile);
147
148 GstCaps *
149 gst_vaapi_display_get_image_caps(GstVaapiDisplay *display);
150
151 gboolean
152 gst_vaapi_display_has_image_format(
153     GstVaapiDisplay    *display,
154     GstVaapiImageFormat format
155 );
156
157 GstCaps *
158 gst_vaapi_display_get_subpicture_caps(GstVaapiDisplay *display);
159
160 gboolean
161 gst_vaapi_display_has_subpicture_format(
162     GstVaapiDisplay    *display,
163     GstVaapiImageFormat format
164 );
165
166 G_END_DECLS
167
168 #endif /* GST_VAAPI_DISPLAY_H */