Tizen 2.0 Release
[framework/multimedia/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapiwindow.h
1 /*
2  *  gstvaapiwindow.h - VA window 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_WINDOW_H
23 #define GST_VAAPI_WINDOW_H
24
25 #include <gst/video/gstvideosink.h>
26 #include <gst/vaapi/gstvaapitypes.h>
27 #include <gst/vaapi/gstvaapiobject.h>
28 #include <gst/vaapi/gstvaapidisplay.h>
29 #include <gst/vaapi/gstvaapisurface.h>
30
31 G_BEGIN_DECLS
32
33 #define GST_VAAPI_TYPE_WINDOW \
34     (gst_vaapi_window_get_type())
35
36 #define GST_VAAPI_WINDOW(obj)                           \
37     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
38                                 GST_VAAPI_TYPE_WINDOW,  \
39                                 GstVaapiWindow))
40
41 #define GST_VAAPI_WINDOW_CLASS(klass)                   \
42     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
43                              GST_VAAPI_TYPE_WINDOW,     \
44                              GstVaapiWindowClass))
45
46 #define GST_VAAPI_IS_WINDOW(obj) \
47     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_WINDOW))
48
49 #define GST_VAAPI_IS_WINDOW_CLASS(klass) \
50     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_WINDOW))
51
52 #define GST_VAAPI_WINDOW_GET_CLASS(obj)                 \
53     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
54                                GST_VAAPI_TYPE_WINDOW,   \
55                                GstVaapiWindowClass))
56
57 typedef struct _GstVaapiWindow                  GstVaapiWindow;
58 typedef struct _GstVaapiWindowPrivate           GstVaapiWindowPrivate;
59 typedef struct _GstVaapiWindowClass             GstVaapiWindowClass;
60
61 /**
62  * GstVaapiWindow:
63  *
64  * Base class for system-dependent windows.
65  */
66 struct _GstVaapiWindow {
67     /*< private >*/
68     GstVaapiObject parent_instance;
69
70     GstVaapiWindowPrivate *priv;
71 };
72
73 /**
74  * GstVaapiWindowClass:
75  * @create: virtual function to create a window with width and height
76  * @destroy: virtual function to destroy a window
77  * @show: virtual function to show (map) a window
78  * @hide: virtual function to hide (unmap) a window
79  * @set_fullscreen: virtual function to change window fullscreen state
80  * @resize: virtual function to resize a window
81  * @render: virtual function to render a #GstVaapiSurface into a window
82  *
83  * Base class for system-dependent windows.
84  */
85 struct _GstVaapiWindowClass {
86     /*< private >*/
87     GstVaapiObjectClass parent_class;
88
89     /*< public >*/
90     gboolean    (*create) (GstVaapiWindow *window, guint *width, guint *height);
91     void        (*destroy)(GstVaapiWindow *window);
92     gboolean    (*show)   (GstVaapiWindow *window);
93     gboolean    (*hide)   (GstVaapiWindow *window);
94     gboolean    (*get_geometry)  (GstVaapiWindow *window,
95                                   gint *px, gint *py,
96                                   guint *pwidth, guint *pheight);
97     gboolean    (*set_fullscreen)(GstVaapiWindow *window, gboolean fullscreen);
98     gboolean    (*resize) (GstVaapiWindow *window, guint width, guint height);
99     gboolean    (*render) (GstVaapiWindow *window,
100                            GstVaapiSurface *surface,
101                            const GstVaapiRectangle *src_rect,
102                            const GstVaapiRectangle *dst_rect,
103                            guint flags);
104 };
105
106 GType
107 gst_vaapi_window_get_type(void) G_GNUC_CONST;
108
109 GstVaapiDisplay *
110 gst_vaapi_window_get_display(GstVaapiWindow *window);
111
112 void
113 gst_vaapi_window_show(GstVaapiWindow *window);
114
115 void
116 gst_vaapi_window_hide(GstVaapiWindow *window);
117
118 gboolean
119 gst_vaapi_window_get_fullscreen(GstVaapiWindow *window);
120
121 void
122 gst_vaapi_window_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen);
123
124 guint
125 gst_vaapi_window_get_width(GstVaapiWindow *window);
126
127 guint
128 gst_vaapi_window_get_height(GstVaapiWindow *window);
129
130 void
131 gst_vaapi_window_get_size(GstVaapiWindow *window, guint *pwidth, guint *pheight);
132
133 void
134 gst_vaapi_window_set_width(GstVaapiWindow *window, guint width);
135
136 void
137 gst_vaapi_window_set_height(GstVaapiWindow *window, guint height);
138
139 void
140 gst_vaapi_window_set_size(GstVaapiWindow *window, guint width, guint height);
141
142 gboolean
143 gst_vaapi_window_put_surface(
144     GstVaapiWindow          *window,
145     GstVaapiSurface         *surface,
146     const GstVaapiRectangle *src_rect,
147     const GstVaapiRectangle *dst_rect,
148     guint                    flags
149 );
150
151 G_END_DECLS
152
153 #endif /* GST_VAAPI_WINDOW_H */