6138170a65084e0864bcdf0b8e32e30e88e43274
[profile/ivi/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 enum {
31     GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD       = 1 << 0,
32     GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD    = 1 << 1,
33     GST_VAAPI_PICTURE_STRUCTURE_FRAME           =
34     (
35         GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD |
36         GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD
37     ),
38     GST_VAAPI_COLOR_STANDARD_ITUR_BT_601        = 1 << 2,
39     GST_VAAPI_COLOR_STANDARD_ITUR_BT_709        = 1 << 3,
40 };
41
42 #define GST_VAAPI_TYPE_WINDOW \
43     (gst_vaapi_window_get_type())
44
45 #define GST_VAAPI_WINDOW(obj)                           \
46     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
47                                 GST_VAAPI_TYPE_WINDOW,  \
48                                 GstVaapiWindow))
49
50 #define GST_VAAPI_WINDOW_CLASS(klass)                   \
51     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
52                              GST_VAAPI_TYPE_WINDOW,     \
53                              GstVaapiWindowClass))
54
55 #define GST_VAAPI_IS_WINDOW(obj) \
56     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_WINDOW))
57
58 #define GST_VAAPI_IS_WINDOW_CLASS(klass) \
59     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_WINDOW))
60
61 #define GST_VAAPI_WINDOW_GET_CLASS(obj)                 \
62     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
63                                GST_VAAPI_TYPE_WINDOW,   \
64                                GstVaapiWindowClass))
65
66 typedef struct _GstVaapiWindow                  GstVaapiWindow;
67 typedef struct _GstVaapiWindowPrivate           GstVaapiWindowPrivate;
68 typedef struct _GstVaapiWindowClass             GstVaapiWindowClass;
69
70 /**
71  * GstVaapiWindow:
72  *
73  * Base class for system-dependent windows.
74  */
75 struct _GstVaapiWindow {
76     /*< private >*/
77     GObject parent_instance;
78
79     /*< private >*/
80     GstVaapiWindowPrivate *priv;
81 };
82
83 /**
84  * GstVaapiWindowClass:
85  * @create: virtual function to create a window with width and height
86  * @destroy: virtual function to destroy a window
87  * @show: virtual function to show (map) a window
88  * @hide: virtual function to hide (unmap) a window
89  * @resize: virtual function to resize a window
90  * @render: virtual function to render a #GstVaapiSurface into a window
91  *
92  * Base class for system-dependent windows.
93  */
94 struct _GstVaapiWindowClass {
95     /*< private >*/
96     GObjectClass parent_class;
97
98     gboolean    (*create) (GstVaapiWindow *window, guint *width, guint *height);
99     void        (*destroy)(GstVaapiWindow *window);
100     gboolean    (*show)   (GstVaapiWindow *window);
101     gboolean    (*hide)   (GstVaapiWindow *window);
102     gboolean    (*resize) (GstVaapiWindow *window, guint width, guint height);
103     gboolean    (*render) (GstVaapiWindow *window,
104                            GstVaapiSurface *surface,
105                            const GstVideoRectangle *src_rect,
106                            const GstVideoRectangle *dst_rect,
107                            guint flags);
108 };
109
110 GType
111 gst_vaapi_window_get_type(void);
112
113 void
114 gst_vaapi_window_show(GstVaapiWindow *window);
115
116 void
117 gst_vaapi_window_hide(GstVaapiWindow *window);
118
119 guint
120 gst_vaapi_window_get_width(GstVaapiWindow *window);
121
122 guint
123 gst_vaapi_window_get_height(GstVaapiWindow *window);
124
125 void
126 gst_vaapi_window_get_size(GstVaapiWindow *window, guint *pwidth, guint *pheight);
127
128 void
129 gst_vaapi_window_set_width(GstVaapiWindow *window, guint width);
130
131 void
132 gst_vaapi_window_set_height(GstVaapiWindow *window, guint height);
133
134 void
135 gst_vaapi_window_set_size(GstVaapiWindow *window, guint width, guint height);
136
137 gboolean
138 gst_vaapi_window_put_surface(
139     GstVaapiWindow          *window,
140     GstVaapiSurface         *surface,
141     const GstVideoRectangle *src_rect,
142     const GstVideoRectangle *dst_rect,
143     guint                    flags
144 );
145
146 G_END_DECLS
147
148 #endif /* GST_VAAPI_WINDOW_H */