1 /*
2  *  gstvaapiutils.h - VA-API utilities
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *    Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
6  *  Copyright (C) 2011-2013 Intel Corporation
7  *    Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
8  *
9  *  This library is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU Lesser General Public License
11  *  as published by the Free Software Foundation; either version 2.1
12  *  of the License, or (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *  Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public
20  *  License along with this library; if not, write to the Free
21  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  *  Boston, MA 02110-1301 USA
23  */
24 
25 #ifndef GST_VAAPI_UTILS_H
26 #define GST_VAAPI_UTILS_H
27 
28 #include <glib.h>
29 #include <va/va.h>
30 
31 /** calls vaInitialize() redirecting the logging mechanism */
32 G_GNUC_INTERNAL
33 gboolean
34 vaapi_initialize (VADisplay dpy);
35 
36 /** Check VA status for success or print out an error */
37 G_GNUC_INTERNAL
38 gboolean
39 vaapi_check_status (VAStatus status, const gchar *msg);
40 
41 /** Maps VA buffer */
42 G_GNUC_INTERNAL
43 gpointer
44 vaapi_map_buffer (VADisplay dpy, VABufferID buf_id);
45 
46 /** Unmaps VA buffer */
47 G_GNUC_INTERNAL
48 void
49 vaapi_unmap_buffer (VADisplay dpy, VABufferID buf_id, void **pbuf);
50 
51 /** Creates and maps VA buffer */
52 G_GNUC_INTERNAL
53 gboolean
54 vaapi_create_buffer (VADisplay dpy, VAContextID ctx, int type, guint size,
55     gconstpointer data, VABufferID * buf_id, gpointer * mapped_data);
56 
57 /** Destroy VA buffer */
58 G_GNUC_INTERNAL
59 void
60 vaapi_destroy_buffer (VADisplay dpy, VABufferID * buf_id);
61 
62 /** Return a string representation of a VAProfile */
63 G_GNUC_INTERNAL
64 const gchar *
65 string_of_VAProfile (VAProfile profile);
66 
67 /** Return a string representation of a VAEntrypoint */
68 G_GNUC_INTERNAL
69 const gchar *
70 string_of_VAEntrypoint (VAEntrypoint entrypoint);
71 
72 /* Return a string representation of a VADisplayAttributeType */
73 G_GNUC_INTERNAL
74 const gchar *
75 string_of_VADisplayAttributeType (VADisplayAttribType attribute_type);
76 
77 /* Return a string representation of a VA chroma format */
78 G_GNUC_INTERNAL
79 const gchar *
80 string_of_va_chroma_format (guint chroma_format);
81 
82 G_GNUC_INTERNAL
83 const gchar *
84 string_of_VARateControl (guint rate_control);
85 
86 G_GNUC_INTERNAL
87 guint
88 to_GstVaapiChromaType (guint va_rt_format);
89 
90 G_GNUC_INTERNAL
91 guint
92 from_GstVaapiChromaType (guint chroma_type);
93 
94 G_GNUC_INTERNAL
95 guint
96 from_GstVaapiSubpictureFlags (guint flags);
97 
98 G_GNUC_INTERNAL
99 guint
100 to_GstVaapiSubpictureFlags (guint va_flags);
101 
102 G_GNUC_INTERNAL
103 guint
104 from_GstVideoOverlayFormatFlags (guint ovl_flags);
105 
106 G_GNUC_INTERNAL
107 guint
108 to_GstVideoOverlayFormatFlags (guint flags);
109 
110 G_GNUC_INTERNAL
111 guint
112 from_GstVaapiSurfaceRenderFlags (guint flags);
113 
114 G_GNUC_INTERNAL
115 guint
116 to_GstVaapiSurfaceStatus (guint va_flags);
117 
118 G_GNUC_INTERNAL
119 guint
120 from_GstVaapiRotation (guint value);
121 
122 G_GNUC_INTERNAL
123 guint
124 to_GstVaapiRotation (guint value);
125 
126 G_GNUC_INTERNAL
127 guint
128 from_GstVaapiRateControl (guint value);
129 
130 G_GNUC_INTERNAL
131 guint
132 to_GstVaapiRateControl (guint value);
133 
134 G_GNUC_INTERNAL
135 guint
136 from_GstVaapiDeinterlaceMethod (guint value);
137 
138 G_GNUC_INTERNAL
139 guint
140 from_GstVaapiDeinterlaceFlags (guint flags);
141 
142 G_GNUC_INTERNAL
143 guint
144 from_GstVaapiScaleMethod (guint value);
145 
146 G_GNUC_INTERNAL
147 guint
148 to_GstVaapiScaleMethod (guint flags);
149 
150 #endif /* GST_VAAPI_UTILS_H */
151