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 VDPAU_MSG(VDPAU_TRACE
, "[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 vlVdpVideoMixer
*vmixer
;
94 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Destroying VideoMixer\n");
96 vmixer
= vlGetDataHTAB(mixer
);
98 return VDP_STATUS_INVALID_HANDLE
;
100 vmixer
->compositor
->destroy(vmixer
->compositor
);
104 return VDP_STATUS_OK
;
108 vlVdpVideoMixerSetFeatureEnables(VdpVideoMixer mixer
,
109 uint32_t feature_count
,
110 VdpVideoMixerFeature
const *features
,
111 VdpBool
const *feature_enables
)
113 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Setting VideoMixer features\n");
115 if (!(features
&& feature_enables
))
116 return VDP_STATUS_INVALID_POINTER
;
118 vlVdpVideoMixer
*vmixer
= vlGetDataHTAB(mixer
);
120 return VDP_STATUS_INVALID_HANDLE
;
126 return VDP_STATUS_OK
;
129 VdpStatus
vlVdpVideoMixerRender(VdpVideoMixer mixer
,
130 VdpOutputSurface background_surface
,
131 VdpRect
const *background_source_rect
,
132 VdpVideoMixerPictureStructure current_picture_structure
,
133 uint32_t video_surface_past_count
,
134 VdpVideoSurface
const *video_surface_past
,
135 VdpVideoSurface video_surface_current
,
136 uint32_t video_surface_future_count
,
137 VdpVideoSurface
const *video_surface_future
,
138 VdpRect
const *video_source_rect
,
139 VdpOutputSurface destination_surface
,
140 VdpRect
const *destination_rect
,
141 VdpRect
const *destination_video_rect
,
142 uint32_t layer_count
,
143 VdpLayer
const *layers
)
145 vlVdpVideoMixer
*vmixer
;
147 vlVdpOutputSurface
*dst
;
149 vmixer
= vlGetDataHTAB(mixer
);
151 return VDP_STATUS_INVALID_HANDLE
;
153 surf
= vlGetDataHTAB(video_surface_current
);
155 return VDP_STATUS_INVALID_HANDLE
;
157 dst
= vlGetDataHTAB(destination_surface
);
159 return VDP_STATUS_INVALID_HANDLE
;
161 vmixer
->compositor
->clear_layers(vmixer
->compositor
);
162 vmixer
->compositor
->set_buffer_layer(vmixer
->compositor
, 0, surf
->video_buffer
, NULL
, NULL
);
163 vmixer
->compositor
->render_picture(vmixer
->compositor
, PIPE_MPEG12_PICTURE_TYPE_FRAME
,
164 dst
->surface
, NULL
, NULL
);
166 return VDP_STATUS_OK
;
170 vlVdpVideoMixerSetAttributeValues(VdpVideoMixer mixer
,
171 uint32_t attribute_count
,
172 VdpVideoMixerAttribute
const *attributes
,
173 void const *const *attribute_values
)
175 if (!(attributes
&& attribute_values
))
176 return VDP_STATUS_INVALID_POINTER
;
178 vlVdpVideoMixer
*vmixer
= vlGetDataHTAB(mixer
);
180 return VDP_STATUS_INVALID_HANDLE
;
183 * TODO: Implement the function
187 return VDP_STATUS_OK
;
191 vlVdpVideoMixerGetFeatureSupport(VdpVideoMixer mixer
,
192 uint32_t feature_count
,
193 VdpVideoMixerFeature
const *features
,
194 VdpBool
*feature_supports
)
196 return VDP_STATUS_NO_IMPLEMENTATION
;
200 vlVdpVideoMixerGetFeatureEnables(VdpVideoMixer mixer
,
201 uint32_t feature_count
,
202 VdpVideoMixerFeature
const *features
,
203 VdpBool
*feature_enables
)
205 return VDP_STATUS_NO_IMPLEMENTATION
;
209 vlVdpVideoMixerGetParameterValues(VdpVideoMixer mixer
,
210 uint32_t parameter_count
,
211 VdpVideoMixerParameter
const *parameters
,
212 void *const *parameter_values
)
214 return VDP_STATUS_NO_IMPLEMENTATION
;
218 vlVdpVideoMixerGetAttributeValues(VdpVideoMixer mixer
,
219 uint32_t attribute_count
,
220 VdpVideoMixerAttribute
const *attributes
,
221 void *const *attribute_values
)
223 return VDP_STATUS_NO_IMPLEMENTATION
;
227 vlVdpGenerateCSCMatrix(VdpProcamp
*procamp
,
228 VdpColorStandard standard
,
229 VdpCSCMatrix
*csc_matrix
)
231 VDPAU_MSG(VDPAU_TRACE
, "[VDPAU] Generating CSCMatrix\n");
232 if (!(csc_matrix
&& procamp
))
233 return VDP_STATUS_INVALID_POINTER
;
235 return VDP_STATUS_OK
;