1 /**************************************************************************
3 * Copyright 2010 Thomas Balling Sørensen.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 #include <vdpau/vdpau.h>
30 #include <util/u_memory.h>
31 #include <util/u_debug.h>
33 #include <vl/vl_csc.h>
35 #include "vdpau_private.h"
38 vlVdpVideoMixerCreate(VdpDevice device
,
39 uint32_t feature_count
,
40 VdpVideoMixerFeature
const *features
,
41 uint32_t parameter_count
,
42 VdpVideoMixerParameter
const *parameters
,
43 void const *const *parameter_values
,
46 vlVdpVideoMixer
*vmixer
= NULL
;
47 struct pipe_video_context
*context
;
51 debug_printf("[VDPAU] Creating VideoMixer\n");
53 vlVdpDevice
*dev
= vlGetDataHTAB(device
);
55 return VDP_STATUS_INVALID_HANDLE
;
57 context
= dev
->context
->vpipe
;
59 vmixer
= CALLOC(1, sizeof(vlVdpVideoMixer
));
61 return VDP_STATUS_RESOURCES
;
64 vmixer
->compositor
= context
->create_compositor(context
);
68 debug_get_bool_option("G3DVL_NO_CSC", FALSE
) ?
69 VL_CSC_COLOR_STANDARD_IDENTITY
: VL_CSC_COLOR_STANDARD_BT_601
,
72 vmixer
->compositor
->set_csc_matrix(vmixer
->compositor
, csc
);
75 * TODO: Handle features and parameters
78 *mixer
= vlAddDataHTAB(vmixer
);
80 ret
= VDP_STATUS_ERROR
;
90 vlVdpVideoMixerDestroy(VdpVideoMixer mixer
)
92 return VDP_STATUS_NO_IMPLEMENTATION
;
96 vlVdpVideoMixerSetFeatureEnables(VdpVideoMixer mixer
,
97 uint32_t feature_count
,
98 VdpVideoMixerFeature
const *features
,
99 VdpBool
const *feature_enables
)
101 debug_printf("[VDPAU] Setting VideoMixer features\n");
103 if (!(features
&& feature_enables
))
104 return VDP_STATUS_INVALID_POINTER
;
106 vlVdpVideoMixer
*vmixer
= vlGetDataHTAB(mixer
);
108 return VDP_STATUS_INVALID_HANDLE
;
114 return VDP_STATUS_OK
;
117 VdpStatus
vlVdpVideoMixerRender(VdpVideoMixer mixer
,
118 VdpOutputSurface background_surface
,
119 VdpRect
const *background_source_rect
,
120 VdpVideoMixerPictureStructure current_picture_structure
,
121 uint32_t video_surface_past_count
,
122 VdpVideoSurface
const *video_surface_past
,
123 VdpVideoSurface video_surface_current
,
124 uint32_t video_surface_future_count
,
125 VdpVideoSurface
const *video_surface_future
,
126 VdpRect
const *video_source_rect
,
127 VdpOutputSurface destination_surface
,
128 VdpRect
const *destination_rect
,
129 VdpRect
const *destination_video_rect
,
130 uint32_t layer_count
,
131 VdpLayer
const *layers
)
133 vlVdpVideoMixer
*vmixer
;
135 vlVdpOutputSurface
*dst
;
137 vmixer
= vlGetDataHTAB(mixer
);
139 return VDP_STATUS_INVALID_HANDLE
;
141 surf
= vlGetDataHTAB(video_surface_current
);
143 return VDP_STATUS_INVALID_HANDLE
;
145 dst
= vlGetDataHTAB(destination_surface
);
147 return VDP_STATUS_INVALID_HANDLE
;
149 vmixer
->compositor
->clear_layers(vmixer
->compositor
);
150 vmixer
->compositor
->set_buffer_layer(vmixer
->compositor
, 0, surf
->video_buffer
, NULL
, NULL
);
151 vmixer
->compositor
->render_picture(vmixer
->compositor
, PIPE_MPEG12_PICTURE_TYPE_FRAME
,
152 dst
->surface
, NULL
, NULL
);
154 return VDP_STATUS_OK
;
158 vlVdpVideoMixerSetAttributeValues(VdpVideoMixer mixer
,
159 uint32_t attribute_count
,
160 VdpVideoMixerAttribute
const *attributes
,
161 void const *const *attribute_values
)
163 if (!(attributes
&& attribute_values
))
164 return VDP_STATUS_INVALID_POINTER
;
166 vlVdpVideoMixer
*vmixer
= vlGetDataHTAB(mixer
);
168 return VDP_STATUS_INVALID_HANDLE
;
171 * TODO: Implement the function
175 return VDP_STATUS_OK
;
179 vlVdpVideoMixerGetFeatureSupport(VdpVideoMixer mixer
,
180 uint32_t feature_count
,
181 VdpVideoMixerFeature
const *features
,
182 VdpBool
*feature_supports
)
184 return VDP_STATUS_NO_IMPLEMENTATION
;
188 vlVdpVideoMixerGetFeatureEnables(VdpVideoMixer mixer
,
189 uint32_t feature_count
,
190 VdpVideoMixerFeature
const *features
,
191 VdpBool
*feature_enables
)
193 return VDP_STATUS_NO_IMPLEMENTATION
;
197 vlVdpVideoMixerGetParameterValues(VdpVideoMixer mixer
,
198 uint32_t parameter_count
,
199 VdpVideoMixerParameter
const *parameters
,
200 void *const *parameter_values
)
202 return VDP_STATUS_NO_IMPLEMENTATION
;
206 vlVdpVideoMixerGetAttributeValues(VdpVideoMixer mixer
,
207 uint32_t attribute_count
,
208 VdpVideoMixerAttribute
const *attributes
,
209 void *const *attribute_values
)
211 return VDP_STATUS_NO_IMPLEMENTATION
;