Mercurial > mplayer.hg
annotate libvo/vo_vdpau.c @ 28623:acf6af6e7775
Fix capitalization to be similar to English master file.
author | bircoph |
---|---|
date | Thu, 19 Feb 2009 03:50:24 +0000 |
parents | 00c0123b6df3 |
children | 7b16ccf423b4 |
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" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
45 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
46 #include "libavcodec/vdpau.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
47 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
48 #include "gui/interface.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
49 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
50 #include "libavutil/common.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
51 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
52 static vo_info_t info = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
53 "VDPAU with X11", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
54 "vdpau", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
55 "Rajib Mahapatra <rmahapatra@nvidia.com> and others", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
56 "" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
57 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
58 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
59 LIBVO_EXTERN(vdpau) |
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 #define CHECK_ST_ERROR(message) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
62 if (vdp_st != VDP_STATUS_OK) { \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
63 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
64 message, vdp_get_error_string(vdp_st)); \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
65 return -1; \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
66 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
67 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
68 #define CHECK_ST_WARNING(message) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
69 if (vdp_st != VDP_STATUS_OK) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
70 mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
71 message, vdp_get_error_string(vdp_st)); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
72 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
73 /* number of video and output surfaces */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
74 #define NUM_OUTPUT_SURFACES 3 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
75 #define MAX_VIDEO_SURFACES 50 |
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 palette entries */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
78 #define PALETTE_SIZE 256 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
79 |
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 * Global variable declaration - VDPAU specific |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
82 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
83 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
84 /* 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
|
85 * win_x11_init_vdpau_flip_queue() functions |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
86 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
87 static VdpDevice vdp_device; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
88 static VdpDeviceCreateX11 *vdp_device_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
89 static VdpGetProcAddress *vdp_get_proc_address; |
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 static VdpPresentationQueueTarget vdp_flip_target; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
92 static VdpPresentationQueue vdp_flip_queue; |
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 VdpDeviceDestroy *vdp_device_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
95 static VdpVideoSurfaceCreate *vdp_video_surface_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
96 static VdpVideoSurfaceDestroy *vdp_video_surface_destroy; |
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 VdpGetErrorString *vdp_get_error_string; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
99 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
100 /* May be used in software filtering/postprocessing options |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
101 * 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
|
102 * system memory. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
103 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
104 static VdpVideoSurfacePutBitsYCbCr *vdp_video_surface_put_bits_y_cb_cr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
105 static VdpOutputSurfacePutBitsNative *vdp_output_surface_put_bits_native; |
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 static VdpOutputSurfaceCreate *vdp_output_surface_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
108 static VdpOutputSurfaceDestroy *vdp_output_surface_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
109 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
110 /* VideoMixer puts video_surface data on displayable output_surface. */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
111 static VdpVideoMixerCreate *vdp_video_mixer_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
112 static VdpVideoMixerDestroy *vdp_video_mixer_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
113 static VdpVideoMixerRender *vdp_video_mixer_render; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
114 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
115 static VdpPresentationQueueTargetDestroy *vdp_presentation_queue_target_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
116 static VdpPresentationQueueCreate *vdp_presentation_queue_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
117 static VdpPresentationQueueDestroy *vdp_presentation_queue_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
118 static VdpPresentationQueueDisplay *vdp_presentation_queue_display; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
119 static VdpPresentationQueueBlockUntilSurfaceIdle *vdp_presentation_queue_block_until_surface_idle; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
120 static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
121 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
122 /* output_surfaces[2] is used in composite-picture. */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
123 static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
124 static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
125 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
126 static VdpDecoderCreate *vdp_decoder_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
127 static VdpDecoderDestroy *vdp_decoder_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
128 static VdpDecoderRender *vdp_decoder_render; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
129 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
130 static void *vdpau_lib_handle; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
131 static VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
132 static int output_surface_width, output_surface_height; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
133 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
134 static VdpVideoMixer video_mixer; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
135 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
136 static VdpDecoder decoder; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
137 static int decoder_max_refs; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
138 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
139 static VdpRect src_rect_vid; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
140 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
|
141 static int border_x, border_y; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
142 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
143 static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
144 static int surface_num; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
145 static int vid_surface_num; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
146 static uint32_t vid_width, vid_height; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
147 static uint32_t image_format; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
148 static const VdpChromaType vdp_chroma_type = VDP_CHROMA_TYPE_420; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
149 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
150 /* draw_osd */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
151 static unsigned char *index_data; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
152 static int index_data_size; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
153 static uint32_t palette[PALETTE_SIZE]; |
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 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
156 * X11 specific |
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 int visible_buf; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
159 static int int_pause; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
160 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
161 static void video_to_output_surface(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
162 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
163 VdpTime dummy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
164 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
165 VdpOutputSurface output_surface = output_surfaces[surface_num]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
166 if (vid_surface_num < 0) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
167 return; |
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 vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
170 output_surface, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
171 &dummy); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
172 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
173 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
174 vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
175 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
176 0, NULL, surface_render[vid_surface_num].surface, 0, NULL, &src_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
177 output_surface, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
178 NULL, &out_rect_vid, 0, NULL); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
179 CHECK_ST_WARNING("Error when calling vdp_video_mixer_render") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
180 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
181 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
182 static void resize(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
183 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
184 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
185 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
186 struct vo_rect src_rect; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
187 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
|
188 struct vo_rect borders; |
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
189 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
|
190 out_rect_vid.x0 = dst_rect.left; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
191 out_rect_vid.x1 = dst_rect.right; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
192 out_rect_vid.y0 = dst_rect.top; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
193 out_rect_vid.y1 = dst_rect.bottom; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
194 src_rect_vid.x0 = src_rect.left; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
195 src_rect_vid.x1 = src_rect.right; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
196 src_rect_vid.y0 = src_rect.top; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
197 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
|
198 border_x = borders.left; |
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
199 border_y = borders.top; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
200 #ifdef CONFIG_FREETYPE |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
201 // adjust font size to display size |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
202 force_load_font = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
203 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
204 vo_osd_changed(OSDTYPE_OSD); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
205 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
206 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
|
207 if (output_surface_width < vo_dwidth) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
208 output_surface_width += output_surface_width >> 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
209 output_surface_width = FFMAX(output_surface_width, vo_dwidth); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
210 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
211 if (output_surface_height < vo_dheight) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
212 output_surface_height += output_surface_height >> 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
213 output_surface_height = FFMAX(output_surface_height, vo_dheight); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
214 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
215 // Creation of output_surfaces |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
216 for (i = 0; i < NUM_OUTPUT_SURFACES; i++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
217 if (output_surfaces[i] != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
218 vdp_output_surface_destroy(output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
219 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
|
220 output_surface_width, output_surface_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
221 &output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
222 CHECK_ST_WARNING("Error when calling vdp_output_surface_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
223 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
|
224 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
225 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
226 video_to_output_surface(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
227 if (visible_buf) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
228 flip_page(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
229 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
230 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
231 /* Initialize vdp_get_proc_address, called from preinit() */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
232 static int win_x11_init_vdpau_procs(void) |
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 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
235 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
236 struct vdp_function { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
237 const int id; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
238 void *pointer; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
239 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
240 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
241 const struct vdp_function *dsc; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
242 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
243 static const struct vdp_function vdp_func[] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
244 {VDP_FUNC_ID_GET_ERROR_STRING, &vdp_get_error_string}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
245 {VDP_FUNC_ID_DEVICE_DESTROY, &vdp_device_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
246 {VDP_FUNC_ID_VIDEO_SURFACE_CREATE, &vdp_video_surface_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
247 {VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, &vdp_video_surface_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
248 {VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
249 &vdp_video_surface_put_bits_y_cb_cr}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
250 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
251 &vdp_output_surface_put_bits_native}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
252 {VDP_FUNC_ID_OUTPUT_SURFACE_CREATE, &vdp_output_surface_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
253 {VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY, &vdp_output_surface_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
254 {VDP_FUNC_ID_VIDEO_MIXER_CREATE, &vdp_video_mixer_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
255 {VDP_FUNC_ID_VIDEO_MIXER_DESTROY, &vdp_video_mixer_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
256 {VDP_FUNC_ID_VIDEO_MIXER_RENDER, &vdp_video_mixer_render}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
257 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
258 &vdp_presentation_queue_target_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
259 {VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE, &vdp_presentation_queue_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
260 {VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
261 &vdp_presentation_queue_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
262 {VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
263 &vdp_presentation_queue_display}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
264 {VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
265 &vdp_presentation_queue_block_until_surface_idle}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
266 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
267 &vdp_presentation_queue_target_create_x11}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
268 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
269 &vdp_output_surface_render_output_surface}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
270 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
271 &vdp_output_surface_put_bits_indexed}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
272 {VDP_FUNC_ID_DECODER_CREATE, &vdp_decoder_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
273 {VDP_FUNC_ID_DECODER_RENDER, &vdp_decoder_render}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
274 {VDP_FUNC_ID_DECODER_DESTROY, &vdp_decoder_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
275 {0, NULL} |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
276 }; |
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 vdp_st = vdp_device_create(mDisplay, mScreen, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
279 &vdp_device, &vdp_get_proc_address); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
280 if (vdp_st != VDP_STATUS_OK) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
281 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
|
282 return -1; |
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 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
285 for (dsc = vdp_func; dsc->pointer; dsc++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
286 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
|
287 if (vdp_st != VDP_STATUS_OK) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
288 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
|
289 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
290 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
291 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
292 return 0; |
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 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
295 /* Initialize vdpau_flip_queue, called from config() */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
296 static int win_x11_init_vdpau_flip_queue(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
297 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
298 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
299 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
300 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
|
301 &vdp_flip_target); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
302 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
|
303 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
304 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
|
305 &vdp_flip_queue); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
306 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
307 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
308 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
309 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
310 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
311 static int create_vdp_mixer(VdpChromaType vdp_chroma_type) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
312 #define VDP_NUM_MIXER_PARAMETER 3 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
313 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
314 static const VdpVideoMixerParameter parameters[VDP_NUM_MIXER_PARAMETER] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
315 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
316 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
317 VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
318 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
319 const void *const parameter_values[VDP_NUM_MIXER_PARAMETER] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
320 &vid_width, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
321 &vid_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
322 &vdp_chroma_type |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
323 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
324 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
325 vdp_st = vdp_video_mixer_create(vdp_device, 0, 0, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
326 VDP_NUM_MIXER_PARAMETER, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
327 parameters, parameter_values, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
328 &video_mixer); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
329 CHECK_ST_ERROR("Error when calling vdp_video_mixer_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
330 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
331 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
332 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
333 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
334 // Free everything specific to a certain video file |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
335 static void free_video_specific(void) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
336 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
337 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
338 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
339 if (decoder != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
340 vdp_decoder_destroy(decoder); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
341 decoder = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
342 decoder_max_refs = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
343 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
344 for (i = 0; i < MAX_VIDEO_SURFACES; i++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
345 if (surface_render[i].surface != VDP_INVALID_HANDLE) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
346 vdp_st = vdp_video_surface_destroy(surface_render[i].surface); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
347 CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
348 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
349 surface_render[i].surface = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
350 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
351 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
352 if (video_mixer != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
353 vdp_st = vdp_video_mixer_destroy(video_mixer); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
354 CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
355 video_mixer = VDP_INVALID_HANDLE; |
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 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
359 * connect to X server, create and map window, initialize all |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
360 * VDPAU objects, create different surfaces etc. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
361 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
362 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
|
363 uint32_t d_height, uint32_t flags, char *title, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
364 uint32_t format) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
365 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
366 XVisualInfo vinfo; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
367 XSetWindowAttributes xswa; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
368 XWindowAttributes attribs; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
369 unsigned long xswamask; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
370 int depth; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
371 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
372 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
373 int vm = flags & VOFLAG_MODESWITCHING; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
374 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
375 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
376 image_format = format; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
377 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
378 int_pause = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
379 visible_buf = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
380 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
381 #ifdef CONFIG_GUI |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
382 if (use_gui) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
383 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
|
384 else |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
385 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
386 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
387 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
388 if (vm) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
389 vo_vm_switch(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
390 else |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
391 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
392 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
393 depth = attribs.depth; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
394 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
395 depth = 24; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
396 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
397 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
398 xswa.background_pixel = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
399 xswa.border_pixel = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
400 xswamask = CWBackPixel | CWBorderPixel; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
401 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
402 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
|
403 flags, CopyFromParent, "vdpau", title); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
404 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
405 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
406 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
407 if (vm) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
408 /* Grab the mouse pointer in our window */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
409 if (vo_grabpointer) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
410 XGrabPointer(mDisplay, vo_window, True, 0, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
411 GrabModeAsync, GrabModeAsync, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
412 vo_window, None, CurrentTime); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
413 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
414 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
415 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
416 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
417 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
418 if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
419 vo_fs = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
420 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
421 /* -----VDPAU related code here -------- */ |
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 free_video_specific(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
424 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
425 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
|
426 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
427 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
428 // video width and height |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
429 vid_width = width; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
430 vid_height = height; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
431 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
432 if (create_vdp_mixer(vdp_chroma_type)) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
433 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
434 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
435 surface_num = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
436 vid_surface_num = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
437 resize(); |
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 return 0; |
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 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
442 static void check_events(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
443 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
444 int e = vo_x11_check_events(mDisplay); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
445 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
446 if (e & VO_EVENT_RESIZE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
447 resize(); |
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 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
|
450 /* did we already draw a buffer */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
451 if (visible_buf) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
452 /* redraw the last visible buffer */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
453 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
454 vdp_st = vdp_presentation_queue_display(vdp_flip_queue, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
455 output_surfaces[surface_num], |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
456 vo_dwidth, vo_dheight, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
457 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
458 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
459 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
460 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
461 } |
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 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
|
464 unsigned char *srca, int stride) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
465 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
466 VdpOutputSurface output_surface = output_surfaces[surface_num]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
467 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
468 int i, j; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
469 int pitch; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
470 int index_data_size_required; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
471 VdpRect output_indexed_rect_vid; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
472 VdpOutputSurfaceRenderBlendState blend_state; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
473 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
474 if (!w || !h) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
475 return; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
476 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
477 index_data_size_required = 2*w*h; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
478 if (index_data_size < index_data_size_required) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
479 index_data = realloc(index_data, index_data_size_required); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
480 index_data_size = index_data_size_required; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
481 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
482 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
483 // index_data creation, component order - I, A, I, A, ..... |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
484 for (i = 0; i < h; i++) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
485 for (j = 0; j < w; j++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
486 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
|
487 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
|
488 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
489 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
490 output_indexed_rect_vid.x0 = x0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
491 output_indexed_rect_vid.y0 = y0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
492 output_indexed_rect_vid.x1 = x0 + w; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
493 output_indexed_rect_vid.y1 = y0 + h; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
494 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
495 pitch = w*2; |
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 // write source_data to output_surfaces[2]. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
498 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
|
499 VDP_INDEXED_FORMAT_I8A8, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
500 (const void *const*)&index_data, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
501 &pitch, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
502 &output_indexed_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
503 VDP_COLOR_TABLE_FORMAT_B8G8R8X8, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
504 (void *)palette); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
505 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
|
506 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
507 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
|
508 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
|
509 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
|
510 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
|
511 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
|
512 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
|
513 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
|
514 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
515 vdp_st = vdp_output_surface_render_output_surface(output_surface, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
516 &output_indexed_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
517 output_surfaces[2], |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
518 &output_indexed_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
519 NULL, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
520 &blend_state, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
521 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
522 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
|
523 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
524 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
525 static void draw_osd(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
526 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
527 mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
528 |
28598
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
529 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
|
530 vid_width, vid_height, draw_osd_I8A8); |
28582
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 flip_page(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 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
536 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
|
537 surface_render[vid_surface_num].surface, output_surfaces[surface_num]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
538 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
539 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
|
540 vo_dwidth, vo_dheight, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
541 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
542 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
543 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
544 surface_num = !surface_num; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
545 visible_buf = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
546 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
547 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
548 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
|
549 int x, int y) |
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 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
552 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
|
553 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
|
554 if (!IMGFMT_IS_VDPAU(image_format)) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
555 return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
556 if (decoder == VDP_INVALID_HANDLE || decoder_max_refs < max_refs) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
557 VdpDecoderProfile vdp_decoder_profile; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
558 if (decoder != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
559 vdp_decoder_destroy(decoder); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
560 decoder = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
561 switch (image_format) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
562 case IMGFMT_VDPAU_MPEG1: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
563 vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
564 break; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
565 case IMGFMT_VDPAU_MPEG2: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
566 vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG2_MAIN; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
567 break; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
568 case IMGFMT_VDPAU_H264: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
569 vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
570 break; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
571 case IMGFMT_VDPAU_WMV3: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
572 vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
573 break; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
574 case IMGFMT_VDPAU_VC1: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
575 vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
576 break; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
577 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
578 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
|
579 CHECK_ST_WARNING("Failed creating VDPAU decoder"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
580 decoder_max_refs = max_refs; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
581 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
582 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
|
583 CHECK_ST_WARNING("Failed VDPAU decoder rendering"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
584 return VO_TRUE; |
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 |
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 static int draw_frame(uint8_t *src[]) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
589 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
590 return VO_ERROR; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
591 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
592 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
593 static struct vdpau_render_state *get_surface(int number) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
594 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
595 if (number > MAX_VIDEO_SURFACES) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
596 return NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
597 if (surface_render[number].surface == VDP_INVALID_HANDLE) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
598 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
599 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
|
600 vid_width, vid_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
601 &surface_render[number].surface); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
602 CHECK_ST_WARNING("Error when calling vdp_video_surface_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
603 if (vdp_st != VDP_STATUS_OK) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
604 return NULL; |
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 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
|
607 return &surface_render[number]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
608 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
609 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
610 static uint32_t draw_image(mp_image_t *mpi) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
611 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
612 if (IMGFMT_IS_VDPAU(image_format)) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
613 struct vdpau_render_state *rndr = mpi->priv; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
614 vid_surface_num = rndr - surface_render; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
615 } else if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
616 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
617 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
|
618 struct vdpau_render_state *rndr = get_surface(0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
619 vid_surface_num = rndr - surface_render; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
620 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
|
621 VDP_YCBCR_FORMAT_YV12, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
622 (const void *const*)destdata, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
623 mpi->stride); // pitch |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
624 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
|
625 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
626 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
627 video_to_output_surface(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
628 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
629 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
630 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
631 static uint32_t get_image(mp_image_t *mpi) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
632 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
633 struct vdpau_render_state *rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
634 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
635 // no dr for non-decoding for now |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
636 if (!IMGFMT_IS_VDPAU(image_format)) return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
637 if (mpi->type != MP_IMGTYPE_NUMBERED) return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
638 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
639 rndr = get_surface(mpi->number); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
640 if (!rndr) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
641 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
|
642 // TODO: this probably breaks things forever, provide a dummy buffer? |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
643 return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
644 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
645 mpi->flags |= MP_IMGFLAG_DIRECT; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
646 mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
647 mpi->planes[0] = mpi->planes[1] = mpi->planes[2] = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
648 // 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
|
649 mpi->planes[0] = (void *)rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
650 mpi->num_planes = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
651 mpi->priv = rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
652 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
653 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
654 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
655 static int query_format(uint32_t format) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
656 { |
28611
00c0123b6df3
Add VOCAP_NOSLICES and use it to allow vo_vdpau to not support slices for
reimar
parents:
28598
diff
changeset
|
657 int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
658 switch (format) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
659 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
|
660 return default_flags | VOCAP_NOSLICES; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
661 case IMGFMT_VDPAU_MPEG1: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
662 case IMGFMT_VDPAU_MPEG2: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
663 case IMGFMT_VDPAU_H264: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
664 case IMGFMT_VDPAU_WMV3: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
665 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
|
666 return default_flags; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
667 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
668 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
669 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
670 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
671 static void DestroyVdpauObjects(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
672 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
673 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
674 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
675 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
676 free_video_specific(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
677 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
678 vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
679 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
680 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
681 vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
682 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
|
683 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
684 for (i = 0; i < NUM_OUTPUT_SURFACES; i++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
685 vdp_st = vdp_output_surface_destroy(output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
686 output_surfaces[i] = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
687 CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
688 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
689 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
690 vdp_st = vdp_device_destroy(vdp_device); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
691 CHECK_ST_WARNING("Error when calling vdp_device_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
692 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
693 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
694 static void uninit(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
695 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
696 if (!vo_config_count) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
697 return; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
698 visible_buf = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
699 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
700 /* Destroy all vdpau objects */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
701 DestroyVdpauObjects(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
702 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
703 free(index_data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
704 index_data = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
705 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
706 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
707 vo_vm_close(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
708 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
709 vo_x11_uninit(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
710 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
711 dlclose(vdpau_lib_handle); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
712 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
713 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
714 static int preinit(const char *arg) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
715 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
716 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
717 static const char *vdpaulibrary = "libvdpau.so.1"; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
718 static const char *vdpau_device_create = "vdp_device_create_x11"; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
719 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
720 if (arg) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
721 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Unknown subdevice: %s\n", arg); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
722 return ENOSYS; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
723 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
724 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
725 vdpau_lib_handle = dlopen(vdpaulibrary, RTLD_LAZY); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
726 if (!vdpau_lib_handle) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
727 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
|
728 vdpaulibrary); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
729 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
730 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
731 vdp_device_create = dlsym(vdpau_lib_handle, vdpau_device_create); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
732 if (!vdp_device_create) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
733 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
|
734 vdpau_device_create, vdpaulibrary); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
735 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
736 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
737 if (!vo_init() || win_x11_init_vdpau_procs()) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
738 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
739 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
740 decoder = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
741 for (i = 0; i < MAX_VIDEO_SURFACES; i++) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
742 surface_render[i].surface = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
743 video_mixer = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
744 for (i = 0; i < NUM_OUTPUT_SURFACES; i++) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
745 output_surfaces[i] = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
746 vdp_flip_queue = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
747 output_surface_width = output_surface_height = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
748 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
749 // full grayscale palette. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
750 for (i = 0; i < PALETTE_SIZE; ++i) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
751 palette[i] = (i << 16) | (i << 8) | i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
752 index_data = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
753 index_data_size = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
754 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
755 return 0; |
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 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
758 static int control(uint32_t request, void *data, ...) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
759 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
760 switch (request) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
761 case VOCTRL_PAUSE: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
762 return (int_pause = 1); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
763 case VOCTRL_RESUME: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
764 return (int_pause = 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
765 case VOCTRL_QUERY_FORMAT: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
766 return query_format(*(uint32_t *)data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
767 case VOCTRL_GET_IMAGE: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
768 return get_image(data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
769 case VOCTRL_DRAW_IMAGE: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
770 return draw_image(data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
771 case VOCTRL_GUISUPPORT: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
772 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
773 case VOCTRL_BORDER: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
774 vo_x11_border(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
775 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
776 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
777 case VOCTRL_FULLSCREEN: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
778 vo_x11_fullscreen(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
779 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
780 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
781 case VOCTRL_GET_PANSCAN: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
782 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
783 case VOCTRL_SET_PANSCAN: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
784 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
785 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
786 case VOCTRL_SET_EQUALIZER: { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
787 va_list ap; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
788 int value; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
789 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
790 va_start(ap, data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
791 value = va_arg(ap, int); |
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 va_end(ap); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
794 return vo_x11_set_equalizer(data, value); |
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 case VOCTRL_GET_EQUALIZER: { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
797 va_list ap; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
798 int *value; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
799 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
800 va_start(ap, data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
801 value = va_arg(ap, int *); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
802 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
803 va_end(ap); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
804 return vo_x11_get_equalizer(data, value); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
805 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
806 case VOCTRL_ONTOP: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
807 vo_x11_ontop(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
808 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
809 case VOCTRL_UPDATE_SCREENINFO: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
810 update_xinerama_info(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
811 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
812 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
813 return VO_NOTIMPL; |
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 /* @} */ |