vdpau_sys/
vdpau.rs

1use crate::libc;
2
3
4pub const VDP_TRUE: libc::c_uint = 1;
5pub const VDP_FALSE: libc::c_uint = 0;
6pub const VDP_INVALID_HANDLE: libc::c_uint = 4294967295;
7pub const VDPAU_INTERFACE_VERSION: libc::c_uint = 1;
8pub const VDPAU_VERSION: libc::c_uint = 1;
9pub const VDP_PROCAMP_VERSION: libc::c_uint = 0;
10pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION: libc::c_uint = 0;
11pub const VDP_OUTPUT_SURFACE_RENDER_ROTATE_0: libc::c_uint = 0;
12pub const VDP_OUTPUT_SURFACE_RENDER_ROTATE_90: libc::c_uint = 1;
13pub const VDP_OUTPUT_SURFACE_RENDER_ROTATE_180: libc::c_uint = 2;
14pub const VDP_OUTPUT_SURFACE_RENDER_ROTATE_270: libc::c_uint = 3;
15pub const VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX: libc::c_uint = 4;
16pub const VDP_DECODER_LEVEL_MPEG1_NA: libc::c_uint = 0;
17pub const VDP_DECODER_LEVEL_MPEG2_LL: libc::c_uint = 0;
18pub const VDP_DECODER_LEVEL_MPEG2_ML: libc::c_uint = 1;
19pub const VDP_DECODER_LEVEL_MPEG2_HL14: libc::c_uint = 2;
20pub const VDP_DECODER_LEVEL_MPEG2_HL: libc::c_uint = 3;
21pub const VDP_DECODER_LEVEL_H264_1: libc::c_uint = 10;
22pub const VDP_DECODER_LEVEL_H264_1b: libc::c_uint = 9;
23pub const VDP_DECODER_LEVEL_H264_1_1: libc::c_uint = 11;
24pub const VDP_DECODER_LEVEL_H264_1_2: libc::c_uint = 12;
25pub const VDP_DECODER_LEVEL_H264_1_3: libc::c_uint = 13;
26pub const VDP_DECODER_LEVEL_H264_2: libc::c_uint = 20;
27pub const VDP_DECODER_LEVEL_H264_2_1: libc::c_uint = 21;
28pub const VDP_DECODER_LEVEL_H264_2_2: libc::c_uint = 22;
29pub const VDP_DECODER_LEVEL_H264_3: libc::c_uint = 30;
30pub const VDP_DECODER_LEVEL_H264_3_1: libc::c_uint = 31;
31pub const VDP_DECODER_LEVEL_H264_3_2: libc::c_uint = 32;
32pub const VDP_DECODER_LEVEL_H264_4: libc::c_uint = 40;
33pub const VDP_DECODER_LEVEL_H264_4_1: libc::c_uint = 41;
34pub const VDP_DECODER_LEVEL_H264_4_2: libc::c_uint = 42;
35pub const VDP_DECODER_LEVEL_H264_5: libc::c_uint = 50;
36pub const VDP_DECODER_LEVEL_H264_5_1: libc::c_uint = 51;
37pub const VDP_DECODER_LEVEL_VC1_SIMPLE_LOW: libc::c_uint = 0;
38pub const VDP_DECODER_LEVEL_VC1_SIMPLE_MEDIUM: libc::c_uint = 1;
39pub const VDP_DECODER_LEVEL_VC1_MAIN_LOW: libc::c_uint = 0;
40pub const VDP_DECODER_LEVEL_VC1_MAIN_MEDIUM: libc::c_uint = 1;
41pub const VDP_DECODER_LEVEL_VC1_MAIN_HIGH: libc::c_uint = 2;
42pub const VDP_DECODER_LEVEL_VC1_ADVANCED_L0: libc::c_uint = 0;
43pub const VDP_DECODER_LEVEL_VC1_ADVANCED_L1: libc::c_uint = 1;
44pub const VDP_DECODER_LEVEL_VC1_ADVANCED_L2: libc::c_uint = 2;
45pub const VDP_DECODER_LEVEL_VC1_ADVANCED_L3: libc::c_uint = 3;
46pub const VDP_DECODER_LEVEL_VC1_ADVANCED_L4: libc::c_uint = 4;
47pub const VDP_DECODER_LEVEL_MPEG4_PART2_SP_L0: libc::c_uint = 0;
48pub const VDP_DECODER_LEVEL_MPEG4_PART2_SP_L1: libc::c_uint = 1;
49pub const VDP_DECODER_LEVEL_MPEG4_PART2_SP_L2: libc::c_uint = 2;
50pub const VDP_DECODER_LEVEL_MPEG4_PART2_SP_L3: libc::c_uint = 3;
51pub const VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L0: libc::c_uint = 0;
52pub const VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L1: libc::c_uint = 1;
53pub const VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L2: libc::c_uint = 2;
54pub const VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L3: libc::c_uint = 3;
55pub const VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L4: libc::c_uint = 4;
56pub const VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L5: libc::c_uint = 5;
57pub const VDP_DECODER_LEVEL_DIVX_NA: libc::c_uint = 0;
58pub const VDP_BITSTREAM_BUFFER_VERSION: libc::c_uint = 0;
59pub const VDP_LAYER_VERSION: libc::c_uint = 0;
60pub const VDP_FUNC_ID_BASE_WINSYS: libc::c_uint = 4096;
61
62
63/// \brief A boolean value, holding \ref VDP_TRUE or \ref
64/// VDP_FALSE.
65pub type VdpBool = libc::c_int;
66/// \brief The set of all chroma formats for \ref VdpVideoSurface
67/// "VdpVideoSurface"s.
68pub type VdpChromaType = u32;
69/// \brief The set of all known YCbCr surface formats.
70pub type VdpYCbCrFormat = u32;
71/// \brief  The set of all known RGB surface formats.
72pub type VdpRGBAFormat = u32;
73/// \brief  The set of all known indexed surface formats.
74pub type VdpIndexedFormat = u32;
75/// \brief A location within a surface.
76///
77/// The VDPAU co-ordinate system has its origin at the top-left
78/// of a surface, with x and y components increasing right and
79/// down.
80#[repr(C)]
81#[derive(Debug, Copy, Clone)]
82pub struct VdpPoint {
83    /// X co-ordinate.
84    pub x: u32,
85    /// Y co-ordinate.
86    pub y: u32,
87}
88/// \brief A rectangular region of a surface.
89///
90/// The co-ordinates are top-left inclusive, bottom-right
91/// exclusive.
92///
93/// The VDPAU co-ordinate system has its origin at the top-left
94/// of a surface, with x and y components increasing right and
95/// down.
96#[repr(C)]
97#[derive(Debug, Copy, Clone)]
98pub struct VdpRect {
99    /// Left X co-ordinate. Inclusive.
100    pub x0: u32,
101    /// Top Y co-ordinate. Inclusive.
102    pub y0: u32,
103    /// Right X co-ordinate. Exclusive.
104    pub x1: u32,
105    /// Bottom Y co-ordinate. Exclusive.
106    pub y1: u32,
107}
108/// A constant RGBA color.
109///
110/// Note that the components are stored as float values in the
111/// range 0.0...1.0 rather than format-specific integer values.
112/// This allows VdpColor values to be independent from the exact
113/// surface format(s) in use.
114#[repr(C)]
115#[derive(Debug, Copy, Clone)]
116pub struct VdpColor {
117    pub red: f32,
118    pub green: f32,
119    pub blue: f32,
120    pub alpha: f32,
121}
122pub const VDP_STATUS_OK: VdpStatus = 0;
123pub const VDP_STATUS_NO_IMPLEMENTATION: VdpStatus = 1;
124pub const VDP_STATUS_DISPLAY_PREEMPTED: VdpStatus = 2;
125pub const VDP_STATUS_INVALID_HANDLE: VdpStatus = 3;
126pub const VDP_STATUS_INVALID_POINTER: VdpStatus = 4;
127pub const VDP_STATUS_INVALID_CHROMA_TYPE: VdpStatus = 5;
128pub const VDP_STATUS_INVALID_Y_CB_CR_FORMAT: VdpStatus = 6;
129pub const VDP_STATUS_INVALID_RGBA_FORMAT: VdpStatus = 7;
130pub const VDP_STATUS_INVALID_INDEXED_FORMAT: VdpStatus = 8;
131pub const VDP_STATUS_INVALID_COLOR_STANDARD: VdpStatus = 9;
132pub const VDP_STATUS_INVALID_COLOR_TABLE_FORMAT: VdpStatus = 10;
133pub const VDP_STATUS_INVALID_BLEND_FACTOR: VdpStatus = 11;
134pub const VDP_STATUS_INVALID_BLEND_EQUATION: VdpStatus = 12;
135pub const VDP_STATUS_INVALID_FLAG: VdpStatus = 13;
136pub const VDP_STATUS_INVALID_DECODER_PROFILE: VdpStatus = 14;
137pub const VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE: VdpStatus = 15;
138pub const VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER: VdpStatus = 16;
139pub const VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE: VdpStatus = 17;
140pub const VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE: VdpStatus = 18;
141pub const VDP_STATUS_INVALID_FUNC_ID: VdpStatus = 19;
142pub const VDP_STATUS_INVALID_SIZE: VdpStatus = 20;
143pub const VDP_STATUS_INVALID_VALUE: VdpStatus = 21;
144pub const VDP_STATUS_INVALID_STRUCT_VERSION: VdpStatus = 22;
145pub const VDP_STATUS_RESOURCES: VdpStatus = 23;
146pub const VDP_STATUS_HANDLE_DEVICE_MISMATCH: VdpStatus = 24;
147pub const VDP_STATUS_ERROR: VdpStatus = 25;
148pub type VdpStatus = libc::c_uint;
149/// \brief Retrieve a string describing an error code.
150/// \param[in] status The error code.
151/// \return A pointer to the string. Note that this is a
152/// statically allocated read-only string. As such, the
153/// application must not free the returned pointer. The
154/// pointer is valid as long as the VDPAU implementation is
155/// present within the application's address space.
156pub type VdpGetErrorString =
157    Option<unsafe extern "C" fn(status: VdpStatus) -> *const libc::c_char>;
158/// \brief Retrieve the VDPAU version implemented by the backend.
159/// \param[out] api_version The API version.
160/// \return VdpStatus The completion status of the operation.
161pub type VdpGetApiVersion =
162    Option<unsafe extern "C" fn(api_version: *mut u32) -> VdpStatus>;
163/// \brief Retrieve an implementation-specific string description
164/// of the implementation. This typically includes detailed version
165/// information.
166/// \param[out] information_string A pointer to the information
167/// string. Note that this is a statically allocated
168/// read-only string. As such, the application must not
169/// free the returned pointer. The pointer is valid as long
170/// as the implementation is present within the
171/// application's address space.
172/// \return VdpStatus The completion status of the operation.
173///
174/// Note that the returned string is useful for information
175/// reporting. It is not intended that the application should
176/// parse this string in order to determine any information about
177/// the implementation.
178pub type VdpGetInformationString = Option<
179    unsafe extern "C" fn(information_string: *mut *const libc::c_char) -> VdpStatus,
180>;
181/// \brief  An opaque handle representing a VdpDevice object.
182pub type VdpDevice = u32;
183/// \brief Destroy a VdpDevice.
184/// \param[in] device The device to destroy.
185/// \return VdpStatus The completion status of the operation.
186pub type VdpDeviceDestroy =
187    Option<unsafe extern "C" fn(device: VdpDevice) -> VdpStatus>;
188/// \brief Storage for a color space conversion matrix.
189///
190/// Note that the application may choose to construct the matrix
191/// content by either:
192/// - Directly filling in the fields of the CSC matrix
193/// - Using the \ref VdpGenerateCSCMatrix helper function.
194///
195/// The color space conversion equation is as follows:
196///
197/// \f[
198/// \left( \begin{array}{c} R \\ G \\ B \end{array} \right)
199/// =
200/// \left( \begin{array}{cccc}
201/// m_{0,0} & m_{0,1} & m_{0,2} & m_{0,3} \\
202/// m_{1,0} & m_{1,1} & m_{1,2} & m_{1,3} \\
203/// m_{2,0} & m_{2,1} & m_{2,2} & m_{2,3}
204/// \end{array}
205/// \right)
206/// *
207/// \left( \begin{array}{c} Y \\ Cb \\ Cr \\ 1.0 \end{array}
208/// \right)
209/// \f]
210pub type VdpCSCMatrix = [[f32; 4usize]; 3usize];
211/// \brief Procamp operation parameterization data.
212///
213/// When performing a color space conversion operation, various
214/// adjustments can be performed at the same time, such as
215/// brightness and contrast. This structure defines the level of
216/// adjustments to make.
217#[repr(C)]
218#[derive(Debug, Copy, Clone)]
219pub struct VdpProcamp {
220    /// This field must be filled with VDP_PROCAMP_VERSION
221    pub struct_version: u32,
222    /// Brightness adjustment amount. A value clamped between
223    /// -1.0 and 1.0. 0.0 represents no modification.
224    pub brightness: f32,
225    /// Contrast adjustment amount. A value clamped between
226    /// 0.0 and 10.0. 1.0 represents no modification.
227    pub contrast: f32,
228    /// Saturation adjustment amount. A value clamped between 0.0 and
229    /// 10.0. 1.0 represents no modification.
230    pub saturation: f32,
231    /// Hue adjustment amount. A value clamped between
232    /// -PI and PI. 0.0 represents no modification.
233    pub hue: f32,
234}
235/// \brief YCbCr color space specification.
236///
237/// A number of YCbCr color spaces exist. This enumeration
238/// defines the specifications known to VDPAU.
239pub type VdpColorStandard = u32;
240/// \brief Generate a color space conversion matrix
241/// \param[in] procamp The procamp adjustments to make. If NULL,
242/// no adjustments will be made.
243/// \param[in] standard The YCbCr color space to convert from.
244/// \param[out] csc_matrix The CSC matrix to initialize.
245/// \return VdpStatus The completion status of the operation.
246pub type VdpGenerateCSCMatrix = Option<
247    unsafe extern "C" fn(
248        procamp: *mut VdpProcamp,
249        standard: VdpColorStandard,
250        csc_matrix: *mut VdpCSCMatrix,
251    ) -> VdpStatus,
252>;
253/// \brief Query the implementation's VdpVideoSurface
254/// capabilities.
255/// \param[in] device The device to query.
256/// \param[in] surface_chroma_type The type of chroma type for
257/// which information is requested.
258/// \param[out] is_supported Is this chroma type supported?
259/// \param[out] max_width The maximum supported surface width for
260/// this chroma type.
261/// \param[out] max_height The maximum supported surface height
262/// for this chroma type.
263/// \return VdpStatus The completion status of the operation.
264pub type VdpVideoSurfaceQueryCapabilities = Option<
265    unsafe extern "C" fn(
266        device: VdpDevice,
267        surface_chroma_type: VdpChromaType,
268        is_supported: *mut VdpBool,
269        max_width: *mut u32,
270        max_height: *mut u32,
271    ) -> VdpStatus,
272>;
273/// \brief Query the implementation's VdpVideoSurface
274/// GetBits/PutBits capabilities.
275/// \param[in] device The device to query.
276/// \param[in] surface_chroma_type The type of chroma type for
277/// which information is requested.
278/// \param[in] bits_ycbcr_format The format of application "bits"
279/// buffer for which information is requested.
280/// \param[out] is_supported Is this chroma type supported?
281/// \return VdpStatus The completion status of the operation.
282pub type VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities = Option<
283    unsafe extern "C" fn(
284        device: VdpDevice,
285        surface_chroma_type: VdpChromaType,
286        bits_ycbcr_format: VdpYCbCrFormat,
287        is_supported: *mut VdpBool,
288    ) -> VdpStatus,
289>;
290/// \brief An opaque handle representing a VdpVideoSurface
291/// object.
292pub type VdpVideoSurface = u32;
293/// \brief Create a VdpVideoSurface.
294/// \param[in] device The device that will contain the surface.
295/// \param[in] chroma_type The chroma type of the new surface.
296/// \param[in] width The width of the new surface.
297/// \param[in] height The height of the new surface.
298/// \param[out] surface The new surface's handle.
299/// \return VdpStatus The completion status of the operation.
300///
301/// The memory backing the surface may not be initialized during
302/// creation. Applications are expected to initialize any region
303/// that they use, via \ref VdpDecoderRender or \ref
304/// VdpVideoSurfacePutBitsYCbCr.
305///
306/// Note that certain widths/heights are impossible for specific values of
307/// chroma_type. For example, the definition of VDP_CHROMA_TYPE_420 implies
308/// that the width must be even, since each single chroma sample covers two
309/// luma samples horizontally. A similar argument applies to surface heights,
310/// although doubly so, since interlaced pictures must be supported; each
311/// field's height must itself be a multiple of 2. Hence the overall surface's
312/// height must be a multiple of 4.
313///
314/// Similar rules apply to other chroma_type values.
315///
316/// Implementations may also impose additional restrictions on the surface
317/// sizes they support, potentially requiring additional rounding of actual
318/// surface sizes.
319///
320/// In most cases, this is not an issue, since:
321/// - Video streams are encoded as an array of macro-blocks, which typically
322/// have larger size alignment requirements than video surfaces do.
323/// - APIs such as \ref VdpVideoMixerRender allow specification of a sub-region
324/// of the surface to read, which allows the padding data to be clipped away.
325///
326/// However, other APIs such as \ref VdpVideoSurfaceGetBitsYCbCr and
327/// \ref VdpVideoSurfacePutBitsYCbCr do not allow a sub-region to be specified,
328/// and always operate on surface size that was actually allocated, rather
329/// than the surface size that was requested. In this case, applications need
330/// to be aware of the actual surface size, in order to allocate appropriately
331/// sized buffers for the get-/put-bits operations.
332///
333/// For this reason, applications may need to call
334/// \ref VdpVideoSurfaceGetParameters after creation, in order to retrieve the
335/// actual surface size.
336pub type VdpVideoSurfaceCreate = Option<
337    unsafe extern "C" fn(
338        device: VdpDevice,
339        chroma_type: VdpChromaType,
340        width: u32,
341        height: u32,
342        surface: *mut VdpVideoSurface,
343    ) -> VdpStatus,
344>;
345/// \brief Destroy a VdpVideoSurface.
346/// \param[in] surface The surface's handle.
347/// \return VdpStatus The completion status of the operation.
348pub type VdpVideoSurfaceDestroy =
349    Option<unsafe extern "C" fn(surface: VdpVideoSurface) -> VdpStatus>;
350/// \brief Retrieve the parameters used to create a
351/// VdpVideoSurface.
352/// \param[in] surface The surface's handle.
353/// \param[out] chroma_type The chroma type of the surface.
354/// \param[out] width The width of the surface.
355/// \param[out] height The height of the surface.
356/// \return VdpStatus The completion status of the operation.
357pub type VdpVideoSurfaceGetParameters = Option<
358    unsafe extern "C" fn(
359        surface: VdpVideoSurface,
360        chroma_type: *mut VdpChromaType,
361        width: *mut u32,
362        height: *mut u32,
363    ) -> VdpStatus,
364>;
365/// \brief Copy image data from a VdpVideoSurface to application
366/// memory in a specified YCbCr format.
367/// \param[in] surface The surface's handle.
368/// \param[in] destination_ycbcr_format The format of the
369/// application's data buffers.
370/// \param[in] destination_data Pointers to the application data
371/// buffers into which the image data will be written. Note
372/// that this is an array of pointers, one per plane. The
373/// destination_format parameter will define how many
374/// planes are required.
375/// \param[in] destination_pitches Pointers to the pitch values
376/// for the application data buffers. Note that this is an
377/// array of pointers, one per plane. The
378/// destination_format parameter will define how many
379/// planes are required.
380/// \return VdpStatus The completion status of the operation.
381pub type VdpVideoSurfaceGetBitsYCbCr = Option<
382    unsafe extern "C" fn(
383        surface: VdpVideoSurface,
384        destination_ycbcr_format: VdpYCbCrFormat,
385        destination_data: *const *const libc::c_void,
386        destination_pitches: *const u32,
387    ) -> VdpStatus,
388>;
389/// \brief Copy image data from application memory in a specific
390/// YCbCr format to a VdpVideoSurface.
391/// \param[in] surface The surface's handle.
392/// \param[in] source_ycbcr_format The format of the
393/// application's data buffers.
394/// \param[in] source_data Pointers to the application data
395/// buffers from which the image data will be copied. Note
396/// that this is an array of pointers, one per plane. The
397/// source_format parameter will define how many
398/// planes are required.
399/// \param[in] source_pitches Pointers to the pitch values
400/// for the application data buffers. Note that this is an
401/// array of pointers, one per plane. The
402/// source_format parameter will define how many
403/// planes are required.
404/// \return VdpStatus The completion status of the operation.
405pub type VdpVideoSurfacePutBitsYCbCr = Option<
406    unsafe extern "C" fn(
407        surface: VdpVideoSurface,
408        source_ycbcr_format: VdpYCbCrFormat,
409        source_data: *const *const libc::c_void,
410        source_pitches: *const u32,
411    ) -> VdpStatus,
412>;
413/// \brief The set of all known color table formats, for use with
414/// \ref VdpOutputSurfacePutBitsIndexed.
415pub type VdpColorTableFormat = u32;
416/// \brief Query the implementation's VdpOutputSurface
417/// capabilities.
418/// \param[in] device The device to query.
419/// \param[in] surface_rgba_format The surface format for
420/// which information is requested.
421/// \param[out] is_supported Is this surface format supported?
422/// \param[out] max_width The maximum supported surface width for
423/// this chroma type.
424/// \param[out] max_height The maximum supported surface height
425/// for this chroma type.
426/// \return VdpStatus The completion status of the operation.
427pub type VdpOutputSurfaceQueryCapabilities = Option<
428    unsafe extern "C" fn(
429        device: VdpDevice,
430        surface_rgba_format: VdpRGBAFormat,
431        is_supported: *mut VdpBool,
432        max_width: *mut u32,
433        max_height: *mut u32,
434    ) -> VdpStatus,
435>;
436/// \brief Query the implementation's capability to perform a
437/// PutBits operation using application data matching the
438/// surface's format.
439/// \param[in] device The device to query.
440/// \param[in] surface_rgba_format The surface format for
441/// which information is requested.
442/// \param[out] is_supported Is this surface format supported?
443/// \return VdpStatus The completion status of the operation.
444pub type VdpOutputSurfaceQueryGetPutBitsNativeCapabilities = Option<
445    unsafe extern "C" fn(
446        device: VdpDevice,
447        surface_rgba_format: VdpRGBAFormat,
448        is_supported: *mut VdpBool,
449    ) -> VdpStatus,
450>;
451/// \brief Query the implementation's capability to perform a
452/// PutBits operation using application data in a specific
453/// indexed format.
454/// \param[in] device The device to query.
455/// \param[in] surface_rgba_format The surface format for
456/// which information is requested.
457/// \param[in] bits_indexed_format The format of the application
458/// data buffer.
459/// \param[in] color_table_format The format of the color lookup
460/// table.
461/// \param[out] is_supported Is this surface format supported?
462/// \return VdpStatus The completion status of the operation.
463pub type VdpOutputSurfaceQueryPutBitsIndexedCapabilities = Option<
464    unsafe extern "C" fn(
465        device: VdpDevice,
466        surface_rgba_format: VdpRGBAFormat,
467        bits_indexed_format: VdpIndexedFormat,
468        color_table_format: VdpColorTableFormat,
469        is_supported: *mut VdpBool,
470    ) -> VdpStatus,
471>;
472/// \brief Query the implementation's capability to perform a
473/// PutBits operation using application data in a specific
474/// YCbCr/YUB format.
475/// \param[in] device The device to query.
476/// \param[in] surface_rgba_format The surface format for which
477/// information is requested.
478/// \param[in] bits_ycbcr_format The format of the application
479/// data buffer.
480/// \param[out] is_supported Is this surface format supported?
481/// \return VdpStatus The completion status of the operation.
482pub type VdpOutputSurfaceQueryPutBitsYCbCrCapabilities = Option<
483    unsafe extern "C" fn(
484        device: VdpDevice,
485        surface_rgba_format: VdpRGBAFormat,
486        bits_ycbcr_format: VdpYCbCrFormat,
487        is_supported: *mut VdpBool,
488    ) -> VdpStatus,
489>;
490/// \brief An opaque handle representing a VdpOutputSurface
491/// object.
492pub type VdpOutputSurface = u32;
493/// \brief Create a VdpOutputSurface.
494/// \param[in] device The device that will contain the surface.
495/// \param[in] rgba_format The format of the new surface.
496/// \param[in] width The width of the new surface.
497/// \param[in] height The height of the new surface.
498/// \param[out] surface The new surface's handle.
499/// \return VdpStatus The completion status of the operation.
500///
501/// The memory backing the surface will be initialized to 0 color
502/// and 0 alpha (i.e. black.)
503pub type VdpOutputSurfaceCreate = Option<
504    unsafe extern "C" fn(
505        device: VdpDevice,
506        rgba_format: VdpRGBAFormat,
507        width: u32,
508        height: u32,
509        surface: *mut VdpOutputSurface,
510    ) -> VdpStatus,
511>;
512/// \brief Destroy a VdpOutputSurface.
513/// \param[in] surface The surface's handle.
514/// \return VdpStatus The completion status of the operation.
515pub type VdpOutputSurfaceDestroy =
516    Option<unsafe extern "C" fn(surface: VdpOutputSurface) -> VdpStatus>;
517/// \brief Retrieve the parameters used to create a
518/// VdpOutputSurface.
519/// \param[in] surface The surface's handle.
520/// \param[out] rgba_format The format of the surface.
521/// \param[out] width The width of the surface.
522/// \param[out] height The height of the surface.
523/// \return VdpStatus The completion status of the operation.
524pub type VdpOutputSurfaceGetParameters = Option<
525    unsafe extern "C" fn(
526        surface: VdpOutputSurface,
527        rgba_format: *mut VdpRGBAFormat,
528        width: *mut u32,
529        height: *mut u32,
530    ) -> VdpStatus,
531>;
532/// \brief Copy image data from a VdpOutputSurface to application
533/// memory in the surface's native format.
534/// \param[in] surface The surface's handle.
535/// \param[in] source_rect The sub-rectangle of the source
536/// surface to copy. If NULL, the entire surface will be
537/// retrieved.
538/// \param[in] destination_data Pointers to the application data
539/// buffers into which the image data will be written. Note
540/// that this is an array of pointers, one per plane. The
541/// destination_format parameter will define how many
542/// planes are required.
543/// \param[in] destination_pitches Pointers to the pitch values
544/// for the application data buffers. Note that this is an
545/// array of pointers, one per plane. The
546/// destination_format parameter will define how many
547/// planes are required.
548/// \return VdpStatus The completion status of the operation.
549pub type VdpOutputSurfaceGetBitsNative = Option<
550    unsafe extern "C" fn(
551        surface: VdpOutputSurface,
552        source_rect: *const VdpRect,
553        destination_data: *const *const libc::c_void,
554        destination_pitches: *const u32,
555    ) -> VdpStatus,
556>;
557/// \brief Copy image data from application memory in the
558/// surface's native format to a VdpOutputSurface.
559/// \param[in] surface The surface's handle.
560/// \param[in] source_data Pointers to the application data
561/// buffers from which the image data will be copied. Note
562/// that this is an array of pointers, one per plane. The
563/// source_format parameter will define how many
564/// planes are required.
565/// \param[in] source_pitches Pointers to the pitch values
566/// for the application data buffers. Note that this is an
567/// array of pointers, one per plane. The
568/// source_format parameter will define how many
569/// planes are required.
570/// \param[in] destination_rect The sub-rectangle of the surface
571/// to fill with application data. If NULL, the entire
572/// surface will be updated.
573/// \return VdpStatus The completion status of the operation.
574pub type VdpOutputSurfacePutBitsNative = Option<
575    unsafe extern "C" fn(
576        surface: VdpOutputSurface,
577        source_data: *const *const libc::c_void,
578        source_pitches: *const u32,
579        destination_rect: *const VdpRect,
580    ) -> VdpStatus,
581>;
582/// \brief Copy image data from application memory in a specific
583/// indexed format to a VdpOutputSurface.
584/// \param[in] surface The surface's handle.
585/// \param[in] source_indexed_format The format of the
586/// application's data buffers.
587/// \param[in] source_data Pointers to the application data
588/// buffers from which the image data will be copied. Note
589/// that this is an array of pointers, one per plane. The
590/// source_indexed_format parameter will define how many
591/// planes are required.
592/// \param[in] source_pitches Pointers to the pitch values
593/// for the application data buffers. Note that this is an
594/// array of pointers, one per plane. The
595/// source_indexed_format parameter will define how many
596/// planes are required.
597/// \param[in] destination_rect The sub-rectangle of the surface
598/// to fill with application data. If NULL, the entire
599/// surface will be updated.
600/// \param[in] color_table_format The format of the color_table.
601/// \param[in] color_table A table that maps between source index
602/// and target color data. See \ref VdpColorTableFormat for
603/// details regarding the memory layout.
604/// \return VdpStatus The completion status of the operation.
605pub type VdpOutputSurfacePutBitsIndexed = Option<
606    unsafe extern "C" fn(
607        surface: VdpOutputSurface,
608        source_indexed_format: VdpIndexedFormat,
609        source_data: *const *const libc::c_void,
610        source_pitch: *const u32,
611        destination_rect: *const VdpRect,
612        color_table_format: VdpColorTableFormat,
613        color_table: *const libc::c_void,
614    ) -> VdpStatus,
615>;
616/// \brief Copy image data from application memory in a specific
617/// YCbCr format to a VdpOutputSurface.
618/// \param[in] surface The surface's handle.
619/// \param[in] source_ycbcr_format The format of the
620/// application's data buffers.
621/// \param[in] source_data Pointers to the application data
622/// buffers from which the image data will be copied. Note
623/// that this is an array of pointers, one per plane. The
624/// source_ycbcr_format parameter will define how many
625/// planes are required.
626/// \param[in] source_pitches Pointers to the pitch values
627/// for the application data buffers. Note that this is an
628/// array of pointers, one per plane. The
629/// source_ycbcr_format parameter will define how many
630/// planes are required.
631/// \param[in] destination_rect The sub-rectangle of the surface
632/// to fill with application data. If NULL, the entire
633/// surface will be updated.
634/// \param[in] csc_matrix The color space conversion matrix used
635/// by the copy operation. If NULL, a default matrix will
636/// be used internally. Th default matrix is equivalent to
637/// ITU-R BT.601 with no procamp changes.
638/// \return VdpStatus The completion status of the operation.
639pub type VdpOutputSurfacePutBitsYCbCr = Option<
640    unsafe extern "C" fn(
641        surface: VdpOutputSurface,
642        source_ycbcr_format: VdpYCbCrFormat,
643        source_data: *const *const libc::c_void,
644        source_pitches: *const u32,
645        destination_rect: *const VdpRect,
646        csc_matrix: *const VdpCSCMatrix,
647    ) -> VdpStatus,
648>;
649/// \brief Query the implementation's VdpBitmapSurface
650/// capabilities.
651/// \param[in] device The device to query.
652/// \param[in] surface_rgba_format The surface format for
653/// which information is requested.
654/// \param[out] is_supported Is this surface format supported?
655/// \param[out] max_width The maximum supported surface width for
656/// this chroma type.
657/// \param[out] max_height The maximum supported surface height
658/// for this chroma type.
659/// \return VdpStatus The completion status of the operation.
660pub type VdpBitmapSurfaceQueryCapabilities = Option<
661    unsafe extern "C" fn(
662        device: VdpDevice,
663        surface_rgba_format: VdpRGBAFormat,
664        is_supported: *mut VdpBool,
665        max_width: *mut u32,
666        max_height: *mut u32,
667    ) -> VdpStatus,
668>;
669/// \brief An opaque handle representing a VdpBitmapSurface
670/// object.
671pub type VdpBitmapSurface = u32;
672/// \brief Create a VdpBitmapSurface.
673/// \param[in] device The device that will contain the surface.
674/// \param[in] rgba_format The format of the new surface.
675/// \param[in] width The width of the new surface.
676/// \param[in] height The height of the new surface.
677/// \param[in] frequently_accessed Is this bitmap used
678/// frequently, or infrequently, by compositing options?
679/// Implementations may use this as a hint to determine how
680/// to allocate the underlying storage for the surface.
681/// \param[out] surface The new surface's handle.
682/// \return VdpStatus The completion status of the operation.
683///
684/// The memory backing the surface may not be initialized
685/// during creation. Applications are expected initialize any
686/// region that they use, via \ref VdpBitmapSurfacePutBitsNative.
687pub type VdpBitmapSurfaceCreate = Option<
688    unsafe extern "C" fn(
689        device: VdpDevice,
690        rgba_format: VdpRGBAFormat,
691        width: u32,
692        height: u32,
693        frequently_accessed: VdpBool,
694        surface: *mut VdpBitmapSurface,
695    ) -> VdpStatus,
696>;
697/// \brief Destroy a VdpBitmapSurface.
698/// \param[in] surface The surface's handle.
699/// \return VdpStatus The completion status of the operation.
700pub type VdpBitmapSurfaceDestroy =
701    Option<unsafe extern "C" fn(surface: VdpBitmapSurface) -> VdpStatus>;
702/// \brief Retrieve the parameters used to create a
703/// VdpBitmapSurface.
704/// \param[in] surface The surface's handle.
705/// \param[out] rgba_format The format of the surface.
706/// \param[out] width The width of the surface.
707/// \param[out] height The height of the surface.
708/// \param[out] frequently_accessed The frequently_accessed state
709/// of the surface.
710/// \return VdpStatus The completion status of the operation.
711pub type VdpBitmapSurfaceGetParameters = Option<
712    unsafe extern "C" fn(
713        surface: VdpBitmapSurface,
714        rgba_format: *mut VdpRGBAFormat,
715        width: *mut u32,
716        height: *mut u32,
717        frequently_accessed: *mut VdpBool,
718    ) -> VdpStatus,
719>;
720/// \brief Copy image data from application memory in the
721/// surface's native format to a VdpBitmapSurface.
722/// \param[in] surface The surface's handle.
723/// \param[in] source_data Pointers to the application data
724/// buffers from which the image data will be copied. Note
725/// that this is an array of pointers, one per plane. The
726/// source_format parameter will define how many
727/// planes are required.
728/// \param[in] source_pitches Pointers to the pitch values
729/// for the application data buffers. Note that this is an
730/// array of pointers, one per plane. The
731/// source_format parameter will define how many
732/// planes are required.
733/// \param[in] destination_rect The sub-rectangle of the surface
734/// to fill with application data. If NULL, the entire
735/// surface will be updated.
736/// \return VdpStatus The completion status of the operation.
737pub type VdpBitmapSurfacePutBitsNative = Option<
738    unsafe extern "C" fn(
739        surface: VdpBitmapSurface,
740        source_data: *const *const libc::c_void,
741        source_pitches: *const u32,
742        destination_rect: *const VdpRect,
743    ) -> VdpStatus,
744>;
745pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ZERO: VdpOutputSurfaceRenderBlendFactor = 0;
746pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE: VdpOutputSurfaceRenderBlendFactor = 1;
747pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_COLOR: VdpOutputSurfaceRenderBlendFactor = 2;
748pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_COLOR:
749    VdpOutputSurfaceRenderBlendFactor = 3;
750pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA: VdpOutputSurfaceRenderBlendFactor = 4;
751pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA:
752    VdpOutputSurfaceRenderBlendFactor = 5;
753pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_DST_ALPHA: VdpOutputSurfaceRenderBlendFactor = 6;
754pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_DST_ALPHA:
755    VdpOutputSurfaceRenderBlendFactor = 7;
756pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_DST_COLOR: VdpOutputSurfaceRenderBlendFactor = 8;
757pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_DST_COLOR:
758    VdpOutputSurfaceRenderBlendFactor = 9;
759pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA_SATURATE:
760    VdpOutputSurfaceRenderBlendFactor = 10;
761pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_CONSTANT_COLOR: VdpOutputSurfaceRenderBlendFactor =
762    11;
763pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR:
764    VdpOutputSurfaceRenderBlendFactor = 12;
765pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_CONSTANT_ALPHA: VdpOutputSurfaceRenderBlendFactor =
766    13;
767pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA:
768    VdpOutputSurfaceRenderBlendFactor = 14;
769pub type VdpOutputSurfaceRenderBlendFactor = libc::c_uint;
770pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_SUBTRACT: VdpOutputSurfaceRenderBlendEquation =
771    0;
772pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_REVERSE_SUBTRACT:
773    VdpOutputSurfaceRenderBlendEquation = 1;
774pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD: VdpOutputSurfaceRenderBlendEquation = 2;
775pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_MIN: VdpOutputSurfaceRenderBlendEquation = 3;
776pub const VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_MAX: VdpOutputSurfaceRenderBlendEquation = 4;
777pub type VdpOutputSurfaceRenderBlendEquation = libc::c_uint;
778/// \brief Complete blending operation definition.
779///
780/// A "blend state" operation controls the math behind certain rendering
781/// operations.
782///
783/// The blend math is the familiar OpenGL blend math:
784/// \f[
785/// dst.a = equation(blendFactorDstAlpha*dst.a,
786/// blendFactorSrcAlpha*src.a);
787/// \f]
788/// \f[
789/// dst.rgb = equation(blendFactorDstColor*dst.rgb,
790/// blendFactorSrcColor*src.rgb);
791/// \f]
792///
793/// Note that when equation is MIN or MAX, the blend factors and constants
794/// are ignored, and are treated as if they were 1.0.
795#[repr(C)]
796#[derive(Debug, Copy, Clone)]
797pub struct VdpOutputSurfaceRenderBlendState {
798    /// This field must be filled with VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSIION
799    pub struct_version: u32,
800    pub blend_factor_source_color: VdpOutputSurfaceRenderBlendFactor,
801    pub blend_factor_destination_color: VdpOutputSurfaceRenderBlendFactor,
802    pub blend_factor_source_alpha: VdpOutputSurfaceRenderBlendFactor,
803    pub blend_factor_destination_alpha: VdpOutputSurfaceRenderBlendFactor,
804    pub blend_equation_color: VdpOutputSurfaceRenderBlendEquation,
805    pub blend_equation_alpha: VdpOutputSurfaceRenderBlendEquation,
806    pub blend_constant: VdpColor,
807}
808/// \brief Composite a sub-rectangle of a \ref VdpOutputSurface
809/// "VdpOutputSurface" into a sub-rectangle of another
810/// \ref VdpOutputSurface VdpOutputSurface.
811/// \param[in] destination_surface The destination surface of the
812/// compositing operation.
813/// \param[in] destination_rect The sub-rectangle of the
814/// destination surface to update. If NULL, the entire
815/// destination surface will be updated.
816/// \param[in] source_surface The source surface for the
817/// compositing operation. The surface is treated as having
818/// four components: red, green, blue and alpha. Any
819/// missing components are treated as 1.0. For example, for
820/// an A8 VdpOutputSurface, alpha will come from the surface
821/// but red, green and blue will be treated as 1.0. If
822/// source_surface is NULL, all components will be treated
823/// as 1.0. Note that destination_surface and
824/// source_surface must have been allocated via the same
825/// \ref VdpDevice "VdpDevice".
826/// \param[in] source_rect The sub-rectangle of the source
827/// surface to read from. If NULL, the entire
828/// source_surface will be read. Left/right and/or top/bottom
829/// co-ordinates may be swapped to flip the source. Any
830/// flip occurs prior to any requested rotation. Values
831/// from outside the source surface are valid and samples
832/// at those locations will be taken from the nearest edge.
833/// \param[in] colors A pointer to an array of \ref VdpColor
834/// "VdpColor" objects. If the flag
835/// VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is set,
836/// VDPAU will four entries from the array, and treat them
837/// as the colors corresponding to the upper-left,
838/// upper-right, lower-right and lower-left corners of the
839/// post-rotation source (i.e. indices 0, 1, 2 and 3 run
840/// clockwise from the upper left corner). If the flag
841/// VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is not
842/// set, VDPAU will use the single VdpColor for all four
843/// corners. If colors is NULL then red, green, blue and
844/// alpha values of 1.0 will be used.
845/// \param[in] blend_state If a blend state is provided, the
846/// blend state will be used for the composite operation. If
847/// NULL, blending is effectively disabled, which is
848/// equivalent to a blend equation of ADD, source blend
849/// factors of ONE and destination blend factors of ZERO.
850/// See \ref VdpOutputSurfaceRenderBlendState for details
851/// regarding the mathematics of the blending operation.
852/// \param[in] flags A set of flags influencing how the
853/// compositing operation works.
854/// \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
855/// \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_90
856/// \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_180
857/// \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_270
858/// \arg \ref VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX
859/// \return VdpStatus The completion status of the operation.
860///
861/// The general compositing pipeline is as follows.
862///
863/// -# Extract source_rect from source_surface.
864///
865/// -# The extracted source is rotated 0, 90, 180 or 270 degrees
866/// according to the flags.
867///
868/// -# The rotated source is component-wise multiplied by a
869/// smooth-shaded quad with a (potentially) different color at
870/// each vertex.
871///
872/// -# The resulting rotated, smooth-shaded quad is scaled to the
873/// size of destination_rect and composited with
874/// destination_surface using the provided blend state.
875///
876pub type VdpOutputSurfaceRenderOutputSurface = Option<
877    unsafe extern "C" fn(
878        destination_surface: VdpOutputSurface,
879        destination_rect: *const VdpRect,
880        source_surface: VdpOutputSurface,
881        source_rect: *const VdpRect,
882        colors: *const VdpColor,
883        blend_state: *const VdpOutputSurfaceRenderBlendState,
884        flags: u32,
885    ) -> VdpStatus,
886>;
887/// \brief Composite a sub-rectangle of a \ref VdpBitmapSurface
888/// "VdpBitmapSurface" into a sub-rectangle of a
889/// \ref VdpOutputSurface VdpOutputSurface.
890/// \param[in] destination_surface The destination surface of the
891/// compositing operation.
892/// \param[in] destination_rect The sub-rectangle of the
893/// destination surface to update. If NULL, the entire
894/// destination surface will be updated.
895/// \param[in] source_surface The source surface for the
896/// compositing operation. The surface is treated as having
897/// four components: red, green, blue and alpha. Any
898/// missing components are treated as 1.0. For example, for
899/// an A8 VdpBitmapSurface, alpha will come from the surface
900/// but red, green and blue will be treated as 1.0. If
901/// source_surface is NULL, all components will be treated
902/// as 1.0. Note that destination_surface and
903/// source_surface must have been allocated via the same
904/// \ref VdpDevice "VdpDevice".
905/// \param[in] source_rect The sub-rectangle of the source
906/// surface to read from. If NULL, the entire
907/// source_surface will be read. Left/right ot top/bottom
908/// co-ordinates may be swapped to flip the source. Any
909/// flip occurs prior to any requested rotation. Values
910/// from outside the source surface are valid and samples
911/// at those locations will be taken from the nearest edge.
912/// \param[in] colors A pointer to an array of \ref VdpColor
913/// "VdpColor" objects. If the flag
914/// VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is set,
915/// VDPAU will four entries from the array, and treat them
916/// as the colors corresponding to the upper-left,
917/// upper-right, lower-right and lower-left corners of the
918/// post-rotation source (i.e. indices 0, 1, 2 and 3 run
919/// clockwise from the upper left corner). If the flag
920/// VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX is not
921/// set, VDPAU will use the single VdpColor for all four
922/// corners. If colors is NULL then red, green, blue and
923/// alpha values of 1.0 will be used.
924/// \param[in] blend_state If a blend state is provided, the
925/// blend state will be used for the composite operation. If
926/// NULL, blending is effectively disabled, which is
927/// equivalent to a blend equation of ADD, source blend
928/// factors of ONE and destination blend factors of ZERO.
929/// See \ref VdpOutputSurfaceRenderBlendState for details
930/// regarding the mathematics of the blending operation.
931/// \param[in] flags A set of flags influencing how the
932/// compositing operation works.
933/// \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
934/// \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_90
935/// \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_180
936/// \arg \ref VDP_OUTPUT_SURFACE_RENDER_ROTATE_270
937/// \arg \ref VDP_OUTPUT_SURFACE_RENDER_COLOR_PER_VERTEX
938/// \return VdpStatus The completion status of the operation.
939///
940/// The general compositing pipeline is as follows.
941///
942/// -# Extract source_rect from source_surface.
943///
944/// -# The extracted source is rotated 0, 90, 180 or 270 degrees
945/// according to the flags.
946///
947/// -# The rotated source is component-wise multiplied by a
948/// smooth-shaded quad with a (potentially) different color at
949/// each vertex.
950///
951/// -# The resulting rotated, smooth-shaded quad is scaled to the
952/// size of destination_rect and composited with
953/// destination_surface using the provided blend state.
954///
955pub type VdpOutputSurfaceRenderBitmapSurface = Option<
956    unsafe extern "C" fn(
957        destination_surface: VdpOutputSurface,
958        destination_rect: *const VdpRect,
959        source_surface: VdpBitmapSurface,
960        source_rect: *const VdpRect,
961        colors: *const VdpColor,
962        blend_state: *const VdpOutputSurfaceRenderBlendState,
963        flags: u32,
964    ) -> VdpStatus,
965>;
966/// \brief The set of all known compressed video formats, and
967/// associated profiles, that may be decoded.
968pub type VdpDecoderProfile = u32;
969/// \brief Query the implementation's VdpDecoder capabilities.
970/// \param[in] device The device to query.
971/// \param[in] profile The decoder profile for which information is requested.
972/// \param[out] is_supported Is this profile supported?
973/// \param[out] max_level The maximum specification level supported for this
974/// profile.
975/// \param[out] max_macroblocks The maximum supported surface size in
976/// macroblocks. Note that this could be greater than that dictated by
977/// the maximum level.
978/// \param[out] max_width The maximum supported surface width for this profile.
979/// Note that this could be greater than that dictated by the maximum
980/// level.
981/// \param[out] max_height The maximum supported surface height for this
982/// profile. Note that this could be greater than that dictated by the
983/// maximum level.
984/// \return VdpStatus The completion status of the operation.
985pub type VdpDecoderQueryCapabilities = Option<
986    unsafe extern "C" fn(
987        device: VdpDevice,
988        profile: VdpDecoderProfile,
989        is_supported: *mut VdpBool,
990        max_level: *mut u32,
991        max_macroblocks: *mut u32,
992        max_width: *mut u32,
993        max_height: *mut u32,
994    ) -> VdpStatus,
995>;
996/// \brief An opaque handle representing a VdpDecoder object.
997pub type VdpDecoder = u32;
998/// \brief Create a VdpDecoder.
999/// \param[in] device The device that will contain the surface.
1000/// \param[in] profile The video format the decoder will decode.
1001/// \param[in] width The width of the new surface.
1002/// \param[in] height The height of the new surface.
1003/// \param[in] max_references The maximum number of references that may be
1004/// used by a single frame in the stream to be decoded. This parameter
1005/// exists mainly for formats such as H.264, where different streams
1006/// may use a different number of references. Requesting too many
1007/// references may waste memory, but decoding should still operate
1008/// correctly. Requesting too few references will cause decoding to
1009/// fail.
1010/// \param[out] decoder The new decoder's handle.
1011/// \return VdpStatus The completion status of the operation.
1012pub type VdpDecoderCreate = Option<
1013    unsafe extern "C" fn(
1014        device: VdpDevice,
1015        profile: VdpDecoderProfile,
1016        width: u32,
1017        height: u32,
1018        max_references: u32,
1019        decoder: *mut VdpDecoder,
1020    ) -> VdpStatus,
1021>;
1022/// \brief Destroy a VdpDecoder.
1023/// \param[in] surface The decoder's handle.
1024/// \return VdpStatus The completion status of the operation.
1025pub type VdpDecoderDestroy =
1026    Option<unsafe extern "C" fn(decoder: VdpDecoder) -> VdpStatus>;
1027/// \brief Retrieve the parameters used to create a
1028/// VdpDecoder.
1029/// \param[in] surface The surface's handle.
1030/// \param[out] profile The video format used to create the
1031/// decoder.
1032/// \param[out] width The width of surfaces decode by the
1033/// decoder.
1034/// \param[out] height The height of surfaces decode by the
1035/// decoder
1036/// \return VdpStatus The completion status of the operation.
1037pub type VdpDecoderGetParameters = Option<
1038    unsafe extern "C" fn(
1039        decoder: VdpDecoder,
1040        profile: *mut VdpDecoderProfile,
1041        width: *mut u32,
1042        height: *mut u32,
1043    ) -> VdpStatus,
1044>;
1045/// \brief Application data buffer containing compressed video
1046/// data.
1047#[repr(C)]
1048#[derive(Debug, Copy, Clone)]
1049pub struct VdpBitstreamBuffer {
1050    /// This field must be filled with VDP_BITSTREAM_BUFFER_VERSION
1051    pub struct_version: u32,
1052    /// A pointer to the bitstream data bytes
1053    pub bitstream: *const libc::c_void,
1054    /// The number of data bytes
1055    pub bitstream_bytes: u32,
1056}
1057/// \brief A generic "picture information" pointer type.
1058///
1059/// This type serves solely to document the expected usage of a
1060/// generic (void *) function parameter. In actual usage, the
1061/// application is expected to physically provide a pointer to an
1062/// instance of one of the "real" VdpPictureInfo* structures,
1063/// picking the type appropriate for the decoder object in
1064/// question.
1065pub type VdpPictureInfo = *mut libc::c_void;
1066/// \brief Picture parameter information for an MPEG 1 or MPEG 2
1067/// picture.
1068///
1069/// Note: References to "copy of bitstream field" in the field descriptions
1070/// may refer to data literally parsed from the bitstream, or derived from
1071/// the bitstream using a mechanism described in the specification.
1072#[repr(C)]
1073#[derive(Copy, Clone)]
1074pub struct VdpPictureInfoMPEG1Or2 {
1075    /// Reference used by B and P frames.
1076    /// Set to VDP_INVALID_HANDLE when not used.
1077    pub forward_reference: VdpVideoSurface,
1078    /// Reference used by B frames.
1079    /// Set to VDP_INVALID_HANDLE when not used.
1080    pub backward_reference: VdpVideoSurface,
1081    /// Number of slices in the bitstream provided.
1082    pub slice_count: u32,
1083    /// Copy of the MPEG bitstream field.
1084    pub picture_structure: u8,
1085    /// Copy of the MPEG bitstream field.
1086    pub picture_coding_type: u8,
1087    /// Copy of the MPEG bitstream field.
1088    pub intra_dc_precision: u8,
1089    /// Copy of the MPEG bitstream field.
1090    pub frame_pred_frame_dct: u8,
1091    /// Copy of the MPEG bitstream field.
1092    pub concealment_motion_vectors: u8,
1093    /// Copy of the MPEG bitstream field.
1094    pub intra_vlc_format: u8,
1095    /// Copy of the MPEG bitstream field.
1096    pub alternate_scan: u8,
1097    /// Copy of the MPEG bitstream field.
1098    pub q_scale_type: u8,
1099    /// Copy of the MPEG bitstream field.
1100    pub top_field_first: u8,
1101    /// Copy of the MPEG-1 bitstream field. For MPEG-2, set to 0.
1102    pub full_pel_forward_vector: u8,
1103    /// Copy of the MPEG-1 bitstream field. For MPEG-2, set to 0.
1104    pub full_pel_backward_vector: u8,
1105    /// Copy of the MPEG bitstream field.
1106    /// For MPEG-1, fill both horizontal and vertical entries.
1107    pub f_code: [[u8; 2usize]; 2usize],
1108    /// Copy of the MPEG bitstream field, converted to raster order.
1109    pub intra_quantizer_matrix: [u8; 64usize],
1110    /// Copy of the MPEG bitstream field, converted to raster order.
1111    pub non_intra_quantizer_matrix: [u8; 64usize],
1112}
1113/// \brief Information about an H.264 reference frame
1114///
1115/// Note: References to "copy of bitstream field" in the field descriptions
1116/// may refer to data literally parsed from the bitstream, or derived from
1117/// the bitstream using a mechanism described in the specification.
1118#[repr(C)]
1119#[derive(Debug, Copy, Clone)]
1120pub struct VdpReferenceFrameH264 {
1121    /// The surface that contains the reference image.
1122    /// Set to VDP_INVALID_HANDLE for unused entries.
1123    pub surface: VdpVideoSurface,
1124    /// Is this a long term reference (else short term).
1125    pub is_long_term: VdpBool,
1126    /// Is the top field used as a reference.
1127    /// Set to VDP_FALSE for unused entries.
1128    pub top_is_reference: VdpBool,
1129    /// Is the bottom field used as a reference.
1130    /// Set to VDP_FALSE for unused entries.
1131    pub bottom_is_reference: VdpBool,
1132    /// [0]: top, [1]: bottom
1133    pub field_order_cnt: [i32; 2usize],
1134    /// Copy of the H.264 bitstream field:
1135    /// frame_num from slice_header for short-term references,
1136    /// LongTermPicNum from decoding algorithm for long-term references.
1137    pub frame_idx: u16,
1138}
1139/// \brief Picture parameter information for an H.264 picture.
1140///
1141/// Note: The \ref referenceFrames array must contain the "DPB" as
1142/// defined by the H.264 specification. In particular, once a
1143/// reference frame has been decoded to a surface, that surface must
1144/// continue to appear in the DPB until no longer required to predict
1145/// any future frame. Once a surface is removed from the DPB, it can
1146/// no longer be used as a reference, unless decoded again.
1147///
1148/// Also note that only surfaces previously generated using \ref
1149/// VdpDecoderRender may be used as reference frames. In particular,
1150/// surfaces filled using any "put bits" API will not work.
1151///
1152/// Note: References to "copy of bitstream field" in the field descriptions
1153/// may refer to data literally parsed from the bitstream, or derived from
1154/// the bitstream using a mechanism described in the specification.
1155#[repr(C)]
1156#[derive(Copy, Clone)]
1157pub struct VdpPictureInfoH264 {
1158    /// Number of slices in the bitstream provided.
1159    pub slice_count: u32,
1160    /// [0]: top, [1]: bottom
1161    pub field_order_cnt: [i32; 2usize],
1162    /// Will the decoded frame be used as a reference later.
1163    pub is_reference: VdpBool,
1164    /// Copy of the H.264 bitstream field.
1165    pub frame_num: u16,
1166    /// Copy of the H.264 bitstream field.
1167    pub field_pic_flag: u8,
1168    /// Copy of the H.264 bitstream field.
1169    pub bottom_field_flag: u8,
1170    /// Copy of the H.264 bitstream field.
1171    pub num_ref_frames: u8,
1172    /// Copy of the H.264 bitstream field.
1173    pub mb_adaptive_frame_field_flag: u8,
1174    /// Copy of the H.264 bitstream field.
1175    pub constrained_intra_pred_flag: u8,
1176    /// Copy of the H.264 bitstream field.
1177    pub weighted_pred_flag: u8,
1178    /// Copy of the H.264 bitstream field.
1179    pub weighted_bipred_idc: u8,
1180    /// Copy of the H.264 bitstream field.
1181    pub frame_mbs_only_flag: u8,
1182    /// Copy of the H.264 bitstream field.
1183    pub transform_8x8_mode_flag: u8,
1184    /// Copy of the H.264 bitstream field.
1185    pub chroma_qp_index_offset: i8,
1186    /// Copy of the H.264 bitstream field.
1187    pub second_chroma_qp_index_offset: i8,
1188    /// Copy of the H.264 bitstream field.
1189    pub pic_init_qp_minus26: i8,
1190    /// Copy of the H.264 bitstream field.
1191    pub num_ref_idx_l0_active_minus1: u8,
1192    /// Copy of the H.264 bitstream field.
1193    pub num_ref_idx_l1_active_minus1: u8,
1194    /// Copy of the H.264 bitstream field.
1195    pub log2_max_frame_num_minus4: u8,
1196    /// Copy of the H.264 bitstream field.
1197    pub pic_order_cnt_type: u8,
1198    /// Copy of the H.264 bitstream field.
1199    pub log2_max_pic_order_cnt_lsb_minus4: u8,
1200    /// Copy of the H.264 bitstream field.
1201    pub delta_pic_order_always_zero_flag: u8,
1202    /// Copy of the H.264 bitstream field.
1203    pub direct_8x8_inference_flag: u8,
1204    /// Copy of the H.264 bitstream field.
1205    pub entropy_coding_mode_flag: u8,
1206    /// Copy of the H.264 bitstream field.
1207    pub pic_order_present_flag: u8,
1208    /// Copy of the H.264 bitstream field.
1209    pub deblocking_filter_control_present_flag: u8,
1210    /// Copy of the H.264 bitstream field.
1211    pub redundant_pic_cnt_present_flag: u8,
1212    /// Copy of the H.264 bitstream field, converted to raster order.
1213    pub scaling_lists_4x4: [[u8; 16usize]; 6usize],
1214    /// Copy of the H.264 bitstream field, converted to raster order.
1215    pub scaling_lists_8x8: [[u8; 64usize]; 2usize],
1216    /// See \ref VdpPictureInfoH264 for instructions regarding this field.
1217    pub referenceFrames: [VdpReferenceFrameH264; 16usize],
1218}
1219/// \brief Picture parameter information for a VC1 picture.
1220///
1221/// Note: References to "copy of bitstream field" in the field descriptions
1222/// may refer to data literally parsed from the bitstream, or derived from
1223/// the bitstream using a mechanism described in the specification.
1224#[repr(C)]
1225#[derive(Debug, Copy, Clone)]
1226pub struct VdpPictureInfoVC1 {
1227    /// Reference used by B and P frames.
1228    /// Set to VDP_INVALID_HANDLE when not used.
1229    pub forward_reference: VdpVideoSurface,
1230    /// Reference used by B frames.
1231    /// Set to VDP_INVALID_HANDLE when not used.
1232    pub backward_reference: VdpVideoSurface,
1233    /// Number of slices in the bitstream provided.
1234    pub slice_count: u32,
1235    /// I=0, P=1, B=3, BI=4  from 7.1.1.4.
1236    pub picture_type: u8,
1237    /// Progressive=0, Frame-interlace=2, Field-interlace=3; see VC-1 7.1.1.15.
1238    pub frame_coding_mode: u8,
1239    /// Copy of the VC-1 bitstream field. See VC-1 6.1.5.
1240    pub postprocflag: u8,
1241    /// Copy of the VC-1 bitstream field. See VC-1 6.1.8.
1242    pub pulldown: u8,
1243    /// Copy of the VC-1 bitstream field. See VC-1 6.1.9.
1244    pub interlace: u8,
1245    /// Copy of the VC-1 bitstream field. See VC-1 6.1.10.
1246    pub tfcntrflag: u8,
1247    /// Copy of the VC-1 bitstream field. See VC-1 6.1.11.
1248    pub finterpflag: u8,
1249    /// Copy of the VC-1 bitstream field. See VC-1 6.1.3.
1250    pub psf: u8,
1251    /// Copy of the VC-1 bitstream field. See VC-1 6.2.8.
1252    pub dquant: u8,
1253    /// Copy of the VC-1 bitstream field. See VC-1 6.2.3.
1254    pub panscan_flag: u8,
1255    /// Copy of the VC-1 bitstream field. See VC-1 6.2.4.
1256    pub refdist_flag: u8,
1257    /// Copy of the VC-1 bitstream field. See VC-1 6.2.11.
1258    pub quantizer: u8,
1259    /// Copy of the VC-1 bitstream field. See VC-1 6.2.7.
1260    pub extended_mv: u8,
1261    /// Copy of the VC-1 bitstream field. See VC-1 6.2.14.
1262    pub extended_dmv: u8,
1263    /// Copy of the VC-1 bitstream field. See VC-1 6.2.10.
1264    pub overlap: u8,
1265    /// Copy of the VC-1 bitstream field. See VC-1 6.2.9.
1266    pub vstransform: u8,
1267    /// Copy of the VC-1 bitstream field. See VC-1 6.2.5.
1268    pub loopfilter: u8,
1269    /// Copy of the VC-1 bitstream field. See VC-1 6.2.6.
1270    pub fastuvmc: u8,
1271    /// Copy of the VC-1 bitstream field. See VC-1 6.12.15.
1272    pub range_mapy_flag: u8,
1273    /// Copy of the VC-1 bitstream field.
1274    pub range_mapy: u8,
1275    /// Copy of the VC-1 bitstream field. See VC-1 6.2.16.
1276    pub range_mapuv_flag: u8,
1277    /// Copy of the VC-1 bitstream field.
1278    pub range_mapuv: u8,
1279    /// Copy of the VC-1 bitstream field. See VC-1 J.1.10.
1280    /// Only used by simple and main profiles.
1281    pub multires: u8,
1282    /// Copy of the VC-1 bitstream field. See VC-1 J.1.16.
1283    /// Only used by simple and main profiles.
1284    pub syncmarker: u8,
1285    /// VC-1 SP/MP range reduction control.
1286    /// Only used by simple and main profiles.
1287    /// Bit 0: Copy of rangered VC-1 bitstream field; See VC-1 J.1.17.
1288    /// Bit 1: Copy of rangeredfrm VC-1 bitstream fiels; See VC-1 7.1.13.
1289    pub rangered: u8,
1290    /// Copy of the VC-1 bitstream field. See VC-1 J.1.17.
1291    /// Only used by simple and main profiles.
1292    pub maxbframes: u8,
1293    /// Out-of-loop deblocking enable.
1294    /// Bit 0 of POSTPROC from VC-1 7.1.1.27
1295    /// Note that bit 1 of POSTPROC (dering enable) should not be included.
1296    pub deblockEnable: u8,
1297    /// Parameter used by VC-1 Annex H deblocking algorithm. Note that VDPAU
1298    /// implementations may choose which deblocking algorithm to use.
1299    /// See VC-1 7.1.1.6
1300    pub pquant: u8,
1301}
1302/// \brief Picture parameter information for an MPEG-4 Part 2 picture.
1303///
1304/// Note: References to "copy of bitstream field" in the field descriptions
1305/// may refer to data literally parsed from the bitstream, or derived from
1306/// the bitstream using a mechanism described in the specification.
1307#[repr(C)]
1308#[derive(Copy, Clone)]
1309pub struct VdpPictureInfoMPEG4Part2 {
1310    /// Reference used by B and P frames.
1311    /// Set to VDP_INVALID_HANDLE when not used.
1312    pub forward_reference: VdpVideoSurface,
1313    /// Reference used by B frames.
1314    /// Set to VDP_INVALID_HANDLE when not used.
1315    pub backward_reference: VdpVideoSurface,
1316    /// Copy of the bitstream field.
1317    pub trd: [i32; 2usize],
1318    /// Copy of the bitstream field.
1319    pub trb: [i32; 2usize],
1320    /// Copy of the bitstream field.
1321    pub vop_time_increment_resolution: u16,
1322    /// Copy of the bitstream field.
1323    pub vop_coding_type: u8,
1324    /// Copy of the bitstream field.
1325    pub vop_fcode_forward: u8,
1326    /// Copy of the bitstream field.
1327    pub vop_fcode_backward: u8,
1328    /// Copy of the bitstream field.
1329    pub resync_marker_disable: u8,
1330    /// Copy of the bitstream field.
1331    pub interlaced: u8,
1332    /// Copy of the bitstream field.
1333    pub quant_type: u8,
1334    /// Copy of the bitstream field.
1335    pub quarter_sample: u8,
1336    /// Copy of the bitstream field.
1337    pub short_video_header: u8,
1338    /// Derived from vop_rounding_type bitstream field.
1339    pub rounding_control: u8,
1340    /// Copy of the bitstream field.
1341    pub alternate_vertical_scan_flag: u8,
1342    /// Copy of the bitstream field.
1343    pub top_field_first: u8,
1344    /// Copy of the bitstream field.
1345    pub intra_quantizer_matrix: [u8; 64usize],
1346    /// Copy of the bitstream field.
1347    pub non_intra_quantizer_matrix: [u8; 64usize],
1348}
1349/// \brief Picture parameter information for a DivX 4 picture.
1350///
1351/// Due to similarites between MPEG-4 Part 2 and DivX 4, the picture
1352/// parameter structure is re-used.
1353pub type VdpPictureInfoDivX4 = VdpPictureInfoMPEG4Part2;
1354/// \brief Picture parameter information for a DivX 5 picture.
1355///
1356/// Due to similarites between MPEG-4 Part 2 and DivX 5, the picture
1357/// parameter structure is re-used.
1358pub type VdpPictureInfoDivX5 = VdpPictureInfoMPEG4Part2;
1359/// \brief Decode a compressed field/frame and render the result
1360/// into a \ref VdpVideoSurface "VdpVideoSurface".
1361/// \param[in] decoder The decoder object that will perform the
1362/// decode operation.
1363/// \param[in] target The video surface to render to.
1364/// \param[in] picture_info A (pointer to a) structure containing
1365/// information about the picture to be decoded. Note that
1366/// the appropriate type of VdpPictureInfo* structure must
1367/// be provided to match to profile that the decoder was
1368/// created for.
1369/// \param[in] bitstream_buffer_count The number of bitstream
1370/// buffers containing compressed data for this picture.
1371/// \param[in] bitstream_buffers An array of bitstream buffers.
1372/// \return VdpStatus The completion status of the operation.
1373///
1374/// See \ref video_mixer_usage for additional information.
1375pub type VdpDecoderRender = Option<
1376    unsafe extern "C" fn(
1377        decoder: VdpDecoder,
1378        target: VdpVideoSurface,
1379        picture_info: *const VdpPictureInfo,
1380        bitstream_buffer_count: u32,
1381        bitstream_buffers: *const VdpBitstreamBuffer,
1382    ) -> VdpStatus,
1383>;
1384/// \brief A VdpVideoMixer feature that must be requested at
1385/// creation time to be used.
1386///
1387/// Certain advanced VdpVideoMixer features are optional, and the
1388/// ability to use those features at all must be requested when
1389/// the VdpVideoMixer object is created. Each feature is named via
1390/// a specific VdpVideoMixerFeature value.
1391///
1392/// Once requested, these features are permanently available
1393/// within that specific VdpVideoMixer object. All features that
1394/// are not explicitly requested at creation time default to
1395/// being permanently unavailable.
1396///
1397/// Even when requested, all features default to being initially
1398/// disabled. However, applications can subsequently enable and
1399/// disable features at any time. See \ref
1400/// VdpVideoMixerSetFeatureEnables.
1401///
1402/// Some features allow configuration of their operation. Each
1403/// configurable item is an \ref VdpVideoMixerAttribute. These
1404/// attributes may be manipulated at any time using \ref
1405/// VdpVideoMixerSetAttributeValues.
1406pub type VdpVideoMixerFeature = u32;
1407/// \brief A VdpVideoMixer creation parameter.
1408///
1409/// When a VdpVideoMixer is created, certain parameters may be
1410/// supplied. Each parameter is named via a specific
1411/// VdpVideoMixerParameter value.
1412///
1413/// Each parameter has a specific type, and specific default
1414/// value if not specified at VdpVideoMixer creation time. The
1415/// application may query the legal supported range for some
1416/// parameters.
1417pub type VdpVideoMixerParameter = u32;
1418/// \brief An adjustable attribute of VdpVideoMixer operation.
1419///
1420/// Various attributes of VdpVideoMixer operation may be adjusted
1421/// at any time. Each attribute is named via a specific
1422/// VdpVideoMixerAttribute value.
1423///
1424/// Each attribute has a specific type, and specific default
1425/// value if not specified at VdpVideoMixer creation time. The
1426/// application may query the legal supported range for some
1427/// attributes.
1428pub type VdpVideoMixerAttribute = u32;
1429/// \brief Query the implementation's support for a specific
1430/// feature.
1431/// \param[in] device The device to query.
1432/// \param[in] feature The feature for which support is to be
1433/// queried.
1434/// \param[out] is_supported Is the specified feature supported?
1435/// \return VdpStatus The completion status of the operation.
1436pub type VdpVideoMixerQueryFeatureSupport = Option<
1437    unsafe extern "C" fn(
1438        device: VdpDevice,
1439        feature: VdpVideoMixerFeature,
1440        is_supported: *mut VdpBool,
1441    ) -> VdpStatus,
1442>;
1443/// \brief Query the implementation's support for a specific
1444/// parameter.
1445/// \param[in] device The device to query.
1446/// \param[in] parameter The parameter for which support is to be
1447/// queried.
1448/// \param[out] is_supported Is the specified parameter
1449/// supported?
1450/// \return VdpStatus The completion status of the operation.
1451pub type VdpVideoMixerQueryParameterSupport = Option<
1452    unsafe extern "C" fn(
1453        device: VdpDevice,
1454        parameter: VdpVideoMixerParameter,
1455        is_supported: *mut VdpBool,
1456    ) -> VdpStatus,
1457>;
1458/// \brief Query the implementation's support for a specific
1459/// attribute.
1460/// \param[in] device The device to query.
1461/// \param[in] feature The feature for which support is to be
1462/// queried.
1463/// \param[out] is_supported Is the specified feature supported?
1464/// \return VdpStatus The completion status of the operation.
1465pub type VdpVideoMixerQueryAttributeSupport = Option<
1466    unsafe extern "C" fn(
1467        device: VdpDevice,
1468        attribute: VdpVideoMixerAttribute,
1469        is_supported: *mut VdpBool,
1470    ) -> VdpStatus,
1471>;
1472/// \brief Query the implementation's supported for a specific
1473/// parameter.
1474/// \param[in] device The device to query.
1475/// \param[in] parameter The parameter for which support is to be
1476/// queried.
1477/// \param[out] min_value The minimum supported value.
1478/// \param[out] max_value The maximum supported value.
1479/// \return VdpStatus The completion status of the operation.
1480pub type VdpVideoMixerQueryParameterValueRange = Option<
1481    unsafe extern "C" fn(
1482        device: VdpDevice,
1483        parameter: VdpVideoMixerParameter,
1484        min_value: *mut libc::c_void,
1485        max_value: *mut libc::c_void,
1486    ) -> VdpStatus,
1487>;
1488/// \brief Query the implementation's supported for a specific
1489/// attribute.
1490/// \param[in] device The device to query.
1491/// \param[in] attribute The attribute for which support is to be
1492/// queried.
1493/// \param[out] min_value The minimum supported value.
1494/// \param[out] max_value The maximum supported value.
1495/// \return VdpStatus The completion status of the operation.
1496pub type VdpVideoMixerQueryAttributeValueRange = Option<
1497    unsafe extern "C" fn(
1498        device: VdpDevice,
1499        attribute: VdpVideoMixerAttribute,
1500        min_value: *mut libc::c_void,
1501        max_value: *mut libc::c_void,
1502    ) -> VdpStatus,
1503>;
1504/// \brief An opaque handle representing a VdpVideoMixer object.
1505pub type VdpVideoMixer = u32;
1506/// \brief Create a VdpVideoMixer.
1507/// \param[in] device The device that will contain the mixer.
1508/// \param[in] feature_count The number of features to request.
1509/// \param[in] features The list of features to request.
1510/// \param[in] parameter_count The number of parameters to set.
1511/// \param[in] parameters The list of parameters to set.
1512/// \param[in] parameter_values The values for the parameters. Note that each
1513/// entry in the value array is a pointer to the actual value. In other
1514/// words, the values themselves are not cast to "void *" and passed
1515/// "inside" the array.
1516/// \param[out] mixer The new mixer's handle.
1517/// \return VdpStatus The completion status of the operation.
1518///
1519/// Initially, all requested features will be disabled. They can
1520/// be enabled using \ref VdpVideoMixerSetFeatureEnables.
1521///
1522/// Initially, all attributes will have default values. Values
1523/// can be changed using \ref VdpVideoMixerSetAttributeValues.
1524pub type VdpVideoMixerCreate = Option<
1525    unsafe extern "C" fn(
1526        device: VdpDevice,
1527        feature_count: u32,
1528        features: *const VdpVideoMixerFeature,
1529        parameter_count: u32,
1530        parameters: *const VdpVideoMixerParameter,
1531        parameter_values: *const *const libc::c_void,
1532        mixer: *mut VdpVideoMixer,
1533    ) -> VdpStatus,
1534>;
1535/// \brief Enable or disable features.
1536/// \param[in] mixer The mixer to manipulate.
1537/// \param[in] feature_count The number of features to
1538/// enable/disable.
1539/// \param[in] features The list of features to enable/disable.
1540/// \param[in] feature_enables The list of new feature enable
1541/// values.
1542/// \return VdpStatus The completion status of the operation.
1543pub type VdpVideoMixerSetFeatureEnables = Option<
1544    unsafe extern "C" fn(
1545        mixer: VdpVideoMixer,
1546        feature_count: u32,
1547        features: *const VdpVideoMixerFeature,
1548        feature_enables: *const VdpBool,
1549    ) -> VdpStatus,
1550>;
1551/// \brief Set attribute values
1552/// \param[in] mixer The mixer to manipulate.
1553/// \param[in] attribute_count The number of attributes to set.
1554/// \param[in] attributes The list of attributes to set.
1555/// \param[in] attribute_values The values for the attributes. Note that each
1556/// entry in the value array is a pointer to the actual value. In other
1557/// words, the values themselves are not cast to "void *" and passed
1558/// "inside" the array. A NULL pointer requests that the default value be
1559/// set for that attribute.
1560/// \return VdpStatus The completion status of the operation.
1561pub type VdpVideoMixerSetAttributeValues = Option<
1562    unsafe extern "C" fn(
1563        mixer: VdpVideoMixer,
1564        attribute_count: u32,
1565        attributes: *const VdpVideoMixerAttribute,
1566        attribute_values: *const *const libc::c_void,
1567    ) -> VdpStatus,
1568>;
1569/// \brief Retrieve whether features were requested at creation
1570/// time.
1571/// \param[in] mixer The mixer to query.
1572/// \param[in] feature_count The number of features to query.
1573/// \param[in] features The list of features to query.
1574/// \param[out] feature_supported A list of values indicating
1575/// whether the feature was requested, and hence is
1576/// available.
1577/// \return VdpStatus The completion status of the operation.
1578pub type VdpVideoMixerGetFeatureSupport = Option<
1579    unsafe extern "C" fn(
1580        mixer: VdpVideoMixer,
1581        feature_count: u32,
1582        features: *const VdpVideoMixerFeature,
1583        feature_supports: *mut VdpBool,
1584    ) -> VdpStatus,
1585>;
1586/// \brief Retrieve whether features are enabled.
1587/// \param[in] mixer The mixer to manipulate.
1588/// \param[in] feature_count The number of features to query.
1589/// \param[in] features The list of features to query.
1590/// \param[out] feature_enabled A list of values indicating
1591/// whether the feature is enabled.
1592/// \return VdpStatus The completion status of the operation.
1593pub type VdpVideoMixerGetFeatureEnables = Option<
1594    unsafe extern "C" fn(
1595        mixer: VdpVideoMixer,
1596        feature_count: u32,
1597        features: *const VdpVideoMixerFeature,
1598        feature_enables: *mut VdpBool,
1599    ) -> VdpStatus,
1600>;
1601/// \brief Retrieve parameter values given at creation time.
1602/// \param[in] mixer The mixer to manipulate.
1603/// \param[in] parameter_count The number of parameters to query.
1604/// \param[in] parameters The list of parameters to query.
1605/// \param[out] parameter_values The list of current values for
1606/// the parameters. Note that each entry in the value array is a pointer to
1607/// storage that will receive the actual value. If the attribute's type is
1608/// a pointer itself, please closely read the documentation for that
1609/// attribute type for any other data passing requirements.
1610/// \return VdpStatus The completion status of the operation.
1611pub type VdpVideoMixerGetParameterValues = Option<
1612    unsafe extern "C" fn(
1613        mixer: VdpVideoMixer,
1614        parameter_count: u32,
1615        parameters: *const VdpVideoMixerParameter,
1616        parameter_values: *const *const libc::c_void,
1617    ) -> VdpStatus,
1618>;
1619/// \brief Retrieve current attribute values.
1620/// \param[in] mixer The mixer to manipulate.
1621/// \param[in] attribute_count The number of attributes to query.
1622/// \param[in] attributes The list of attributes to query.
1623/// \param[out] attribute_values The list of current values for
1624/// the attributes. Note that each entry in the value array is a pointer to
1625/// storage that will receive the actual value. If the attribute's type is
1626/// a pointer itself, please closely read the documentation for that
1627/// attribute type for any other data passing requirements.
1628/// \return VdpStatus The completion status of the operation.
1629pub type VdpVideoMixerGetAttributeValues = Option<
1630    unsafe extern "C" fn(
1631        mixer: VdpVideoMixer,
1632        attribute_count: u32,
1633        attributes: *const VdpVideoMixerAttribute,
1634        attribute_values: *const *const libc::c_void,
1635    ) -> VdpStatus,
1636>;
1637/// \brief Destroy a VdpVideoMixer.
1638/// \param[in] device The device to destroy.
1639/// \return VdpStatus The completion status of the operation.
1640pub type VdpVideoMixerDestroy =
1641    Option<unsafe extern "C" fn(mixer: VdpVideoMixer) -> VdpStatus>;
1642pub const VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD: VdpVideoMixerPictureStructure = 0;
1643pub const VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD: VdpVideoMixerPictureStructure = 1;
1644pub const VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME: VdpVideoMixerPictureStructure = 2;
1645pub type VdpVideoMixerPictureStructure = libc::c_uint;
1646/// \brief Definition of an additional \ref VdpOutputSurface
1647/// "VdpOutputSurface" layer in the composting model.
1648#[repr(C)]
1649#[derive(Debug, Copy, Clone)]
1650pub struct VdpLayer {
1651    /// This field must be filled with VDP_LAYER_VERSION
1652    pub struct_version: u32,
1653    /// The surface to composite from.
1654    pub source_surface: VdpOutputSurface,
1655    /// The sub-rectangle of the source surface to use. If NULL, the
1656    /// entire source surface will be used.
1657    pub source_rect: *const VdpRect,
1658    /// The sub-rectangle of the destination surface to map
1659    /// this layer into. This rectangle is relative to the entire
1660    /// destination surface. This rectangle will be clipped by \ref
1661    /// VdpVideoMixerRender's \b destination_rect. If NULL, the
1662    /// destination rectangle will be sized to match the source
1663    /// rectangle, and will be located at the origin.
1664    pub destination_rect: *const VdpRect,
1665}
1666/// \brief Perform a video post-processing and compositing
1667/// operation.
1668/// \param[in] mixer The mixer object that will perform the
1669/// mixing/rendering operation.
1670/// \param[in] background_surface A background image. If set to any value other
1671/// than VDP_INVALID_HANDLE, the specific surface will be used instead of
1672/// the background color as the first layer in the mixer's compositing
1673/// process.
1674/// \param[in] background_source_rect When background_surface is specified,
1675/// this parameter indicates the portion of background_surface that will
1676/// be used as the background layer. The specified region will be
1677/// extracted and scaled to match the size of destination_rect. If NULL,
1678/// the entire background_surface will be used.
1679/// \param[in] current_picture_structure The picture structure of
1680/// the field/frame to be processed. This field/frame is
1681/// presented in the \b video_surface_current parameter. If
1682/// frame, then all \b video_surface_* parameters are
1683/// assumed to be frames. If field, then all
1684/// video_surface_* parameters are assumed to be fields,
1685/// with alternating top/bottom-ness derived from
1686/// video_surface_current.
1687/// \param[in] video_surfaces_past_count The number of provided
1688/// fields/frames prior to the current picture.
1689/// \param[in] video_surfaces_past The fields/frames prior to the
1690/// current field/frame. Note that array index 0 is the
1691/// field/frame temporally nearest to the current
1692/// field/frame, with increasing array indices used for
1693/// older frames. Unavailable entries may be set to
1694/// \ref VDP_INVALID_HANDLE.
1695/// \param[in] video_surface_current The field/frame to be
1696/// processed.
1697/// \param[in] video_surfaces_future_count The number of provided
1698/// fields/frames following the current picture.
1699/// \param[in] video_surfaces_future The fields/frames that
1700/// follow the current field/frame. Note that array index 0
1701/// is the field/frame temporally nearest to the current
1702/// field/frame, with increasing array indices used for
1703/// newer frames. Unavailable entries may be set to \ref
1704/// VDP_INVALID_HANDLE.
1705/// \param[in] video_source_rect The sub-rectangle of the source
1706/// video surface to extract and process. If NULL, the
1707/// entire surface will be used. Left/right and/or top/bottom
1708/// co-ordinates may be swapped to flip the source. Values
1709/// from outside the video surface are valid and samples
1710/// at those locations will be taken from the nearest edge.
1711/// \param[in] destination_surface
1712/// \param[in] destination_rect The sub-rectangle of the
1713/// destination surface to modify. Note that rectangle clips
1714/// all other actions.
1715/// \param[in] destination_video_rect The sub-rectangle of the
1716/// destination surface that will contain the processed
1717/// video. This rectangle is relative to the entire
1718/// destination surface. This rectangle is clipped by \b
1719/// destination_rect. If NULL, the destination rectangle
1720/// will be sized to match the source rectangle, and will
1721/// be located at the origin.
1722/// \param[in] layer_count The number of additional layers to
1723/// composite above the video.
1724/// \param[in] layers The array of additional layers to composite
1725/// above the video.
1726/// \return VdpStatus The completion status of the operation.
1727///
1728/// For a complete discussion of how to use this API, please see
1729/// \ref video_mixer_usage.
1730pub type VdpVideoMixerRender = Option<
1731    unsafe extern "C" fn(
1732        mixer: VdpVideoMixer,
1733        background_surface: VdpOutputSurface,
1734        background_source_rect: *const VdpRect,
1735        current_picture_structure: VdpVideoMixerPictureStructure,
1736        video_surface_past_count: u32,
1737        video_surface_past: *const VdpVideoSurface,
1738        video_surface_current: VdpVideoSurface,
1739        video_surface_future_count: u32,
1740        video_surface_future: *const VdpVideoSurface,
1741        video_source_rect: *const VdpRect,
1742        destination_surface: VdpOutputSurface,
1743        destination_rect: *const VdpRect,
1744        destination_video_rect: *const VdpRect,
1745        layer_count: u32,
1746        layers: *const VdpLayer,
1747    ) -> VdpStatus,
1748>;
1749/// \brief The representation of a point in time.
1750///
1751/// VdpTime timestamps are intended to be a high-precision timing
1752/// system, potentially independent from any other time domain in
1753/// the system.
1754///
1755/// Time is represented in units of nanoseconds. The origin
1756/// (i.e. the time represented by a value of 0) is implementation
1757/// dependent.
1758pub type VdpTime = u64;
1759/// \brief An opaque handle representing the location where
1760/// video will be presented.
1761///
1762/// VdpPresentationQueueTarget are created using a \ref api_winsys
1763/// specific API, such as \ref
1764/// VdpPresentationQueueTargetCreateX11.
1765pub type VdpPresentationQueueTarget = u32;
1766/// \brief Destroy a VdpPresentationQueueTarget.
1767/// \param[in] presentation_queue_target The target to destroy.
1768/// \return VdpStatus The completion status of the operation.
1769pub type VdpPresentationQueueTargetDestroy = Option<
1770    unsafe extern "C" fn(presentation_queue_target: VdpPresentationQueueTarget) -> VdpStatus,
1771>;
1772/// \brief An opaque handle representing a presentation queue
1773/// object.
1774pub type VdpPresentationQueue = u32;
1775/// \brief Create a VdpPresentationQueue.
1776/// \param[in] device The device that will contain the queue.
1777/// \param[in] presentation_queue_target The location to display
1778/// the content.
1779/// \param[out] presentation_queue The new queue's handle.
1780/// \return VdpStatus The completion status of the operation.
1781///
1782/// Note: The initial value for the background color will be set to
1783/// an implementation-defined value.
1784pub type VdpPresentationQueueCreate = Option<
1785    unsafe extern "C" fn(
1786        device: VdpDevice,
1787        presentation_queue_target: VdpPresentationQueueTarget,
1788        presentation_queue: *mut VdpPresentationQueue,
1789    ) -> VdpStatus,
1790>;
1791/// \brief Destroy a VdpPresentationQueue.
1792/// \param[in] presentation_queue The queue to destroy.
1793/// \return VdpStatus The completion status of the operation.
1794pub type VdpPresentationQueueDestroy = Option<
1795    unsafe extern "C" fn(presentation_queue: VdpPresentationQueue) -> VdpStatus,
1796>;
1797/// \brief Configure the background color setting.
1798/// \param[in] presentation_queue The queue to manipulate.
1799/// \param[in] background_color The new background color.
1800///
1801/// Note: Implementations may choose whether to apply the
1802/// new background color value immediately, or defer it until
1803/// the next surface is presented.
1804pub type VdpPresentationQueueSetBackgroundColor = Option<
1805    unsafe extern "C" fn(
1806        presentation_queue: VdpPresentationQueue,
1807        background_color: *const VdpColor,
1808    ) -> VdpStatus,
1809>;
1810/// \brief Retrieve the current background color setting.
1811/// \param[in] presentation_queue The queue to query.
1812/// \param[out] background_color The current background color.
1813pub type VdpPresentationQueueGetBackgroundColor = Option<
1814    unsafe extern "C" fn(presentation_queue: VdpPresentationQueue, background_color: *mut VdpColor)
1815        -> VdpStatus,
1816>;
1817/// \brief Retrieve the presentation queue's "current" time.
1818/// \param[in] presentation_queue The queue to query.
1819/// \param[out] current_time The current time, which may
1820/// represent a point between display VSYNC events.
1821/// \return VdpStatus The completion status of the operation.
1822pub type VdpPresentationQueueGetTime = Option<
1823    unsafe extern "C" fn(presentation_queue: VdpPresentationQueue, current_time: *mut VdpTime)
1824        -> VdpStatus,
1825>;
1826/// \brief Enter a surface into the presentation queue.
1827/// \param[in] presentation_queue The queue to query.
1828/// \param[in] surface The surface to enter into the queue.
1829/// \param[in] clip_width If set to a non-zero value, the presentation queue
1830/// will display only clip_width pixels of the surface (anchored to the
1831/// top-left corner of the surface.
1832/// \param[in] clip_height If set to a non-zero value, the presentation queue
1833/// will display only clip_height lines of the surface (anchored to the
1834/// top-left corner of the surface.
1835/// \param[in] earliest_presentation_time The timestamp
1836/// associated with the surface. The presentation queue
1837/// will not display the surface until the presentation
1838/// queue's current time is at least this value.
1839/// \return VdpStatus The completion status of the operation.
1840///
1841/// Applications may choose to allow resizing of the presentation queue target
1842/// (which may be e.g. a regular Window when using an X11-based
1843/// implementation).
1844///
1845/// \b clip_width and \b clip_height may be used to limit the size of the
1846/// displayed region of a surface, in order to match the specific region that
1847/// was rendered to.
1848///
1849/// In turn, this allows the application to allocate over-sized (e.g.
1850/// screen-sized) surfaces, but render to a region that matches the current
1851/// size of the video window.
1852///
1853/// Using this technique, an application's response to window resizing may
1854/// simply be to render to, and display, a different region of the surface,
1855/// rather than de-/re-allocation of surfaces to match the updated window size.
1856///
1857/// Implementations may impose an upper bound on the number of entries
1858/// contained by the presentation queue at a given time. This limit is likely
1859/// different to the number of \ref VdpOutputSurface "VdpOutputSurface"s that
1860/// may be allocated at a given time. This limit applies to entries in the
1861/// QUEUED or VISIBLE state only. In other words, entries that have
1862/// transitioned from a QUEUED or VISIBLE state to an IDLE state do not count
1863/// toward this limit.
1864pub type VdpPresentationQueueDisplay = Option<
1865    unsafe extern "C" fn(
1866        presentation_queue: VdpPresentationQueue,
1867        surface: VdpOutputSurface,
1868        clip_width: u32,
1869        clip_height: u32,
1870        earliest_presentation_time: VdpTime,
1871    ) -> VdpStatus,
1872>;
1873/// \brief Wait for a surface to finish being displayed.
1874/// \param[in] presentation_queue The queue to query.
1875/// \param[in] surface The surface to wait for.
1876/// \param[out] first_presentation_time The timestamp of the
1877/// VSYNC at which this surface was first displayed. Note
1878/// that 0 means the surface was never displayed.
1879/// \return VdpStatus The completion status of the operation.
1880///
1881/// Note that this API would block forever if queried about the surface most
1882/// recently added to a presentation queue. That is because there would be no
1883/// other surface that could possibly replace that surface as the currently
1884/// displayed surface, and hence that surface would never become idle. For
1885/// that reason, this function will return an error in that case.
1886pub type VdpPresentationQueueBlockUntilSurfaceIdle = Option<
1887    unsafe extern "C" fn(
1888        presentation_queue: VdpPresentationQueue,
1889        surface: VdpOutputSurface,
1890        first_presentation_time: *mut VdpTime,
1891    ) -> VdpStatus,
1892>;
1893pub const VDP_PRESENTATION_QUEUE_STATUS_IDLE: VdpPresentationQueueStatus = 0;
1894pub const VDP_PRESENTATION_QUEUE_STATUS_QUEUED: VdpPresentationQueueStatus = 1;
1895pub const VDP_PRESENTATION_QUEUE_STATUS_VISIBLE: VdpPresentationQueueStatus = 2;
1896pub type VdpPresentationQueueStatus = libc::c_uint;
1897/// \brief Poll the current queue status of a surface.
1898/// \param[in] presentation_queue The queue to query.
1899/// \param[in] surface The surface to query.
1900/// \param[out] status The current status of the surface within
1901/// the queue.
1902/// \param[out] first_presentation_time The timestamp of the
1903/// VSYNC at which this surface was first displayed. Note
1904/// that 0 means the surface was never displayed.
1905/// \return VdpStatus The completion status of the operation.
1906pub type VdpPresentationQueueQuerySurfaceStatus = Option<
1907    unsafe extern "C" fn(
1908        presentation_queue: VdpPresentationQueue,
1909        surface: VdpOutputSurface,
1910        status: *mut VdpPresentationQueueStatus,
1911        first_presentation_time: *mut VdpTime,
1912    ) -> VdpStatus,
1913>;
1914/// \brief A callback to notify the client application that a
1915/// device's display has been preempted.
1916/// \param[in] device The device that had its display preempted.
1917/// \param[in] context The client-supplied callback context
1918/// information.
1919/// \return void No return value
1920pub type VdpPreemptionCallback = Option<
1921    unsafe extern "C" fn(device: VdpDevice, context: *mut libc::c_void),
1922>;
1923/// \brief Configure the display preemption callback.
1924/// \param[in] device The device to be monitored for preemption.
1925/// \param[in] callback The client application's callback
1926/// function. If NULL, the callback is unregistered.
1927/// \param[in] context The client-supplied callback context
1928/// information. This information will be passed to the
1929/// callback function if/when invoked.
1930/// \return VdpStatus The completion status of the operation.
1931pub type VdpPreemptionCallbackRegister = Option<
1932    unsafe extern "C" fn(
1933        device: VdpDevice,
1934        callback: VdpPreemptionCallback,
1935        context: *mut libc::c_void,
1936    ) -> VdpStatus,
1937>;
1938/// \brief A type suitable for \ref VdpGetProcAddress
1939/// "VdpGetProcAddress"'s \b function_id parameter.
1940pub type VdpFuncId = u32;
1941/// \brief Retrieve a VDPAU function pointer.
1942/// \param[in] device The device that the function will operate
1943/// against.
1944/// \param[in] function_id The specific function to retrieve.
1945/// \param[out] function_pointer The actual pointer for the
1946/// application to call.
1947/// \return VdpStatus The completion status of the operation.
1948pub type VdpGetProcAddress = Option<
1949    unsafe extern "C" fn(
1950        device: VdpDevice,
1951        function_id: VdpFuncId,
1952        function_pointer: *mut *mut libc::c_void,
1953    ) -> VdpStatus,
1954>;
1955