2 * VDPAU video output driver
4 * Copyright (C) 2008 NVIDIA
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * \defgroup VDPAU_Presentation VDPAU Presentation
27 * Actual decoding and presentation are implemented here.
28 * All necessary frame information is collected through
29 * the "vdpau_render_state" structure after parsing all headers
30 * etc. in libavcodec for different codecs.
41 #include "video_out.h"
42 #include "x11_common.h"
45 #include "subopt-helper.h"
46 #include "libmpcodecs/vfcap.h"
47 #include "libmpcodecs/mp_image.h"
49 #include "libavcodec/vdpau.h"
51 #include "font_load.h"
53 #include "libavutil/common.h"
54 #include "libavutil/mathematics.h"
56 #include "libass/ass.h"
57 #include "libass/ass_mp.h"
59 #define CHECK_ST_ERROR(message) \
60 if (vdp_st != VDP_STATUS_OK) { \
61 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \
62 message, vdp_get_error_string(vdp_st)); \
66 #define CHECK_ST_WARNING(message) \
67 if (vdp_st != VDP_STATUS_OK) \
68 mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \
69 message, vdp_get_error_string(vdp_st));
71 /* number of video and output surfaces */
72 #define NUM_OUTPUT_SURFACES 2
73 #define MAX_VIDEO_SURFACES 50
75 /* number of palette entries */
76 #define PALETTE_SIZE 256
78 /* Initial maximum number of EOSD surfaces */
79 #define EOSD_SURFACES_INITIAL 512
82 * Global variable declaration - VDPAU specific
85 /* Declaration for all variables of win_x11_init_vdpau_procs() and
86 * win_x11_init_vdpau_flip_queue() functions
88 static VdpDevice vdp_device
;
89 static VdpDeviceCreateX11
*vdp_device_create
;
90 static VdpGetProcAddress
*vdp_get_proc_address
;
92 static VdpPresentationQueueTarget vdp_flip_target
;
93 static VdpPresentationQueue vdp_flip_queue
;
95 static VdpDeviceDestroy
*vdp_device_destroy
;
96 static VdpVideoSurfaceCreate
*vdp_video_surface_create
;
97 static VdpVideoSurfaceDestroy
*vdp_video_surface_destroy
;
99 static VdpGetErrorString
*vdp_get_error_string
;
101 /* May be used in software filtering/postprocessing options
102 * in MPlayer (./mplayer -vf ..) if we copy video_surface data to
105 static VdpVideoSurfacePutBitsYCbCr
*vdp_video_surface_put_bits_y_cb_cr
;
106 static VdpOutputSurfacePutBitsNative
*vdp_output_surface_put_bits_native
;
108 static VdpOutputSurfaceCreate
*vdp_output_surface_create
;
109 static VdpOutputSurfaceDestroy
*vdp_output_surface_destroy
;
111 /* VideoMixer puts video_surface data on displayable output_surface. */
112 static VdpVideoMixerCreate
*vdp_video_mixer_create
;
113 static VdpVideoMixerDestroy
*vdp_video_mixer_destroy
;
114 static VdpVideoMixerRender
*vdp_video_mixer_render
;
115 static VdpVideoMixerSetFeatureEnables
*vdp_video_mixer_set_feature_enables
;
116 static VdpVideoMixerSetAttributeValues
*vdp_video_mixer_set_attribute_values
;
118 static VdpPresentationQueueTargetDestroy
*vdp_presentation_queue_target_destroy
;
119 static VdpPresentationQueueCreate
*vdp_presentation_queue_create
;
120 static VdpPresentationQueueDestroy
*vdp_presentation_queue_destroy
;
121 static VdpPresentationQueueDisplay
*vdp_presentation_queue_display
;
122 static VdpPresentationQueueBlockUntilSurfaceIdle
*vdp_presentation_queue_block_until_surface_idle
;
123 static VdpPresentationQueueTargetCreateX11
*vdp_presentation_queue_target_create_x11
;
125 static VdpOutputSurfaceRenderOutputSurface
*vdp_output_surface_render_output_surface
;
126 static VdpOutputSurfacePutBitsIndexed
*vdp_output_surface_put_bits_indexed
;
127 static VdpOutputSurfaceRenderBitmapSurface
*vdp_output_surface_render_bitmap_surface
;
129 static VdpBitmapSurfaceCreate
*vdp_bitmap_surface_create
;
130 static VdpBitmapSurfaceDestroy
*vdp_bitmap_surface_destroy
;
131 static VdpBitmapSurfacePutBitsNative
*vdp_bitmap_surface_putbits_native
;
133 static VdpDecoderCreate
*vdp_decoder_create
;
134 static VdpDecoderDestroy
*vdp_decoder_destroy
;
135 static VdpDecoderRender
*vdp_decoder_render
;
137 static VdpGenerateCSCMatrix
*vdp_generate_csc_matrix
;
139 static void *vdpau_lib_handle
;
140 /* output_surfaces[NUM_OUTPUT_SURFACES] is misused for OSD. */
141 #define osd_surface output_surfaces[NUM_OUTPUT_SURFACES]
142 static VdpOutputSurface output_surfaces
[NUM_OUTPUT_SURFACES
+ 1];
143 static VdpVideoSurface deint_surfaces
[3];
144 static mp_image_t
*deint_mpi
[2];
145 static int output_surface_width
, output_surface_height
;
147 static VdpVideoMixer video_mixer
;
149 static int deint_type
;
150 static int deint_counter
;
151 static int deint_buffer_past_frames
;
153 static float denoise
;
154 static float sharpen
;
155 static int chroma_deint
;
156 static int top_field_first
;
158 static VdpDecoder decoder
;
159 static int decoder_max_refs
;
161 static VdpRect src_rect_vid
;
162 static VdpRect out_rect_vid
;
163 static int border_x
, border_y
;
165 static struct vdpau_render_state surface_render
[MAX_VIDEO_SURFACES
];
166 static int surface_num
;
167 static int vid_surface_num
;
168 static uint32_t vid_width
, vid_height
;
169 static uint32_t image_format
;
170 static VdpChromaType vdp_chroma_type
;
171 static VdpYCbCrFormat vdp_pixel_format
;
174 static unsigned char *index_data
;
175 static int index_data_size
;
176 static uint32_t palette
[PALETTE_SIZE
];
181 VdpBitmapSurface surface
;
187 // List of surfaces to be rendered
189 VdpBitmapSurface surface
;
195 static int eosd_render_count
;
196 static int eosd_surface_count
;
199 static VdpProcamp procamp
;
204 static int visible_buf
;
205 static int int_pause
;
207 static void draw_eosd(void);
209 static void push_deint_surface(VdpVideoSurface surface
)
211 deint_surfaces
[2] = deint_surfaces
[1];
212 deint_surfaces
[1] = deint_surfaces
[0];
213 deint_surfaces
[0] = surface
;
216 static void flip_page(struct vo
*vo
);
217 static void draw_osd(struct vo
*vo
, struct osd_state
*osd
);
218 static void video_to_output_surface(struct vo
*vo
)
223 if (vid_surface_num
< 0)
226 if (deint
< 2 || deint_surfaces
[0] == VDP_INVALID_HANDLE
)
227 push_deint_surface(surface_render
[vid_surface_num
].surface
);
229 for (i
= 0; i
<= !!(deint
> 1); i
++) {
230 int field
= VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME
;
231 VdpOutputSurface output_surface
;
234 //draw_osd(vo, NULL);
238 field
= (top_field_first
== i
) ^ (deint
> 1) ?
239 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD
:
240 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD
;
241 output_surface
= output_surfaces
[surface_num
];
242 vdp_st
= vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue
,
245 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle")
247 vdp_st
= vdp_video_mixer_render(video_mixer
, VDP_INVALID_HANDLE
, 0,
248 field
, 2, deint_surfaces
+ 1,
250 1, &surface_render
[vid_surface_num
].surface
,
253 NULL
, &out_rect_vid
, 0, NULL
);
254 CHECK_ST_WARNING("Error when calling vdp_video_mixer_render")
255 push_deint_surface(surface_render
[vid_surface_num
].surface
);
259 static void resize(struct vo
*vo
)
263 struct vo_rect src_rect
;
264 struct vo_rect dst_rect
;
265 struct vo_rect borders
;
266 calc_src_dst_rects(vo
, vid_width
, vid_height
, &src_rect
, &dst_rect
,
268 out_rect_vid
.x0
= dst_rect
.left
;
269 out_rect_vid
.x1
= dst_rect
.right
;
270 out_rect_vid
.y0
= dst_rect
.top
;
271 out_rect_vid
.y1
= dst_rect
.bottom
;
272 src_rect_vid
.x0
= src_rect
.left
;
273 src_rect_vid
.x1
= src_rect
.right
;
274 src_rect_vid
.y0
= src_rect
.top
;
275 src_rect_vid
.y1
= src_rect
.bottom
;
276 border_x
= borders
.left
;
277 border_y
= borders
.top
;
278 #ifdef CONFIG_FREETYPE
279 // adjust font size to display size
282 vo_osd_changed(OSDTYPE_OSD
);
284 if (output_surface_width
< vo
->dwidth
|| output_surface_height
< vo
->dheight
) {
285 if (output_surface_width
< vo
->dwidth
) {
286 output_surface_width
+= output_surface_width
>> 1;
287 output_surface_width
= FFMAX(output_surface_width
, vo
->dwidth
);
289 if (output_surface_height
< vo
->dheight
) {
290 output_surface_height
+= output_surface_height
>> 1;
291 output_surface_height
= FFMAX(output_surface_height
, vo
->dheight
);
293 // Creation of output_surfaces
294 for (i
= 0; i
<= NUM_OUTPUT_SURFACES
; i
++) {
295 if (output_surfaces
[i
] != VDP_INVALID_HANDLE
)
296 vdp_output_surface_destroy(output_surfaces
[i
]);
297 vdp_st
= vdp_output_surface_create(vdp_device
, VDP_RGBA_FORMAT_B8G8R8A8
,
298 output_surface_width
, output_surface_height
,
299 &output_surfaces
[i
]);
300 CHECK_ST_WARNING("Error when calling vdp_output_surface_create")
301 mp_msg(MSGT_VO
, MSGL_DBG2
, "OUT CREATE: %u\n", output_surfaces
[i
]);
304 video_to_output_surface(vo
);
309 /* Initialize vdp_get_proc_address, called from preinit() */
310 static int win_x11_init_vdpau_procs(struct vo
*vo
)
312 struct vo_x11_state
*x11
= vo
->x11
;
315 struct vdp_function
{
320 const struct vdp_function
*dsc
;
322 static const struct vdp_function vdp_func
[] = {
323 {VDP_FUNC_ID_GET_ERROR_STRING
, &vdp_get_error_string
},
324 {VDP_FUNC_ID_DEVICE_DESTROY
, &vdp_device_destroy
},
325 {VDP_FUNC_ID_VIDEO_SURFACE_CREATE
, &vdp_video_surface_create
},
326 {VDP_FUNC_ID_VIDEO_SURFACE_DESTROY
, &vdp_video_surface_destroy
},
327 {VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR
,
328 &vdp_video_surface_put_bits_y_cb_cr
},
329 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE
,
330 &vdp_output_surface_put_bits_native
},
331 {VDP_FUNC_ID_OUTPUT_SURFACE_CREATE
, &vdp_output_surface_create
},
332 {VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY
, &vdp_output_surface_destroy
},
333 {VDP_FUNC_ID_VIDEO_MIXER_CREATE
, &vdp_video_mixer_create
},
334 {VDP_FUNC_ID_VIDEO_MIXER_DESTROY
, &vdp_video_mixer_destroy
},
335 {VDP_FUNC_ID_VIDEO_MIXER_RENDER
, &vdp_video_mixer_render
},
336 {VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES
,
337 &vdp_video_mixer_set_feature_enables
},
338 {VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES
,
339 &vdp_video_mixer_set_attribute_values
},
340 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY
,
341 &vdp_presentation_queue_target_destroy
},
342 {VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE
, &vdp_presentation_queue_create
},
343 {VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY
,
344 &vdp_presentation_queue_destroy
},
345 {VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY
,
346 &vdp_presentation_queue_display
},
347 {VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE
,
348 &vdp_presentation_queue_block_until_surface_idle
},
349 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11
,
350 &vdp_presentation_queue_target_create_x11
},
351 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE
,
352 &vdp_output_surface_render_output_surface
},
353 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED
,
354 &vdp_output_surface_put_bits_indexed
},
355 {VDP_FUNC_ID_DECODER_CREATE
, &vdp_decoder_create
},
356 {VDP_FUNC_ID_DECODER_RENDER
, &vdp_decoder_render
},
357 {VDP_FUNC_ID_DECODER_DESTROY
, &vdp_decoder_destroy
},
358 {VDP_FUNC_ID_BITMAP_SURFACE_CREATE
, &vdp_bitmap_surface_create
},
359 {VDP_FUNC_ID_BITMAP_SURFACE_DESTROY
, &vdp_bitmap_surface_destroy
},
360 {VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE
,
361 &vdp_bitmap_surface_putbits_native
},
362 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE
,
363 &vdp_output_surface_render_bitmap_surface
},
364 {VDP_FUNC_ID_GENERATE_CSC_MATRIX
, &vdp_generate_csc_matrix
},
368 vdp_st
= vdp_device_create(x11
->display
, x11
->screen
,
369 &vdp_device
, &vdp_get_proc_address
);
370 if (vdp_st
!= VDP_STATUS_OK
) {
371 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Error when calling vdp_device_create_x11: %i\n", vdp_st
);
375 vdp_get_error_string
= NULL
;
376 for (dsc
= vdp_func
; dsc
->pointer
; dsc
++) {
377 vdp_st
= vdp_get_proc_address(vdp_device
, dsc
->id
, dsc
->pointer
);
378 if (vdp_st
!= VDP_STATUS_OK
) {
379 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Error when calling vdp_get_proc_address(function id %d): %s\n", dsc
->id
, vdp_get_error_string
? vdp_get_error_string(vdp_st
) : "?");
386 /* Initialize vdpau_flip_queue, called from config() */
387 static int win_x11_init_vdpau_flip_queue(struct vo
*vo
)
389 struct vo_x11_state
*x11
= vo
->x11
;
392 vdp_st
= vdp_presentation_queue_target_create_x11(vdp_device
, x11
->window
,
394 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_target_create_x11")
396 vdp_st
= vdp_presentation_queue_create(vdp_device
, vdp_flip_target
,
398 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create")
403 static int create_vdp_mixer(VdpChromaType vdp_chroma_type
) {
404 #define VDP_NUM_MIXER_PARAMETER 3
405 #define MAX_NUM_FEATURES 5
408 int feature_count
= 0;
409 VdpVideoMixerFeature features
[MAX_NUM_FEATURES
];
410 VdpBool feature_enables
[MAX_NUM_FEATURES
];
411 static const VdpVideoMixerAttribute denoise_attrib
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL
};
412 const void * const denoise_value
[] = {&denoise
};
413 static const VdpVideoMixerAttribute sharpen_attrib
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL
};
414 const void * const sharpen_value
[] = {&sharpen
};
415 static const VdpVideoMixerAttribute skip_chroma_attrib
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE
};
416 const uint8_t skip_chroma_value
= 1;
417 const void * const skip_chroma_value_ptr
[] = {&skip_chroma_value
};
418 static const VdpVideoMixerParameter parameters
[VDP_NUM_MIXER_PARAMETER
] = {
419 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH
,
420 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT
,
421 VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE
423 const void *const parameter_values
[VDP_NUM_MIXER_PARAMETER
] = {
428 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL
;
430 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL
;
432 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE
;
434 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION
;
436 features
[feature_count
++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS
;
438 vdp_st
= vdp_video_mixer_create(vdp_device
, feature_count
, features
,
439 VDP_NUM_MIXER_PARAMETER
,
440 parameters
, parameter_values
,
442 CHECK_ST_ERROR("Error when calling vdp_video_mixer_create")
444 for (i
= 0; i
< feature_count
; i
++) feature_enables
[i
] = VDP_TRUE
;
446 feature_enables
[0] = VDP_FALSE
;
448 vdp_video_mixer_set_feature_enables(video_mixer
, feature_count
, features
, feature_enables
);
450 vdp_video_mixer_set_attribute_values(video_mixer
, 1, denoise_attrib
, denoise_value
);
452 vdp_video_mixer_set_attribute_values(video_mixer
, 1, sharpen_attrib
, sharpen_value
);
454 vdp_video_mixer_set_attribute_values(video_mixer
, 1, skip_chroma_attrib
, skip_chroma_value_ptr
);
459 // Free everything specific to a certain video file
460 static void free_video_specific(void) {
464 if (decoder
!= VDP_INVALID_HANDLE
)
465 vdp_decoder_destroy(decoder
);
466 decoder
= VDP_INVALID_HANDLE
;
467 decoder_max_refs
= -1;
469 for (i
= 0; i
< 3; i
++)
470 deint_surfaces
[i
] = VDP_INVALID_HANDLE
;
472 for (i
= 0; i
< 2; i
++)
474 deint_mpi
[i
]->usage_count
--;
478 for (i
= 0; i
< MAX_VIDEO_SURFACES
; i
++) {
479 if (surface_render
[i
].surface
!= VDP_INVALID_HANDLE
) {
480 vdp_st
= vdp_video_surface_destroy(surface_render
[i
].surface
);
481 CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy")
483 surface_render
[i
].surface
= VDP_INVALID_HANDLE
;
486 if (video_mixer
!= VDP_INVALID_HANDLE
) {
487 vdp_st
= vdp_video_mixer_destroy(video_mixer
);
488 CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy")
490 video_mixer
= VDP_INVALID_HANDLE
;
493 static int create_vdp_decoder(int max_refs
)
496 VdpDecoderProfile vdp_decoder_profile
;
497 if (decoder
!= VDP_INVALID_HANDLE
)
498 vdp_decoder_destroy(decoder
);
499 switch (image_format
) {
500 case IMGFMT_VDPAU_MPEG1
:
501 vdp_decoder_profile
= VDP_DECODER_PROFILE_MPEG1
;
503 case IMGFMT_VDPAU_MPEG2
:
504 vdp_decoder_profile
= VDP_DECODER_PROFILE_MPEG2_MAIN
;
506 case IMGFMT_VDPAU_H264
:
507 vdp_decoder_profile
= VDP_DECODER_PROFILE_H264_HIGH
;
508 mp_msg(MSGT_VO
, MSGL_V
, "[vdpau] Creating H264 hardware decoder for %d reference frames.\n", max_refs
);
510 case IMGFMT_VDPAU_WMV3
:
511 vdp_decoder_profile
= VDP_DECODER_PROFILE_VC1_MAIN
;
513 case IMGFMT_VDPAU_VC1
:
514 vdp_decoder_profile
= VDP_DECODER_PROFILE_VC1_ADVANCED
;
517 vdp_st
= vdp_decoder_create(vdp_device
, vdp_decoder_profile
,
518 vid_width
, vid_height
, max_refs
, &decoder
);
519 CHECK_ST_WARNING("Failed creating VDPAU decoder");
520 if (vdp_st
!= VDP_STATUS_OK
) {
521 decoder
= VDP_INVALID_HANDLE
;
522 decoder_max_refs
= 0;
525 decoder_max_refs
= max_refs
;
530 * connect to X server, create and map window, initialize all
531 * VDPAU objects, create different surfaces etc.
533 static int config(struct vo
*vo
, uint32_t width
, uint32_t height
,
534 uint32_t d_width
, uint32_t d_height
, uint32_t flags
,
535 char *title
, uint32_t format
)
537 struct vo_x11_state
*x11
= vo
->x11
;
539 XSetWindowAttributes xswa
;
540 XWindowAttributes attribs
;
541 unsigned long xswamask
;
545 int vm
= flags
& VOFLAG_MODESWITCHING
;
548 image_format
= format
;
551 free_video_specific();
552 if (IMGFMT_IS_VDPAU(image_format
) && !create_vdp_decoder(2))
563 XGetWindowAttributes(x11
->display
, DefaultRootWindow(x11
->display
),
565 depth
= attribs
.depth
;
566 if (depth
!= 15 && depth
!= 16 && depth
!= 24 && depth
!= 32)
568 XMatchVisualInfo(x11
->display
, x11
->screen
, depth
, TrueColor
, &vinfo
);
570 xswa
.background_pixel
= 0;
571 xswa
.border_pixel
= 0;
572 /* Do not use CWBackPixel: It leads to VDPAU errors after
573 aspect ratio changes. */
574 xswamask
= CWBorderPixel
;
576 vo_x11_create_vo_window(vo
, &vinfo
, vo
->dx
, vo
->dy
, d_width
, d_height
,
577 flags
, CopyFromParent
, "vdpau", title
);
578 XChangeWindowAttributes(x11
->display
, x11
->window
, xswamask
, &xswa
);
582 /* Grab the mouse pointer in our window */
584 XGrabPointer(x11
->display
, x11
->window
, True
, 0,
585 GrabModeAsync
, GrabModeAsync
,
586 x11
->window
, None
, CurrentTime
);
587 XSetInputFocus(x11
->display
, x11
->window
, RevertToNone
, CurrentTime
);
592 if ((flags
& VOFLAG_FULLSCREEN
) && WinID
<= 0)
595 /* -----VDPAU related code here -------- */
596 if (vdp_flip_queue
== VDP_INVALID_HANDLE
597 && win_x11_init_vdpau_flip_queue(vo
))
600 vdp_chroma_type
= VDP_CHROMA_TYPE_420
;
601 switch (image_format
) {
605 vdp_pixel_format
= VDP_YCBCR_FORMAT_YV12
;
608 vdp_pixel_format
= VDP_YCBCR_FORMAT_NV12
;
611 vdp_pixel_format
= VDP_YCBCR_FORMAT_YUYV
;
612 vdp_chroma_type
= VDP_CHROMA_TYPE_422
;
615 vdp_pixel_format
= VDP_YCBCR_FORMAT_UYVY
;
616 vdp_chroma_type
= VDP_CHROMA_TYPE_422
;
618 if (create_vdp_mixer(vdp_chroma_type
))
622 vid_surface_num
= -1;
628 static void check_events(struct vo
*vo
)
630 int e
= vo_x11_check_events(vo
);
632 if (e
& VO_EVENT_RESIZE
)
635 if ((e
& VO_EVENT_EXPOSE
|| e
& VO_EVENT_RESIZE
) && int_pause
) {
636 /* did we already draw a buffer */
638 /* redraw the last visible buffer */
640 vdp_st
= vdp_presentation_queue_display(vdp_flip_queue
,
641 output_surfaces
[surface_num
],
642 vo
->dwidth
, vo
->dheight
,
644 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
649 static void draw_osd_I8A8(void *ctx
, int x0
, int y0
, int w
, int h
,
650 unsigned char *src
, unsigned char *srca
, int stride
)
652 VdpOutputSurface output_surface
= output_surfaces
[surface_num
];
656 int index_data_size_required
;
657 VdpRect output_indexed_rect_vid
;
658 VdpOutputSurfaceRenderBlendState blend_state
;
663 index_data_size_required
= 2*w
*h
;
664 if (index_data_size
< index_data_size_required
) {
665 index_data
= realloc(index_data
, index_data_size_required
);
666 index_data_size
= index_data_size_required
;
669 // index_data creation, component order - I, A, I, A, .....
670 for (i
= 0; i
< h
; i
++)
671 for (j
= 0; j
< w
; j
++) {
672 index_data
[i
*2*w
+ j
*2] = src
[i
*stride
+j
];
673 index_data
[i
*2*w
+ j
*2 + 1] = -srca
[i
*stride
+j
];
676 output_indexed_rect_vid
.x0
= x0
;
677 output_indexed_rect_vid
.y0
= y0
;
678 output_indexed_rect_vid
.x1
= x0
+ w
;
679 output_indexed_rect_vid
.y1
= y0
+ h
;
683 // write source_data to osd_surface.
684 vdp_st
= vdp_output_surface_put_bits_indexed(osd_surface
,
685 VDP_INDEXED_FORMAT_I8A8
,
686 (const void *const*)&index_data
,
688 &output_indexed_rect_vid
,
689 VDP_COLOR_TABLE_FORMAT_B8G8R8X8
,
691 CHECK_ST_WARNING("Error when calling vdp_output_surface_put_bits_indexed")
693 blend_state
.struct_version
= VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION
;
694 blend_state
.blend_factor_source_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE
;
695 blend_state
.blend_factor_source_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE
;
696 blend_state
.blend_factor_destination_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
;
697 blend_state
.blend_factor_destination_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
;
698 blend_state
.blend_equation_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
699 blend_state
.blend_equation_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
701 vdp_st
= vdp_output_surface_render_output_surface(output_surface
,
702 &output_indexed_rect_vid
,
704 &output_indexed_rect_vid
,
707 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
);
708 CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface")
711 static void draw_eosd(void) {
713 VdpOutputSurface output_surface
= output_surfaces
[surface_num
];
714 VdpOutputSurfaceRenderBlendState blend_state
;
717 blend_state
.struct_version
= VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION
;
718 blend_state
.blend_factor_source_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA
;
719 blend_state
.blend_factor_source_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE
;
720 blend_state
.blend_factor_destination_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
;
721 blend_state
.blend_factor_destination_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA
;
722 blend_state
.blend_equation_color
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
723 blend_state
.blend_equation_alpha
= VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD
;
725 for (i
=0; i
<eosd_render_count
; i
++) {
726 vdp_st
= vdp_output_surface_render_bitmap_surface(
727 output_surface
, &eosd_targets
[i
].dest
,
728 eosd_targets
[i
].surface
, &eosd_targets
[i
].source
,
729 &eosd_targets
[i
].color
, &blend_state
,
730 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0
);
731 CHECK_ST_WARNING("EOSD: Error when rendering")
735 static void generate_eosd(mp_eosd_images_t
*imgs
) {
739 ass_image_t
*img
= imgs
->imgs
;
742 // Nothing changed, no need to redraw
743 if (imgs
->changed
== 0)
745 eosd_render_count
= 0;
746 // There's nothing to render!
750 if (imgs
->changed
== 1)
751 goto eosd_skip_upload
;
753 for (j
=0; j
<eosd_surface_count
; j
++)
754 eosd_surfaces
[j
].in_use
= 0;
756 for (i
= img
; i
; i
= i
->next
) {
757 // Try to reuse a suitable surface
759 for (j
=0; j
<eosd_surface_count
; j
++) {
760 if (eosd_surfaces
[j
].surface
!= VDP_INVALID_HANDLE
&& !eosd_surfaces
[j
].in_use
&&
761 eosd_surfaces
[j
].w
>= i
->w
&& eosd_surfaces
[j
].h
>= i
->h
) {
766 // None found, allocate a new surface
768 for (j
=0; j
<eosd_surface_count
; j
++) {
769 if (!eosd_surfaces
[j
].in_use
) {
770 if (eosd_surfaces
[j
].surface
!= VDP_INVALID_HANDLE
)
771 vdp_bitmap_surface_destroy(eosd_surfaces
[j
].surface
);
776 // Allocate new space for surface/target arrays
778 j
= found
= eosd_surface_count
;
779 eosd_surface_count
= eosd_surface_count
? eosd_surface_count
*2 : EOSD_SURFACES_INITIAL
;
780 eosd_surfaces
= realloc(eosd_surfaces
, eosd_surface_count
* sizeof(*eosd_surfaces
));
781 eosd_targets
= realloc(eosd_targets
, eosd_surface_count
* sizeof(*eosd_targets
));
782 for(j
=found
; j
<eosd_surface_count
; j
++) {
783 eosd_surfaces
[j
].surface
= VDP_INVALID_HANDLE
;
784 eosd_surfaces
[j
].in_use
= 0;
787 vdp_st
= vdp_bitmap_surface_create(vdp_device
, VDP_RGBA_FORMAT_A8
,
788 i
->w
, i
->h
, VDP_TRUE
, &eosd_surfaces
[found
].surface
);
789 CHECK_ST_WARNING("EOSD: error when creating surface")
790 eosd_surfaces
[found
].w
= i
->w
;
791 eosd_surfaces
[found
].h
= i
->h
;
793 eosd_surfaces
[found
].in_use
= 1;
794 eosd_targets
[eosd_render_count
].surface
= eosd_surfaces
[found
].surface
;
799 vdp_st
= vdp_bitmap_surface_putbits_native(eosd_targets
[eosd_render_count
].surface
,
800 (const void *) &i
->bitmap
, &i
->stride
, &destRect
);
801 CHECK_ST_WARNING("EOSD: putbits failed")
806 eosd_render_count
= 0;
807 for (i
= img
; i
; i
= i
->next
) {
808 // Render dest, color, etc.
809 eosd_targets
[eosd_render_count
].color
.alpha
= 1.0 - ((i
->color
>> 0) & 0xff) / 255.0;
810 eosd_targets
[eosd_render_count
].color
.blue
= ((i
->color
>> 8) & 0xff) / 255.0;
811 eosd_targets
[eosd_render_count
].color
.green
= ((i
->color
>> 16) & 0xff) / 255.0;
812 eosd_targets
[eosd_render_count
].color
.red
= ((i
->color
>> 24) & 0xff) / 255.0;
813 eosd_targets
[eosd_render_count
].dest
.x0
= i
->dst_x
;
814 eosd_targets
[eosd_render_count
].dest
.y0
= i
->dst_y
;
815 eosd_targets
[eosd_render_count
].dest
.x1
= i
->w
+ i
->dst_x
;
816 eosd_targets
[eosd_render_count
].dest
.y1
= i
->h
+ i
->dst_y
;
817 eosd_targets
[eosd_render_count
].source
.x0
= 0;
818 eosd_targets
[eosd_render_count
].source
.y0
= 0;
819 eosd_targets
[eosd_render_count
].source
.x1
= i
->w
;
820 eosd_targets
[eosd_render_count
].source
.y1
= i
->h
;
825 static void draw_osd(struct vo
*vo
, struct osd_state
*osd
)
827 mp_msg(MSGT_VO
, MSGL_DBG2
, "DRAW_OSD\n");
829 osd_draw_text_ext(osd
, vo
->dwidth
, vo
->dheight
, border_x
, border_y
,
830 border_x
, border_y
, vid_width
, vid_height
,
834 static void flip_page(struct vo
*vo
)
837 mp_msg(MSGT_VO
, MSGL_DBG2
, "\nFLIP_PAGE VID:%u -> OUT:%u\n",
838 surface_render
[vid_surface_num
].surface
, output_surfaces
[surface_num
]);
840 vdp_st
= vdp_presentation_queue_display(vdp_flip_queue
, output_surfaces
[surface_num
],
841 vo
->dwidth
, vo
->dheight
,
843 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
845 surface_num
= (surface_num
+ 1) % NUM_OUTPUT_SURFACES
;
849 static int draw_slice(struct vo
*vo
, uint8_t *image
[], int stride
[], int w
,
853 struct vdpau_render_state
*rndr
= (struct vdpau_render_state
*)image
[0];
854 int max_refs
= image_format
== IMGFMT_VDPAU_H264
? rndr
->info
.h264
.num_ref_frames
: 2;
855 if (!IMGFMT_IS_VDPAU(image_format
))
857 if ((decoder
== VDP_INVALID_HANDLE
|| decoder_max_refs
< max_refs
)
858 && !create_vdp_decoder(max_refs
))
861 vdp_st
= vdp_decoder_render(decoder
, rndr
->surface
, (void *)&rndr
->info
, rndr
->bitstream_buffers_used
, rndr
->bitstream_buffers
);
862 CHECK_ST_WARNING("Failed VDPAU decoder rendering");
867 static int draw_frame(struct vo
*vo
, uint8_t *src
[])
872 static struct vdpau_render_state
*get_surface(int number
)
874 if (number
> MAX_VIDEO_SURFACES
)
876 if (surface_render
[number
].surface
== VDP_INVALID_HANDLE
) {
878 vdp_st
= vdp_video_surface_create(vdp_device
, vdp_chroma_type
,
879 vid_width
, vid_height
,
880 &surface_render
[number
].surface
);
881 CHECK_ST_WARNING("Error when calling vdp_video_surface_create")
882 if (vdp_st
!= VDP_STATUS_OK
)
885 mp_msg(MSGT_VO
, MSGL_DBG2
, "VID CREATE: %u\n", surface_render
[number
].surface
);
886 return &surface_render
[number
];
889 static uint32_t draw_image(struct vo
*vo
, mp_image_t
*mpi
)
891 if (IMGFMT_IS_VDPAU(image_format
)) {
892 struct vdpau_render_state
*rndr
= mpi
->priv
;
893 vid_surface_num
= rndr
- surface_render
;
894 if (deint_buffer_past_frames
) {
897 deint_mpi
[1]->usage_count
--;
898 deint_mpi
[1] = deint_mpi
[0];
901 } else if (!(mpi
->flags
& MP_IMGFLAG_DRAW_CALLBACK
)) {
903 void *destdata
[3] = {mpi
->planes
[0], mpi
->planes
[2], mpi
->planes
[1]};
904 struct vdpau_render_state
*rndr
= get_surface(deint_counter
);
905 deint_counter
= (deint_counter
+ 1) % 3;
906 vid_surface_num
= rndr
- surface_render
;
907 if (image_format
== IMGFMT_NV12
)
908 destdata
[1] = destdata
[2];
909 vdp_st
= vdp_video_surface_put_bits_y_cb_cr(rndr
->surface
,
911 (const void *const*)destdata
,
912 mpi
->stride
); // pitch
913 CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr")
915 if (mpi
->fields
& MP_IMGFIELD_ORDERED
)
916 top_field_first
= !!(mpi
->fields
& MP_IMGFIELD_TOP_FIRST
);
920 video_to_output_surface(vo
);
924 static uint32_t get_image(mp_image_t
*mpi
)
926 struct vdpau_render_state
*rndr
;
928 // no dr for non-decoding for now
929 if (!IMGFMT_IS_VDPAU(image_format
)) return VO_FALSE
;
930 if (mpi
->type
!= MP_IMGTYPE_NUMBERED
) return VO_FALSE
;
932 rndr
= get_surface(mpi
->number
);
934 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] no surfaces available in get_image\n");
935 // TODO: this probably breaks things forever, provide a dummy buffer?
938 mpi
->flags
|= MP_IMGFLAG_DIRECT
;
939 mpi
->stride
[0] = mpi
->stride
[1] = mpi
->stride
[2] = 0;
940 mpi
->planes
[0] = mpi
->planes
[1] = mpi
->planes
[2] = NULL
;
941 // hack to get around a check and to avoid a special-case in vd_ffmpeg.c
942 mpi
->planes
[0] = (void *)rndr
;
948 static int query_format(uint32_t format
)
950 int default_flags
= VFCAP_CSP_SUPPORTED
| VFCAP_CSP_SUPPORTED_BY_HW
| VFCAP_HWSCALE_UP
| VFCAP_HWSCALE_DOWN
| VFCAP_OSD
| VFCAP_EOSD
| VFCAP_EOSD_UNSCALED
;
958 return default_flags
| VOCAP_NOSLICES
;
959 case IMGFMT_VDPAU_MPEG1
:
960 case IMGFMT_VDPAU_MPEG2
:
961 case IMGFMT_VDPAU_H264
:
962 case IMGFMT_VDPAU_WMV3
:
963 case IMGFMT_VDPAU_VC1
:
964 return default_flags
;
969 static void DestroyVdpauObjects(void)
974 free_video_specific();
976 vdp_st
= vdp_presentation_queue_destroy(vdp_flip_queue
);
977 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy")
979 vdp_st
= vdp_presentation_queue_target_destroy(vdp_flip_target
);
980 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_target_destroy")
982 for (i
= 0; i
<= NUM_OUTPUT_SURFACES
; i
++) {
983 vdp_st
= vdp_output_surface_destroy(output_surfaces
[i
]);
984 output_surfaces
[i
] = VDP_INVALID_HANDLE
;
985 CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy")
988 for (i
= 0; i
<eosd_surface_count
; i
++) {
989 if (eosd_surfaces
[i
].surface
!= VDP_INVALID_HANDLE
) {
990 vdp_st
= vdp_bitmap_surface_destroy(eosd_surfaces
[i
].surface
);
991 CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy")
993 eosd_surfaces
[i
].surface
= VDP_INVALID_HANDLE
;
996 vdp_st
= vdp_device_destroy(vdp_device
);
997 CHECK_ST_WARNING("Error when calling vdp_device_destroy")
1000 static void uninit(struct vo
*vo
)
1002 if (!vo
->config_count
)
1006 /* Destroy all vdpau objects */
1007 DestroyVdpauObjects();
1012 free(eosd_surfaces
);
1013 eosd_surfaces
= NULL
;
1015 eosd_targets
= NULL
;
1017 #ifdef CONFIG_XF86VM
1022 dlclose(vdpau_lib_handle
);
1025 static const opt_t subopts
[] = {
1026 {"deint", OPT_ARG_INT
, &deint
, (opt_test_f
)int_non_neg
},
1027 {"chroma-deint", OPT_ARG_BOOL
, &chroma_deint
, NULL
},
1028 {"pullup", OPT_ARG_BOOL
, &pullup
, NULL
},
1029 {"denoise", OPT_ARG_FLOAT
, &denoise
, NULL
},
1030 {"sharpen", OPT_ARG_FLOAT
, &sharpen
, NULL
},
1034 static const char help_msg
[] =
1035 "\n-vo vdpau command line help:\n"
1036 "Example: mplayer -vo vdpau:deint=2\n"
1038 " deint (all modes > 0 respect -field-dominance)\n"
1039 " 0: no deinterlacing\n"
1040 " 1: only show first field\n"
1041 " 2: bob deinterlacing\n"
1042 " 3: temporal deinterlacing (resource-hungry)\n"
1043 " 4: temporal-spatial deinterlacing (very resource-hungry)\n"
1045 " Operate on luma and chroma when using temporal deinterlacing (default)\n"
1046 " Use nochroma-deint to speed up temporal deinterlacing\n"
1048 " Try to apply inverse-telecine (needs temporal deinterlacing)\n"
1050 " Apply denoising, argument is strength from 0.0 to 1.0\n"
1052 " Apply sharpening or softening, argument is strength from -1.0 to 1.0\n"
1055 static int preinit(struct vo
*vo
, const char *arg
)
1058 static const char *vdpaulibrary
= "libvdpau.so.1";
1059 static const char *vdpau_device_create
= "vdp_device_create_x11";
1064 deint_buffer_past_frames
= 0;
1065 deint_mpi
[0] = deint_mpi
[1] = NULL
;
1070 if (subopt_parse(arg
, subopts
) != 0) {
1071 mp_msg(MSGT_VO
, MSGL_FATAL
, help_msg
);
1077 deint_buffer_past_frames
= 1;
1079 vdpau_lib_handle
= dlopen(vdpaulibrary
, RTLD_LAZY
);
1080 if (!vdpau_lib_handle
) {
1081 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Could not open dynamic library %s\n",
1085 vdp_device_create
= dlsym(vdpau_lib_handle
, vdpau_device_create
);
1086 if (!vdp_device_create
) {
1087 mp_msg(MSGT_VO
, MSGL_ERR
, "[vdpau] Could not find function %s in %s\n",
1088 vdpau_device_create
, vdpaulibrary
);
1091 if (!vo_init(vo
) || win_x11_init_vdpau_procs(vo
))
1094 decoder
= VDP_INVALID_HANDLE
;
1095 for (i
= 0; i
< MAX_VIDEO_SURFACES
; i
++)
1096 surface_render
[i
].surface
= VDP_INVALID_HANDLE
;
1097 video_mixer
= VDP_INVALID_HANDLE
;
1098 for (i
= 0; i
<= NUM_OUTPUT_SURFACES
; i
++)
1099 output_surfaces
[i
] = VDP_INVALID_HANDLE
;
1100 vdp_flip_queue
= VDP_INVALID_HANDLE
;
1101 output_surface_width
= output_surface_height
= -1;
1103 // full grayscale palette.
1104 for (i
= 0; i
< PALETTE_SIZE
; ++i
)
1105 palette
[i
] = (i
<< 16) | (i
<< 8) | i
;
1107 index_data_size
= 0;
1109 eosd_surface_count
= eosd_render_count
= 0;
1110 eosd_surfaces
= NULL
;
1111 eosd_targets
= NULL
;
1113 procamp
.struct_version
= VDP_PROCAMP_VERSION
;
1114 procamp
.brightness
= 0.0;
1115 procamp
.contrast
= 1.0;
1116 procamp
.saturation
= 1.0;
1122 static int get_equalizer(const char *name
, int *value
) {
1123 if (!strcasecmp(name
, "brightness"))
1124 *value
= procamp
.brightness
* 100;
1125 else if (!strcasecmp(name
, "contrast"))
1126 *value
= (procamp
.contrast
-1.0) * 100;
1127 else if (!strcasecmp(name
, "saturation"))
1128 *value
= (procamp
.saturation
-1.0) * 100;
1129 else if (!strcasecmp(name
, "hue"))
1130 *value
= procamp
.hue
* 100 / M_PI
;
1136 static int set_equalizer(const char *name
, int value
) {
1138 VdpCSCMatrix matrix
;
1139 static const VdpVideoMixerAttribute attributes
[] = {VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX
};
1140 const void *attribute_values
[] = {&matrix
};
1142 if (!strcasecmp(name
, "brightness"))
1143 procamp
.brightness
= value
/ 100.0;
1144 else if (!strcasecmp(name
, "contrast"))
1145 procamp
.contrast
= value
/ 100.0 + 1.0;
1146 else if (!strcasecmp(name
, "saturation"))
1147 procamp
.saturation
= value
/ 100.0 + 1.0;
1148 else if (!strcasecmp(name
, "hue"))
1149 procamp
.hue
= value
/ 100.0 * M_PI
;
1153 vdp_st
= vdp_generate_csc_matrix(&procamp
, VDP_COLOR_STANDARD_ITUR_BT_601
,
1155 CHECK_ST_WARNING("Error when generating CSC matrix")
1156 vdp_st
= vdp_video_mixer_set_attribute_values(video_mixer
, 1, attributes
,
1158 CHECK_ST_WARNING("Error when setting CSC matrix")
1162 static int control(struct vo
*vo
, uint32_t request
, void *data
)
1165 case VOCTRL_GET_DEINTERLACE
:
1166 *(int*)data
= deint
;
1168 case VOCTRL_SET_DEINTERLACE
:
1169 deint
= *(int*)data
;
1172 if (deint_type
> 2) {
1174 VdpVideoMixerFeature features
[1] =
1176 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL
:
1177 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL
};
1178 VdpBool feature_enables
[1] = {deint
? VDP_TRUE
: VDP_FALSE
};
1179 vdp_st
= vdp_video_mixer_set_feature_enables(video_mixer
, 1,
1182 CHECK_ST_WARNING("Error changing deinterlacing settings")
1183 deint_buffer_past_frames
= 1;
1187 return (int_pause
= 1);
1189 return (int_pause
= 0);
1190 case VOCTRL_QUERY_FORMAT
:
1191 return query_format(*(uint32_t *)data
);
1192 case VOCTRL_GET_IMAGE
:
1193 return get_image(data
);
1194 case VOCTRL_DRAW_IMAGE
:
1195 return draw_image(vo
, data
);
1200 case VOCTRL_FULLSCREEN
:
1201 vo_x11_fullscreen(vo
);
1204 case VOCTRL_GET_PANSCAN
:
1206 case VOCTRL_SET_PANSCAN
:
1209 case VOCTRL_SET_EQUALIZER
: {
1210 struct voctrl_set_equalizer_args
*args
= data
;
1211 return set_equalizer(args
->name
, args
->value
);
1213 case VOCTRL_GET_EQUALIZER
:
1215 struct voctrl_get_equalizer_args
*args
= data
;
1216 return get_equalizer(args
->name
, args
->valueptr
);
1221 case VOCTRL_UPDATE_SCREENINFO
:
1222 update_xinerama_info(vo
);
1224 case VOCTRL_DRAW_EOSD
:
1227 generate_eosd(data
);
1230 case VOCTRL_GET_EOSD_RES
: {
1231 mp_eosd_res_t
*r
= data
;
1232 r
->mt
= r
->mb
= r
->ml
= r
->mr
= 0;
1234 r
->w
= vo
->opts
->vo_screenwidth
;
1235 r
->h
= vo
->opts
->vo_screenheight
;
1236 r
->ml
= r
->mr
= border_x
;
1237 r
->mt
= r
->mb
= border_y
;
1248 const struct vo_driver video_out_vdpau
= {
1250 .info
= &(struct vo_info_s
){
1253 "Rajib Mahapatra <rmahapatra@nvidia.com> and others",
1259 .draw_frame
= draw_frame
,
1260 .draw_slice
= draw_slice
,
1261 .draw_osd
= draw_osd
,
1262 .flip_page
= flip_page
,
1263 .check_events
= check_events
,