Mercurial > mplayer.hg
annotate libvo/vo_vdpau.c @ 28689:1189f633ca32
Cosmetics: Fix indentation and line length.
author | cehoyos |
---|---|
date | Tue, 24 Feb 2009 22:45:29 +0000 |
parents | 75aebdf41ee9 |
children | fdc03572004c |
rev | line source |
---|---|
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
2 * VDPAU video output driver |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
3 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
4 * Copyright (C) 2008 NVIDIA |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
5 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
6 * This file is part of MPlayer. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
7 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
11 * (at your option) any later version. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
12 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
17 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
21 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
22 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
23 /** |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
24 * \defgroup VDPAU_Presentation VDPAU Presentation |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
25 * \ingroup Decoder |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
26 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
27 * Actual decoding and presentation are implemented here. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
28 * All necessary frame information is collected through |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
29 * the "vdpau_render_state" structure after parsing all headers |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
30 * etc. in libavcodec for different codecs. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
31 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
32 * @{ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
33 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
34 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
35 #include <stdio.h> |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
36 #include <dlfcn.h> |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
37 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
38 #include "config.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
39 #include "mp_msg.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
40 #include "video_out.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
41 #include "video_out_internal.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
42 #include "x11_common.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
43 #include "aspect.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
44 #include "sub.h" |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
45 #include "subopt-helper.h" |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
46 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
47 #include "libavcodec/vdpau.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
48 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
49 #include "gui/interface.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
50 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
51 #include "libavutil/common.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
52 |
28675 | 53 #include "libass/ass.h" |
54 #include "libass/ass_mp.h" | |
55 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
56 static vo_info_t info = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
57 "VDPAU with X11", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
58 "vdpau", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
59 "Rajib Mahapatra <rmahapatra@nvidia.com> and others", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
60 "" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
61 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
62 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
63 LIBVO_EXTERN(vdpau) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
64 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
65 #define CHECK_ST_ERROR(message) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
66 if (vdp_st != VDP_STATUS_OK) { \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
67 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
68 message, vdp_get_error_string(vdp_st)); \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
69 return -1; \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
70 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
71 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
72 #define CHECK_ST_WARNING(message) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
73 if (vdp_st != VDP_STATUS_OK) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
74 mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
75 message, vdp_get_error_string(vdp_st)); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
76 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
77 /* number of video and output surfaces */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
78 #define NUM_OUTPUT_SURFACES 3 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
79 #define MAX_VIDEO_SURFACES 50 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
80 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
81 /* number of palette entries */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
82 #define PALETTE_SIZE 256 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
83 |
28675 | 84 /* Initial maximum number of EOSD surfaces */ |
85 #define EOSD_SURFACES_INITIAL 512 | |
86 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
87 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
88 * Global variable declaration - VDPAU specific |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
89 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
90 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
91 /* Declaration for all variables of win_x11_init_vdpau_procs() and |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
92 * win_x11_init_vdpau_flip_queue() functions |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
93 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
94 static VdpDevice vdp_device; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
95 static VdpDeviceCreateX11 *vdp_device_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
96 static VdpGetProcAddress *vdp_get_proc_address; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
97 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
98 static VdpPresentationQueueTarget vdp_flip_target; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
99 static VdpPresentationQueue vdp_flip_queue; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
100 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
101 static VdpDeviceDestroy *vdp_device_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
102 static VdpVideoSurfaceCreate *vdp_video_surface_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
103 static VdpVideoSurfaceDestroy *vdp_video_surface_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
104 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
105 static VdpGetErrorString *vdp_get_error_string; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
106 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
107 /* May be used in software filtering/postprocessing options |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
108 * in MPlayer (./mplayer -vf ..) if we copy video_surface data to |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
109 * system memory. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
110 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
111 static VdpVideoSurfacePutBitsYCbCr *vdp_video_surface_put_bits_y_cb_cr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
112 static VdpOutputSurfacePutBitsNative *vdp_output_surface_put_bits_native; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
113 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
114 static VdpOutputSurfaceCreate *vdp_output_surface_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
115 static VdpOutputSurfaceDestroy *vdp_output_surface_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
116 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
117 /* VideoMixer puts video_surface data on displayable output_surface. */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
118 static VdpVideoMixerCreate *vdp_video_mixer_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
119 static VdpVideoMixerDestroy *vdp_video_mixer_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
120 static VdpVideoMixerRender *vdp_video_mixer_render; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
121 static VdpVideoMixerSetFeatureEnables *vdp_video_mixer_set_feature_enables; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
122 static VdpVideoMixerSetAttributeValues *vdp_video_mixer_set_attribute_values; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
123 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
124 static VdpPresentationQueueTargetDestroy *vdp_presentation_queue_target_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
125 static VdpPresentationQueueCreate *vdp_presentation_queue_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
126 static VdpPresentationQueueDestroy *vdp_presentation_queue_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
127 static VdpPresentationQueueDisplay *vdp_presentation_queue_display; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
128 static VdpPresentationQueueBlockUntilSurfaceIdle *vdp_presentation_queue_block_until_surface_idle; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
129 static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
130 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
131 /* output_surfaces[2] is used in composite-picture. */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
132 static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
133 static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed; |
28675 | 134 static VdpOutputSurfaceRenderBitmapSurface *vdp_output_surface_render_bitmap_surface; |
135 | |
136 static VdpBitmapSurfaceCreate *vdp_bitmap_surface_create; | |
137 static VdpBitmapSurfaceDestroy *vdp_bitmap_surface_destroy; | |
138 static VdpBitmapSurfacePutBitsNative *vdp_bitmap_surface_putbits_native; | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
139 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
140 static VdpDecoderCreate *vdp_decoder_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
141 static VdpDecoderDestroy *vdp_decoder_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
142 static VdpDecoderRender *vdp_decoder_render; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
143 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
144 static void *vdpau_lib_handle; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
145 static VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
146 static int output_surface_width, output_surface_height; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
147 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
148 static VdpVideoMixer video_mixer; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
149 static int deint; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
150 static int pullup; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
151 static float denoise; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
152 static float sharpen; |
28684 | 153 static int top_field_first; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
154 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
155 static VdpDecoder decoder; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
156 static int decoder_max_refs; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
157 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
158 static VdpRect src_rect_vid; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
159 static VdpRect out_rect_vid; |
28598
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
160 static int border_x, border_y; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
161 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
162 static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
163 static int surface_num; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
164 static int vid_surface_num; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
165 static uint32_t vid_width, vid_height; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
166 static uint32_t image_format; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
167 static const VdpChromaType vdp_chroma_type = VDP_CHROMA_TYPE_420; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
168 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
169 /* draw_osd */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
170 static unsigned char *index_data; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
171 static int index_data_size; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
172 static uint32_t palette[PALETTE_SIZE]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
173 |
28675 | 174 // EOSD |
175 // Pool of surfaces | |
176 struct { | |
177 VdpBitmapSurface surface; | |
178 int w; | |
179 int h; | |
180 char in_use; | |
181 } *eosd_surfaces; | |
182 | |
183 // List of surfaces to be rendered | |
184 struct { | |
185 VdpBitmapSurface surface; | |
186 VdpRect source; | |
187 VdpRect dest; | |
188 VdpColor color; | |
189 } *eosd_targets; | |
190 | |
191 static int eosd_render_count; | |
192 static int eosd_surface_count; | |
193 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
194 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
195 * X11 specific |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
196 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
197 static int visible_buf; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
198 static int int_pause; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
199 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
200 static void video_to_output_surface(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
201 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
202 VdpTime dummy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
203 VdpStatus vdp_st; |
28684 | 204 int i; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
205 if (vid_surface_num < 0) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
206 return; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
207 |
28684 | 208 // we would need to provide 2 past and 1 future frames to allow advanced |
209 // deinterlacing, which is not really possible currently. | |
210 for (i = 0; i <= !!deint; i++) { | |
211 int field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; | |
212 VdpOutputSurface output_surface; | |
213 if (i) | |
214 flip_page(); | |
215 if (deint) | |
216 field = top_field_first == i ? | |
217 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD: | |
218 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; | |
219 output_surface = output_surfaces[surface_num]; | |
220 vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue, | |
221 output_surface, | |
222 &dummy); | |
223 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle") | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
224 |
28689 | 225 vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0, |
226 field, 0, NULL, | |
227 surface_render[vid_surface_num].surface, | |
228 0, NULL, &src_rect_vid, | |
229 output_surface, | |
230 NULL, &out_rect_vid, 0, NULL); | |
231 CHECK_ST_WARNING("Error when calling vdp_video_mixer_render") | |
28684 | 232 } |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
233 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
234 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
235 static void resize(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
236 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
237 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
238 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
239 struct vo_rect src_rect; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
240 struct vo_rect dst_rect; |
28598
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
241 struct vo_rect borders; |
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
242 calc_src_dst_rects(vid_width, vid_height, &src_rect, &dst_rect, &borders, NULL); |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
243 out_rect_vid.x0 = dst_rect.left; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
244 out_rect_vid.x1 = dst_rect.right; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
245 out_rect_vid.y0 = dst_rect.top; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
246 out_rect_vid.y1 = dst_rect.bottom; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
247 src_rect_vid.x0 = src_rect.left; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
248 src_rect_vid.x1 = src_rect.right; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
249 src_rect_vid.y0 = src_rect.top; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
250 src_rect_vid.y1 = src_rect.bottom; |
28598
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
251 border_x = borders.left; |
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
252 border_y = borders.top; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
253 #ifdef CONFIG_FREETYPE |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
254 // adjust font size to display size |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
255 force_load_font = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
256 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
257 vo_osd_changed(OSDTYPE_OSD); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
258 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
259 if (output_surface_width < vo_dwidth || output_surface_height < vo_dheight) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
260 if (output_surface_width < vo_dwidth) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
261 output_surface_width += output_surface_width >> 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
262 output_surface_width = FFMAX(output_surface_width, vo_dwidth); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
263 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
264 if (output_surface_height < vo_dheight) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
265 output_surface_height += output_surface_height >> 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
266 output_surface_height = FFMAX(output_surface_height, vo_dheight); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
267 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
268 // Creation of output_surfaces |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
269 for (i = 0; i < NUM_OUTPUT_SURFACES; i++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
270 if (output_surfaces[i] != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
271 vdp_output_surface_destroy(output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
272 vdp_st = vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
273 output_surface_width, output_surface_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
274 &output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
275 CHECK_ST_WARNING("Error when calling vdp_output_surface_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
276 mp_msg(MSGT_VO, MSGL_DBG2, "OUT CREATE: %u\n", output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
277 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
278 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
279 video_to_output_surface(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
280 if (visible_buf) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
281 flip_page(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
282 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
283 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
284 /* Initialize vdp_get_proc_address, called from preinit() */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
285 static int win_x11_init_vdpau_procs(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
286 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
287 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
288 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
289 struct vdp_function { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
290 const int id; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
291 void *pointer; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
292 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
293 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
294 const struct vdp_function *dsc; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
295 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
296 static const struct vdp_function vdp_func[] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
297 {VDP_FUNC_ID_GET_ERROR_STRING, &vdp_get_error_string}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
298 {VDP_FUNC_ID_DEVICE_DESTROY, &vdp_device_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
299 {VDP_FUNC_ID_VIDEO_SURFACE_CREATE, &vdp_video_surface_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
300 {VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, &vdp_video_surface_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
301 {VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
302 &vdp_video_surface_put_bits_y_cb_cr}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
303 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
304 &vdp_output_surface_put_bits_native}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
305 {VDP_FUNC_ID_OUTPUT_SURFACE_CREATE, &vdp_output_surface_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
306 {VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY, &vdp_output_surface_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
307 {VDP_FUNC_ID_VIDEO_MIXER_CREATE, &vdp_video_mixer_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
308 {VDP_FUNC_ID_VIDEO_MIXER_DESTROY, &vdp_video_mixer_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
309 {VDP_FUNC_ID_VIDEO_MIXER_RENDER, &vdp_video_mixer_render}, |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
310 {VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
311 &vdp_video_mixer_set_feature_enables}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
312 {VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
313 &vdp_video_mixer_set_attribute_values}, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
314 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
315 &vdp_presentation_queue_target_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
316 {VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE, &vdp_presentation_queue_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
317 {VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
318 &vdp_presentation_queue_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
319 {VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
320 &vdp_presentation_queue_display}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
321 {VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
322 &vdp_presentation_queue_block_until_surface_idle}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
323 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
324 &vdp_presentation_queue_target_create_x11}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
325 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
326 &vdp_output_surface_render_output_surface}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
327 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
328 &vdp_output_surface_put_bits_indexed}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
329 {VDP_FUNC_ID_DECODER_CREATE, &vdp_decoder_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
330 {VDP_FUNC_ID_DECODER_RENDER, &vdp_decoder_render}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
331 {VDP_FUNC_ID_DECODER_DESTROY, &vdp_decoder_destroy}, |
28675 | 332 {VDP_FUNC_ID_BITMAP_SURFACE_CREATE, &vdp_bitmap_surface_create}, |
333 {VDP_FUNC_ID_BITMAP_SURFACE_DESTROY, &vdp_bitmap_surface_destroy}, | |
334 {VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE, | |
335 &vdp_bitmap_surface_putbits_native}, | |
336 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE, | |
337 &vdp_output_surface_render_bitmap_surface}, | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
338 {0, NULL} |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
339 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
340 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
341 vdp_st = vdp_device_create(mDisplay, mScreen, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
342 &vdp_device, &vdp_get_proc_address); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
343 if (vdp_st != VDP_STATUS_OK) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
344 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_device_create_x11: %i\n", vdp_st); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
345 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
346 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
347 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
348 for (dsc = vdp_func; dsc->pointer; dsc++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
349 vdp_st = vdp_get_proc_address(vdp_device, dsc->id, dsc->pointer); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
350 if (vdp_st != VDP_STATUS_OK) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
351 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) : "?"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
352 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
353 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
354 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
355 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
356 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
357 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
358 /* Initialize vdpau_flip_queue, called from config() */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
359 static int win_x11_init_vdpau_flip_queue(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
360 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
361 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
362 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
363 vdp_st = vdp_presentation_queue_target_create_x11(vdp_device, vo_window, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
364 &vdp_flip_target); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
365 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_target_create_x11") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
366 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
367 vdp_st = vdp_presentation_queue_create(vdp_device, vdp_flip_target, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
368 &vdp_flip_queue); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
369 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
370 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
371 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
372 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
373 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
374 static int create_vdp_mixer(VdpChromaType vdp_chroma_type) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
375 #define VDP_NUM_MIXER_PARAMETER 3 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
376 #define MAX_NUM_FEATURES 5 |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
377 int i; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
378 VdpStatus vdp_st; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
379 int feature_count = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
380 VdpVideoMixerFeature features[MAX_NUM_FEATURES]; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
381 VdpBool feature_enables[MAX_NUM_FEATURES]; |
28658 | 382 static const VdpVideoMixerAttribute denoise_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL}; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
383 const void * const denoise_value[] = {&denoise}; |
28658 | 384 static const VdpVideoMixerAttribute sharpen_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL}; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
385 const void * const sharpen_value[] = {&sharpen}; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
386 static const VdpVideoMixerParameter parameters[VDP_NUM_MIXER_PARAMETER] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
387 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
388 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
389 VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
390 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
391 const void *const parameter_values[VDP_NUM_MIXER_PARAMETER] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
392 &vid_width, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
393 &vid_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
394 &vdp_chroma_type |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
395 }; |
28684 | 396 if (deint == 2) |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
397 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL; |
28684 | 398 if (deint == 3) |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
399 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
400 if (pullup) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
401 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
402 if (denoise) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
403 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
404 if (sharpen) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
405 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
406 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
407 vdp_st = vdp_video_mixer_create(vdp_device, feature_count, features, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
408 VDP_NUM_MIXER_PARAMETER, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
409 parameters, parameter_values, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
410 &video_mixer); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
411 CHECK_ST_ERROR("Error when calling vdp_video_mixer_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
412 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
413 for (i = 0; i < feature_count; i++) feature_enables[i] = VDP_TRUE; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
414 if (feature_count) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
415 vdp_video_mixer_set_feature_enables(video_mixer, feature_count, features, feature_enables); |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
416 if (denoise) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
417 vdp_video_mixer_set_attribute_values(video_mixer, 1, denoise_attrib, denoise_value); |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
418 if (sharpen) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
419 vdp_video_mixer_set_attribute_values(video_mixer, 1, sharpen_attrib, sharpen_value); |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
420 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
421 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
422 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
423 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
424 // Free everything specific to a certain video file |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
425 static void free_video_specific(void) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
426 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
427 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
428 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
429 if (decoder != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
430 vdp_decoder_destroy(decoder); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
431 decoder = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
432 decoder_max_refs = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
433 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
434 for (i = 0; i < MAX_VIDEO_SURFACES; i++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
435 if (surface_render[i].surface != VDP_INVALID_HANDLE) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
436 vdp_st = vdp_video_surface_destroy(surface_render[i].surface); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
437 CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
438 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
439 surface_render[i].surface = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
440 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
441 |
28676
d5c295360163
Only check for vdp_video_mixer_destroy failure when we actually executed that function.
reimar
parents:
28675
diff
changeset
|
442 if (video_mixer != VDP_INVALID_HANDLE) { |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
443 vdp_st = vdp_video_mixer_destroy(video_mixer); |
28676
d5c295360163
Only check for vdp_video_mixer_destroy failure when we actually executed that function.
reimar
parents:
28675
diff
changeset
|
444 CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy") |
d5c295360163
Only check for vdp_video_mixer_destroy failure when we actually executed that function.
reimar
parents:
28675
diff
changeset
|
445 } |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
446 video_mixer = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
447 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
448 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
449 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
450 * connect to X server, create and map window, initialize all |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
451 * VDPAU objects, create different surfaces etc. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
452 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
453 static int config(uint32_t width, uint32_t height, uint32_t d_width, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
454 uint32_t d_height, uint32_t flags, char *title, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
455 uint32_t format) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
456 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
457 XVisualInfo vinfo; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
458 XSetWindowAttributes xswa; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
459 XWindowAttributes attribs; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
460 unsigned long xswamask; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
461 int depth; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
462 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
463 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
464 int vm = flags & VOFLAG_MODESWITCHING; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
465 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
466 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
467 image_format = format; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
468 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
469 int_pause = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
470 visible_buf = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
471 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
472 #ifdef CONFIG_GUI |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
473 if (use_gui) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
474 guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize our window |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
475 else |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
476 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
477 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
478 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
479 if (vm) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
480 vo_vm_switch(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
481 else |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
482 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
483 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
484 depth = attribs.depth; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
485 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
486 depth = 24; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
487 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
488 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
489 xswa.background_pixel = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
490 xswa.border_pixel = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
491 xswamask = CWBackPixel | CWBorderPixel; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
492 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
493 vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
494 flags, CopyFromParent, "vdpau", title); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
495 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
496 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
497 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
498 if (vm) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
499 /* Grab the mouse pointer in our window */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
500 if (vo_grabpointer) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
501 XGrabPointer(mDisplay, vo_window, True, 0, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
502 GrabModeAsync, GrabModeAsync, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
503 vo_window, None, CurrentTime); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
504 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
505 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
506 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
507 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
508 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
509 if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
510 vo_fs = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
511 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
512 /* -----VDPAU related code here -------- */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
513 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
514 free_video_specific(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
515 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
516 if (vdp_flip_queue == VDP_INVALID_HANDLE && win_x11_init_vdpau_flip_queue()) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
517 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
518 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
519 // video width and height |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
520 vid_width = width; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
521 vid_height = height; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
522 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
523 if (create_vdp_mixer(vdp_chroma_type)) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
524 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
525 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
526 surface_num = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
527 vid_surface_num = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
528 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
529 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
530 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
531 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
532 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
533 static void check_events(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
534 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
535 int e = vo_x11_check_events(mDisplay); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
536 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
537 if (e & VO_EVENT_RESIZE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
538 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
539 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
540 if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
541 /* did we already draw a buffer */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
542 if (visible_buf) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
543 /* redraw the last visible buffer */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
544 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
545 vdp_st = vdp_presentation_queue_display(vdp_flip_queue, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
546 output_surfaces[surface_num], |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
547 vo_dwidth, vo_dheight, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
548 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
549 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
550 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
551 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
552 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
553 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
554 static void draw_osd_I8A8(int x0,int y0, int w,int h, unsigned char *src, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
555 unsigned char *srca, int stride) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
556 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
557 VdpOutputSurface output_surface = output_surfaces[surface_num]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
558 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
559 int i, j; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
560 int pitch; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
561 int index_data_size_required; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
562 VdpRect output_indexed_rect_vid; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
563 VdpOutputSurfaceRenderBlendState blend_state; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
564 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
565 if (!w || !h) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
566 return; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
567 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
568 index_data_size_required = 2*w*h; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
569 if (index_data_size < index_data_size_required) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
570 index_data = realloc(index_data, index_data_size_required); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
571 index_data_size = index_data_size_required; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
572 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
573 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
574 // index_data creation, component order - I, A, I, A, ..... |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
575 for (i = 0; i < h; i++) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
576 for (j = 0; j < w; j++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
577 index_data[i*2*w + j*2] = src [i*stride+j]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
578 index_data[i*2*w + j*2 + 1] = -srca[i*stride+j]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
579 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
580 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
581 output_indexed_rect_vid.x0 = x0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
582 output_indexed_rect_vid.y0 = y0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
583 output_indexed_rect_vid.x1 = x0 + w; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
584 output_indexed_rect_vid.y1 = y0 + h; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
585 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
586 pitch = w*2; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
587 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
588 // write source_data to output_surfaces[2]. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
589 vdp_st = vdp_output_surface_put_bits_indexed(output_surfaces[2], |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
590 VDP_INDEXED_FORMAT_I8A8, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
591 (const void *const*)&index_data, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
592 &pitch, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
593 &output_indexed_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
594 VDP_COLOR_TABLE_FORMAT_B8G8R8X8, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
595 (void *)palette); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
596 CHECK_ST_WARNING("Error when calling vdp_output_surface_put_bits_indexed") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
597 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
598 blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
599 blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
600 blend_state.blend_factor_source_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
601 blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
602 blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
603 blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
604 blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
605 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
606 vdp_st = vdp_output_surface_render_output_surface(output_surface, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
607 &output_indexed_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
608 output_surfaces[2], |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
609 &output_indexed_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
610 NULL, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
611 &blend_state, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
612 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
613 CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
614 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
615 |
28675 | 616 static void draw_eosd(void) { |
617 VdpStatus vdp_st; | |
618 VdpOutputSurface output_surface = output_surfaces[surface_num]; | |
619 VdpOutputSurfaceRenderBlendState blend_state; | |
620 int i; | |
621 | |
622 blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION; | |
623 blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA; | |
624 blend_state.blend_factor_source_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE; | |
625 blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; | |
626 blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA; | |
627 blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; | |
628 blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; | |
629 | |
630 for (i=0; i<eosd_render_count; i++) { | |
631 vdp_st = vdp_output_surface_render_bitmap_surface( | |
632 output_surface, &eosd_targets[i].dest, | |
633 eosd_targets[i].surface, &eosd_targets[i].source, | |
634 &eosd_targets[i].color, &blend_state, | |
635 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); | |
636 CHECK_ST_WARNING("EOSD: Error when rendering") | |
637 } | |
638 } | |
639 | |
640 static void generate_eosd(mp_eosd_images_t *imgs) { | |
641 VdpStatus vdp_st; | |
642 VdpRect destRect; | |
643 int j, found; | |
644 ass_image_t *img = imgs->imgs; | |
645 ass_image_t *i; | |
646 | |
647 // Nothing changed, no need to redraw | |
648 if (imgs->changed == 0) | |
649 return; | |
650 eosd_render_count = 0; | |
651 // There's nothing to render! | |
652 if (!img) | |
653 return; | |
654 | |
655 if (imgs->changed == 1) | |
656 goto eosd_skip_upload; | |
657 | |
658 for (j=0; j<eosd_surface_count; j++) | |
659 eosd_surfaces[j].in_use = 0; | |
660 | |
661 for (i = img; i; i = i->next) { | |
662 // Try to reuse a suitable surface | |
663 found = -1; | |
664 for (j=0; j<eosd_surface_count; j++) { | |
665 if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE && !eosd_surfaces[j].in_use && | |
666 eosd_surfaces[j].w >= i->w && eosd_surfaces[j].h >= i->h) { | |
667 found = j; | |
668 break; | |
669 } | |
670 } | |
671 // None found, allocate a new surface | |
672 if (found < 0) { | |
673 for (j=0; j<eosd_surface_count; j++) { | |
674 if (!eosd_surfaces[j].in_use) { | |
675 if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE) | |
676 vdp_bitmap_surface_destroy(eosd_surfaces[j].surface); | |
677 found = j; | |
678 break; | |
679 } | |
680 } | |
681 // Allocate new space for surface/target arrays | |
682 if (found < 0) { | |
683 j = found = eosd_surface_count; | |
684 eosd_surface_count = eosd_surface_count ? eosd_surface_count*2 : EOSD_SURFACES_INITIAL; | |
685 eosd_surfaces = realloc(eosd_surfaces, eosd_surface_count * sizeof(*eosd_surfaces)); | |
686 eosd_targets = realloc(eosd_targets, eosd_surface_count * sizeof(*eosd_targets)); | |
687 for(j=found; j<eosd_surface_count; j++) { | |
688 eosd_surfaces[j].surface = VDP_INVALID_HANDLE; | |
689 eosd_surfaces[j].in_use = 0; | |
690 } | |
691 } | |
692 vdp_st = vdp_bitmap_surface_create(vdp_device, VDP_RGBA_FORMAT_A8, | |
693 i->w, i->h, VDP_TRUE, &eosd_surfaces[found].surface); | |
694 CHECK_ST_WARNING("EOSD: error when creating surface") | |
695 eosd_surfaces[found].w = i->w; | |
696 eosd_surfaces[found].h = i->h; | |
697 } | |
698 eosd_surfaces[found].in_use = 1; | |
699 eosd_targets[eosd_render_count].surface = eosd_surfaces[found].surface; | |
700 destRect.x0 = 0; | |
701 destRect.y0 = 0; | |
702 destRect.x1 = i->w; | |
703 destRect.y1 = i->h; | |
704 vdp_st = vdp_bitmap_surface_putbits_native(eosd_targets[eosd_render_count].surface, | |
705 (const void *) &i->bitmap, &i->stride, &destRect); | |
706 CHECK_ST_WARNING("EOSD: putbits failed") | |
707 eosd_render_count++; | |
708 } | |
709 | |
710 eosd_skip_upload: | |
711 eosd_render_count = 0; | |
712 for (i = img; i; i = i->next) { | |
713 // Render dest, color, etc. | |
714 eosd_targets[eosd_render_count].color.alpha = 1.0 - ((i->color >> 0) & 0xff) / 255.0; | |
715 eosd_targets[eosd_render_count].color.blue = ((i->color >> 8) & 0xff) / 255.0; | |
716 eosd_targets[eosd_render_count].color.green = ((i->color >> 16) & 0xff) / 255.0; | |
717 eosd_targets[eosd_render_count].color.red = ((i->color >> 24) & 0xff) / 255.0; | |
718 eosd_targets[eosd_render_count].dest.x0 = i->dst_x; | |
719 eosd_targets[eosd_render_count].dest.y0 = i->dst_y; | |
720 eosd_targets[eosd_render_count].dest.x1 = i->w + i->dst_x; | |
721 eosd_targets[eosd_render_count].dest.y1 = i->h + i->dst_y; | |
722 eosd_targets[eosd_render_count].source.x0 = 0; | |
723 eosd_targets[eosd_render_count].source.y0 = 0; | |
724 eosd_targets[eosd_render_count].source.x1 = i->w; | |
725 eosd_targets[eosd_render_count].source.y1 = i->h; | |
726 eosd_render_count++; | |
727 } | |
728 } | |
729 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
730 static void draw_osd(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
731 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
732 mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
733 |
28675 | 734 draw_eosd(); |
28598
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
735 vo_draw_text_ext(vo_dwidth, vo_dheight, border_x, border_y, border_x, border_y, |
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
736 vid_width, vid_height, draw_osd_I8A8); |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
737 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
738 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
739 static void flip_page(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
740 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
741 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
742 mp_msg(MSGT_VO, MSGL_DBG2, "\nFLIP_PAGE VID:%u -> OUT:%u\n", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
743 surface_render[vid_surface_num].surface, output_surfaces[surface_num]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
744 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
745 vdp_st = vdp_presentation_queue_display(vdp_flip_queue, output_surfaces[surface_num], |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
746 vo_dwidth, vo_dheight, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
747 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
748 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
749 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
750 surface_num = !surface_num; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
751 visible_buf = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
752 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
753 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
754 static int draw_slice(uint8_t *image[], int stride[], int w, int h, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
755 int x, int y) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
756 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
757 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
758 struct vdpau_render_state *rndr = (struct vdpau_render_state *)image[0]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
759 int max_refs = image_format == IMGFMT_VDPAU_H264 ? rndr->info.h264.num_ref_frames : 2; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
760 if (!IMGFMT_IS_VDPAU(image_format)) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
761 return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
762 if (decoder == VDP_INVALID_HANDLE || decoder_max_refs < max_refs) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
763 VdpDecoderProfile vdp_decoder_profile; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
764 if (decoder != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
765 vdp_decoder_destroy(decoder); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
766 decoder = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
767 switch (image_format) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
768 case IMGFMT_VDPAU_MPEG1: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
769 vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
770 break; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
771 case IMGFMT_VDPAU_MPEG2: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
772 vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG2_MAIN; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
773 break; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
774 case IMGFMT_VDPAU_H264: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
775 vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
776 break; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
777 case IMGFMT_VDPAU_WMV3: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
778 vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
779 break; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
780 case IMGFMT_VDPAU_VC1: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
781 vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
782 break; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
783 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
784 vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile, vid_width, vid_height, max_refs, &decoder); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
785 CHECK_ST_WARNING("Failed creating VDPAU decoder"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
786 decoder_max_refs = max_refs; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
787 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
788 vdp_st = vdp_decoder_render(decoder, rndr->surface, (void *)&rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
789 CHECK_ST_WARNING("Failed VDPAU decoder rendering"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
790 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
791 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
792 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
793 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
794 static int draw_frame(uint8_t *src[]) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
795 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
796 return VO_ERROR; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
797 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
798 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
799 static struct vdpau_render_state *get_surface(int number) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
800 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
801 if (number > MAX_VIDEO_SURFACES) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
802 return NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
803 if (surface_render[number].surface == VDP_INVALID_HANDLE) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
804 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
805 vdp_st = vdp_video_surface_create(vdp_device, vdp_chroma_type, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
806 vid_width, vid_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
807 &surface_render[number].surface); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
808 CHECK_ST_WARNING("Error when calling vdp_video_surface_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
809 if (vdp_st != VDP_STATUS_OK) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
810 return NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
811 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
812 mp_msg(MSGT_VO, MSGL_DBG2, "VID CREATE: %u\n", surface_render[number].surface); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
813 return &surface_render[number]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
814 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
815 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
816 static uint32_t draw_image(mp_image_t *mpi) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
817 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
818 if (IMGFMT_IS_VDPAU(image_format)) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
819 struct vdpau_render_state *rndr = mpi->priv; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
820 vid_surface_num = rndr - surface_render; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
821 } else if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
822 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
823 void *destdata[3] = {mpi->planes[0], mpi->planes[2], mpi->planes[1]}; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
824 struct vdpau_render_state *rndr = get_surface(0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
825 vid_surface_num = rndr - surface_render; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
826 vdp_st = vdp_video_surface_put_bits_y_cb_cr(rndr->surface, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
827 VDP_YCBCR_FORMAT_YV12, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
828 (const void *const*)destdata, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
829 mpi->stride); // pitch |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
830 CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
831 } |
28684 | 832 top_field_first = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST); |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
833 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
834 video_to_output_surface(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
835 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
836 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
837 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
838 static uint32_t get_image(mp_image_t *mpi) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
839 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
840 struct vdpau_render_state *rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
841 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
842 // no dr for non-decoding for now |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
843 if (!IMGFMT_IS_VDPAU(image_format)) return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
844 if (mpi->type != MP_IMGTYPE_NUMBERED) return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
845 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
846 rndr = get_surface(mpi->number); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
847 if (!rndr) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
848 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] no surfaces available in get_image\n"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
849 // TODO: this probably breaks things forever, provide a dummy buffer? |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
850 return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
851 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
852 mpi->flags |= MP_IMGFLAG_DIRECT; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
853 mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
854 mpi->planes[0] = mpi->planes[1] = mpi->planes[2] = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
855 // hack to get around a check and to avoid a special-case in vd_ffmpeg.c |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
856 mpi->planes[0] = (void *)rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
857 mpi->num_planes = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
858 mpi->priv = rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
859 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
860 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
861 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
862 static int query_format(uint32_t format) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
863 { |
28675 | 864 int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_EOSD | VFCAP_EOSD_UNSCALED; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
865 switch (format) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
866 case IMGFMT_YV12: |
28611
00c0123b6df3
Add VOCAP_NOSLICES and use it to allow vo_vdpau to not support slices for
reimar
parents:
28598
diff
changeset
|
867 return default_flags | VOCAP_NOSLICES; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
868 case IMGFMT_VDPAU_MPEG1: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
869 case IMGFMT_VDPAU_MPEG2: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
870 case IMGFMT_VDPAU_H264: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
871 case IMGFMT_VDPAU_WMV3: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
872 case IMGFMT_VDPAU_VC1: |
28611
00c0123b6df3
Add VOCAP_NOSLICES and use it to allow vo_vdpau to not support slices for
reimar
parents:
28598
diff
changeset
|
873 return default_flags; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
874 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
875 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
876 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
877 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
878 static void DestroyVdpauObjects(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
879 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
880 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
881 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
882 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
883 free_video_specific(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
884 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
885 vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
886 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
887 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
888 vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
889 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_target_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
890 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
891 for (i = 0; i < NUM_OUTPUT_SURFACES; i++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
892 vdp_st = vdp_output_surface_destroy(output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
893 output_surfaces[i] = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
894 CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
895 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
896 |
28675 | 897 for (i = 0; i<eosd_surface_count; i++) { |
898 if (eosd_surfaces[i].surface != VDP_INVALID_HANDLE) { | |
899 vdp_st = vdp_bitmap_surface_destroy(eosd_surfaces[i].surface); | |
900 CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy") | |
901 } | |
902 eosd_surfaces[i].surface = VDP_INVALID_HANDLE; | |
903 } | |
904 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
905 vdp_st = vdp_device_destroy(vdp_device); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
906 CHECK_ST_WARNING("Error when calling vdp_device_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
907 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
908 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
909 static void uninit(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
910 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
911 if (!vo_config_count) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
912 return; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
913 visible_buf = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
914 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
915 /* Destroy all vdpau objects */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
916 DestroyVdpauObjects(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
917 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
918 free(index_data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
919 index_data = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
920 |
28675 | 921 free(eosd_surfaces); |
922 eosd_surfaces = NULL; | |
923 free(eosd_targets); | |
924 eosd_targets = NULL; | |
925 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
926 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
927 vo_vm_close(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
928 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
929 vo_x11_uninit(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
930 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
931 dlclose(vdpau_lib_handle); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
932 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
933 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
934 static opt_t subopts[] = { |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
935 {"deint", OPT_ARG_INT, &deint, (opt_test_f)int_non_neg}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
936 {"pullup", OPT_ARG_BOOL, &pullup, NULL}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
937 {"denoise", OPT_ARG_FLOAT, &denoise, NULL}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
938 {"sharpen", OPT_ARG_FLOAT, &sharpen, NULL}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
939 {NULL} |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
940 }; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
941 |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
942 static const char help_msg[] = |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
943 "\n-vo vdpau command line help:\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
944 "Example: mplayer -vo vdpau:deint=2\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
945 "\nOptions:\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
946 " deint\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
947 " 0: no deinterlacing\n" |
28684 | 948 " 1: bob deinterlacing (current fallback)\n" |
949 " 2: temporal deinterlacing (not yet working)\n" | |
950 " 3: temporal-spatial deinterlacing (not yet working)\n" | |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
951 " pullup\n" |
28639
0e0b2001d290
Document that and why deinterlacing is not working
reimar
parents:
28638
diff
changeset
|
952 " Try to apply inverse-telecine (needs deinterlacing, not working)\n" |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
953 " denoise\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
954 " Apply denoising, argument is strength from 0.0 to 1.0\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
955 " sharpen\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
956 " Apply sharpening or softening, argument is strength from -1.0 to 1.0\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
957 ; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
958 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
959 static int preinit(const char *arg) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
960 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
961 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
962 static const char *vdpaulibrary = "libvdpau.so.1"; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
963 static const char *vdpau_device_create = "vdp_device_create_x11"; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
964 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
965 deint = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
966 pullup = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
967 denoise = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
968 sharpen = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
969 if (subopt_parse(arg, subopts) != 0) { |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
970 mp_msg(MSGT_VO, MSGL_FATAL, help_msg); |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
971 return -1; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
972 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
973 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
974 vdpau_lib_handle = dlopen(vdpaulibrary, RTLD_LAZY); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
975 if (!vdpau_lib_handle) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
976 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Could not open dynamic library %s\n", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
977 vdpaulibrary); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
978 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
979 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
980 vdp_device_create = dlsym(vdpau_lib_handle, vdpau_device_create); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
981 if (!vdp_device_create) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
982 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Could not find function %s in %s\n", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
983 vdpau_device_create, vdpaulibrary); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
984 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
985 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
986 if (!vo_init() || win_x11_init_vdpau_procs()) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
987 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
988 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
989 decoder = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
990 for (i = 0; i < MAX_VIDEO_SURFACES; i++) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
991 surface_render[i].surface = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
992 video_mixer = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
993 for (i = 0; i < NUM_OUTPUT_SURFACES; i++) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
994 output_surfaces[i] = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
995 vdp_flip_queue = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
996 output_surface_width = output_surface_height = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
997 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
998 // full grayscale palette. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
999 for (i = 0; i < PALETTE_SIZE; ++i) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1000 palette[i] = (i << 16) | (i << 8) | i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1001 index_data = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1002 index_data_size = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1003 |
28675 | 1004 eosd_surface_count = eosd_render_count = 0; |
1005 eosd_surfaces = NULL; | |
1006 eosd_targets = NULL; | |
1007 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1008 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1009 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1010 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1011 static int control(uint32_t request, void *data, ...) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1012 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1013 switch (request) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1014 case VOCTRL_PAUSE: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1015 return (int_pause = 1); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1016 case VOCTRL_RESUME: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1017 return (int_pause = 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1018 case VOCTRL_QUERY_FORMAT: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1019 return query_format(*(uint32_t *)data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1020 case VOCTRL_GET_IMAGE: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1021 return get_image(data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1022 case VOCTRL_DRAW_IMAGE: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1023 return draw_image(data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1024 case VOCTRL_GUISUPPORT: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1025 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1026 case VOCTRL_BORDER: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1027 vo_x11_border(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1028 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1029 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1030 case VOCTRL_FULLSCREEN: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1031 vo_x11_fullscreen(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1032 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1033 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1034 case VOCTRL_GET_PANSCAN: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1035 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1036 case VOCTRL_SET_PANSCAN: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1037 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1038 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1039 case VOCTRL_SET_EQUALIZER: { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1040 va_list ap; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1041 int value; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1042 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1043 va_start(ap, data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1044 value = va_arg(ap, int); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1045 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1046 va_end(ap); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1047 return vo_x11_set_equalizer(data, value); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1048 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1049 case VOCTRL_GET_EQUALIZER: { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1050 va_list ap; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1051 int *value; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1052 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1053 va_start(ap, data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1054 value = va_arg(ap, int *); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1055 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1056 va_end(ap); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1057 return vo_x11_get_equalizer(data, value); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1058 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1059 case VOCTRL_ONTOP: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1060 vo_x11_ontop(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1061 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1062 case VOCTRL_UPDATE_SCREENINFO: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1063 update_xinerama_info(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1064 return VO_TRUE; |
28675 | 1065 case VOCTRL_DRAW_EOSD: |
1066 if (!data) | |
1067 return VO_FALSE; | |
1068 generate_eosd(data); | |
1069 return VO_TRUE; | |
1070 case VOCTRL_GET_EOSD_RES: { | |
1071 mp_eosd_res_t *r = data; | |
1072 r->mt = r->mb = r->ml = r->mr = 0; | |
1073 if (vo_fs) { | |
1074 r->w = vo_screenwidth; | |
1075 r->h = vo_screenheight; | |
1076 r->ml = r->mr = border_x; | |
1077 r->mt = r->mb = border_y; | |
1078 } else | |
1079 r->w = vo_dwidth; r->h = vo_dheight; | |
1080 return VO_TRUE; | |
1081 } | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1082 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1083 return VO_NOTIMPL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1084 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1085 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1086 /* @} */ |