x11: implement pixmap API.
[platform/upstream/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapidisplay_x11_priv.h
1 /*
2  *  gstvaapidisplay_x11_priv.h - Internal VA/X11 interface
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *  Copyright (C) 2012 Intel Corporation
6  *
7  *  This library is free software; you can redistribute it and/or
8  *  modify it under the terms of the GNU Lesser General Public License
9  *  as published by the Free Software Foundation; either version 2.1
10  *  of the License, or (at your option) any later version.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public
18  *  License along with this library; if not, write to the Free
19  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  *  Boston, MA 02110-1301 USA
21  */
22
23 #ifndef GST_VAAPI_DISPLAY_X11_PRIV_H
24 #define GST_VAAPI_DISPLAY_X11_PRIV_H
25
26 #include <gst/vaapi/gstvaapiutils_x11.h>
27 #include <gst/vaapi/gstvaapidisplay_x11.h>
28 #include "gstvaapidisplay_priv.h"
29
30 G_BEGIN_DECLS
31
32 #define GST_VAAPI_IS_DISPLAY_X11(display)                               \
33     ((display) != NULL &&                                               \
34      (GST_VAAPI_DISPLAY_TYPE(display) == GST_VAAPI_DISPLAY_TYPE_X11 ||  \
35       GST_VAAPI_DISPLAY_TYPE(display) == GST_VAAPI_DISPLAY_TYPE_GLX))
36
37 #define GST_VAAPI_DISPLAY_X11_CAST(display) \
38     ((GstVaapiDisplayX11 *)(display))
39
40 #define GST_VAAPI_DISPLAY_X11_PRIVATE(display) \
41     (&GST_VAAPI_DISPLAY_X11_CAST(display)->priv)
42
43 typedef struct _GstVaapiDisplayX11Private       GstVaapiDisplayX11Private;
44 typedef struct _GstVaapiDisplayX11Class         GstVaapiDisplayX11Class;
45
46 /**
47  * GST_VAAPI_DISPLAY_XDISPLAY:
48  * @display: a #GstVaapiDisplay
49  *
50  * Macro that evaluates to the underlying X11 #Display of @display
51  */
52 #undef  GST_VAAPI_DISPLAY_XDISPLAY
53 #define GST_VAAPI_DISPLAY_XDISPLAY(display) \
54     GST_VAAPI_DISPLAY_X11_PRIVATE(display)->x11_display
55
56 /**
57  * GST_VAAPI_DISPLAY_XSCREEN:
58  * @display: a #GstVaapiDisplay
59  *
60  * Macro that evaluates to the underlying X11 screen of @display
61  */
62 #undef  GST_VAAPI_DISPLAY_XSCREEN
63 #define GST_VAAPI_DISPLAY_XSCREEN(display) \
64     GST_VAAPI_DISPLAY_X11_PRIVATE(display)->x11_screen
65
66 struct _GstVaapiDisplayX11Private {
67     gchar              *display_name;
68     Display            *x11_display;
69     int                 x11_screen;
70     GArray             *pixmap_formats;
71     guint               use_foreign_display     : 1; // Foreign native_display?
72     guint               use_xrandr              : 1;
73     guint               synchronous             : 1;
74 };
75
76 /**
77  * GstVaapiDisplayX11:
78  *
79  * VA/X11 display wrapper.
80  */
81 struct _GstVaapiDisplayX11 {
82     /*< private >*/
83     GstVaapiDisplay parent_instance;
84
85     GstVaapiDisplayX11Private priv;
86 };
87
88 /**
89  * GstVaapiDisplayX11Class:
90  *
91  * VA/X11 display wrapper clas.
92  */
93 struct _GstVaapiDisplayX11Class {
94     /*< private >*/
95     GstVaapiDisplayClass parent_class;
96 };
97
98 void
99 gst_vaapi_display_x11_class_init(GstVaapiDisplayX11Class *klass);
100
101 G_GNUC_INTERNAL
102 GstVideoFormat
103 gst_vaapi_display_x11_get_pixmap_format(GstVaapiDisplayX11 *display,
104     guint depth);
105
106 G_GNUC_INTERNAL
107 guint
108 gst_vaapi_display_x11_get_pixmap_depth(GstVaapiDisplayX11 *display,
109     GstVideoFormat format);
110
111 G_END_DECLS
112
113 #endif /* GST_VAAPI_DISPLAY_X11_PRIV_H */