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