Mercurial > mplayer.hg
annotate libvo/vo_vdpau.c @ 29247:fe871e69b1b3
chunk size = 0 is valid for DATA chunks (used in live streams), don't
print warning message
author | rtogni |
---|---|
date | Sun, 10 May 2009 21:13:15 +0000 |
parents | 6c47111fe28e |
children | 0f1b5b68af32 |
rev | line source |
---|---|
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
2 * VDPAU video output driver |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
3 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
4 * Copyright (C) 2008 NVIDIA |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
5 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
6 * This file is part of MPlayer. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
7 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
11 * (at your option) any later version. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
12 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
17 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
21 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
22 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
23 /** |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
24 * \defgroup VDPAU_Presentation VDPAU Presentation |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
25 * \ingroup Decoder |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
26 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
27 * Actual decoding and presentation are implemented here. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
28 * All necessary frame information is collected through |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
29 * the "vdpau_render_state" structure after parsing all headers |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
30 * etc. in libavcodec for different codecs. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
31 * |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
32 * @{ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
33 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
34 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
35 #include <stdio.h> |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
36 #include <dlfcn.h> |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
37 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
38 #include "config.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
39 #include "mp_msg.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
40 #include "video_out.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
41 #include "video_out_internal.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
42 #include "x11_common.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
43 #include "aspect.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
44 #include "sub.h" |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
45 #include "subopt-helper.h" |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
46 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
47 #include "libavcodec/vdpau.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
48 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
49 #include "gui/interface.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
50 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
51 #include "libavutil/common.h" |
28729 | 52 #include "libavutil/mathematics.h" |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
53 |
28675 | 54 #include "libass/ass.h" |
55 #include "libass/ass_mp.h" | |
56 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
57 static vo_info_t info = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
58 "VDPAU with X11", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
59 "vdpau", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
60 "Rajib Mahapatra <rmahapatra@nvidia.com> and others", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
61 "" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
62 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
63 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
64 LIBVO_EXTERN(vdpau) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
65 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
66 #define CHECK_ST_ERROR(message) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
67 if (vdp_st != VDP_STATUS_OK) { \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
68 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
69 message, vdp_get_error_string(vdp_st)); \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
70 return -1; \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
71 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
72 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
73 #define CHECK_ST_WARNING(message) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
74 if (vdp_st != VDP_STATUS_OK) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
75 mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
76 message, vdp_get_error_string(vdp_st)); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
77 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
78 /* number of video and output surfaces */ |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
79 #define NUM_OUTPUT_SURFACES 2 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
80 #define MAX_VIDEO_SURFACES 50 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
81 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
82 /* number of palette entries */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
83 #define PALETTE_SIZE 256 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
84 |
28675 | 85 /* Initial maximum number of EOSD surfaces */ |
86 #define EOSD_SURFACES_INITIAL 512 | |
87 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
88 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
89 * Global variable declaration - VDPAU specific |
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 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
92 /* 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
|
93 * win_x11_init_vdpau_flip_queue() functions |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
94 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
95 static VdpDevice vdp_device; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
96 static VdpDeviceCreateX11 *vdp_device_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
97 static VdpGetProcAddress *vdp_get_proc_address; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
98 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
99 static VdpPresentationQueueTarget vdp_flip_target; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
100 static VdpPresentationQueue vdp_flip_queue; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
101 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
102 static VdpDeviceDestroy *vdp_device_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
103 static VdpVideoSurfaceCreate *vdp_video_surface_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
104 static VdpVideoSurfaceDestroy *vdp_video_surface_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
105 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
106 static VdpGetErrorString *vdp_get_error_string; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
107 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
108 /* May be used in software filtering/postprocessing options |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
109 * 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
|
110 * system memory. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
111 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
112 static VdpVideoSurfacePutBitsYCbCr *vdp_video_surface_put_bits_y_cb_cr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
113 static VdpOutputSurfacePutBitsNative *vdp_output_surface_put_bits_native; |
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 VdpOutputSurfaceCreate *vdp_output_surface_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
116 static VdpOutputSurfaceDestroy *vdp_output_surface_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
117 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
118 /* VideoMixer puts video_surface data on displayable output_surface. */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
119 static VdpVideoMixerCreate *vdp_video_mixer_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
120 static VdpVideoMixerDestroy *vdp_video_mixer_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
121 static VdpVideoMixerRender *vdp_video_mixer_render; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
122 static VdpVideoMixerSetFeatureEnables *vdp_video_mixer_set_feature_enables; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
123 static VdpVideoMixerSetAttributeValues *vdp_video_mixer_set_attribute_values; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
124 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
125 static VdpPresentationQueueTargetDestroy *vdp_presentation_queue_target_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
126 static VdpPresentationQueueCreate *vdp_presentation_queue_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
127 static VdpPresentationQueueDestroy *vdp_presentation_queue_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
128 static VdpPresentationQueueDisplay *vdp_presentation_queue_display; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
129 static VdpPresentationQueueBlockUntilSurfaceIdle *vdp_presentation_queue_block_until_surface_idle; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
130 static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
131 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
132 static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
133 static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed; |
28675 | 134 static VdpOutputSurfaceRenderBitmapSurface *vdp_output_surface_render_bitmap_surface; |
135 | |
136 static VdpBitmapSurfaceCreate *vdp_bitmap_surface_create; | |
137 static VdpBitmapSurfaceDestroy *vdp_bitmap_surface_destroy; | |
138 static VdpBitmapSurfacePutBitsNative *vdp_bitmap_surface_putbits_native; | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
139 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
140 static VdpDecoderCreate *vdp_decoder_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
141 static VdpDecoderDestroy *vdp_decoder_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
142 static VdpDecoderRender *vdp_decoder_render; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
143 |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
144 static VdpGenerateCSCMatrix *vdp_generate_csc_matrix; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
145 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
146 static void *vdpau_lib_handle; |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
147 /* output_surfaces[NUM_OUTPUT_SURFACES] is misused for OSD. */ |
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
148 #define osd_surface output_surfaces[NUM_OUTPUT_SURFACES] |
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
149 static VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES + 1]; |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
150 static VdpVideoSurface deint_surfaces[3]; |
29017
c9a2d95c580a
New vdpau deinterlacing code needs one reference surface less.
cehoyos
parents:
29016
diff
changeset
|
151 static mp_image_t *deint_mpi[2]; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
152 static int output_surface_width, output_surface_height; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
153 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
154 static VdpVideoMixer video_mixer; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
155 static int deint; |
28709
4e89476f8952
Do not forget the chosen deinterlacer for -vo vdpau.
cehoyos
parents:
28708
diff
changeset
|
156 static int deint_type; |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
157 static int deint_counter; |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
158 static int deint_buffer_past_frames; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
159 static int pullup; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
160 static float denoise; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
161 static float sharpen; |
28944
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
162 static int chroma_deint; |
28684 | 163 static int top_field_first; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
164 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
165 static VdpDecoder decoder; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
166 static int decoder_max_refs; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
167 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
168 static VdpRect src_rect_vid; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
169 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
|
170 static int border_x, border_y; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
171 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
172 static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
173 static int surface_num; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
174 static int vid_surface_num; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
175 static uint32_t vid_width, vid_height; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
176 static uint32_t image_format; |
29066
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
177 static VdpChromaType vdp_chroma_type; |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
178 static VdpYCbCrFormat vdp_pixel_format; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
179 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
180 /* draw_osd */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
181 static unsigned char *index_data; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
182 static int index_data_size; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
183 static uint32_t palette[PALETTE_SIZE]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
184 |
28675 | 185 // EOSD |
186 // Pool of surfaces | |
187 struct { | |
188 VdpBitmapSurface surface; | |
189 int w; | |
190 int h; | |
191 char in_use; | |
192 } *eosd_surfaces; | |
193 | |
194 // List of surfaces to be rendered | |
195 struct { | |
196 VdpBitmapSurface surface; | |
197 VdpRect source; | |
198 VdpRect dest; | |
199 VdpColor color; | |
200 } *eosd_targets; | |
201 | |
202 static int eosd_render_count; | |
203 static int eosd_surface_count; | |
204 | |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
205 // Video equalizer |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
206 static VdpProcamp procamp; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
207 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
208 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
209 * X11 specific |
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 static int visible_buf; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
212 static int int_pause; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
213 |
28805
b382d065ba53
As for vo_gl, do not rely on draw_osd to render EOSD.
reimar
parents:
28804
diff
changeset
|
214 static void draw_eosd(void); |
b382d065ba53
As for vo_gl, do not rely on draw_osd to render EOSD.
reimar
parents:
28804
diff
changeset
|
215 |
29016
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
216 static void push_deint_surface(VdpVideoSurface surface) |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
217 { |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
218 deint_surfaces[2] = deint_surfaces[1]; |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
219 deint_surfaces[1] = deint_surfaces[0]; |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
220 deint_surfaces[0] = surface; |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
221 } |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
222 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
223 static void video_to_output_surface(void) |
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 VdpTime dummy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
226 VdpStatus vdp_st; |
28684 | 227 int i; |
29026
17e9f67f086b
Simplify vdpau deinterlacing code and fix timing for deint=2.
cehoyos
parents:
29018
diff
changeset
|
228 if (vid_surface_num < 0) |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
229 return; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
230 |
29026
17e9f67f086b
Simplify vdpau deinterlacing code and fix timing for deint=2.
cehoyos
parents:
29018
diff
changeset
|
231 if (deint < 2 || deint_surfaces[0] == VDP_INVALID_HANDLE) |
17e9f67f086b
Simplify vdpau deinterlacing code and fix timing for deint=2.
cehoyos
parents:
29018
diff
changeset
|
232 push_deint_surface(surface_render[vid_surface_num].surface); |
17e9f67f086b
Simplify vdpau deinterlacing code and fix timing for deint=2.
cehoyos
parents:
29018
diff
changeset
|
233 |
28708 | 234 for (i = 0; i <= !!(deint > 1); i++) { |
28684 | 235 int field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; |
236 VdpOutputSurface output_surface; | |
28724 | 237 if (i) { |
28805
b382d065ba53
As for vo_gl, do not rely on draw_osd to render EOSD.
reimar
parents:
28804
diff
changeset
|
238 draw_eosd(); |
28724 | 239 draw_osd(); |
28684 | 240 flip_page(); |
28724 | 241 } |
28684 | 242 if (deint) |
29026
17e9f67f086b
Simplify vdpau deinterlacing code and fix timing for deint=2.
cehoyos
parents:
29018
diff
changeset
|
243 field = (top_field_first == i) ^ (deint > 1) ? |
28684 | 244 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD: |
245 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; | |
246 output_surface = output_surfaces[surface_num]; | |
247 vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue, | |
248 output_surface, | |
249 &dummy); | |
250 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle") | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
251 |
28689 | 252 vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0, |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
253 field, 2, deint_surfaces + 1, |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
254 deint_surfaces[0], |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
255 1, &surface_render[vid_surface_num].surface, |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
256 &src_rect_vid, |
28689 | 257 output_surface, |
258 NULL, &out_rect_vid, 0, NULL); | |
259 CHECK_ST_WARNING("Error when calling vdp_video_mixer_render") | |
29026
17e9f67f086b
Simplify vdpau deinterlacing code and fix timing for deint=2.
cehoyos
parents:
29018
diff
changeset
|
260 push_deint_surface(surface_render[vid_surface_num].surface); |
28684 | 261 } |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
262 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
263 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
264 static void resize(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
265 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
266 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
267 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
268 struct vo_rect src_rect; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
269 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
|
270 struct vo_rect borders; |
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
271 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
|
272 out_rect_vid.x0 = dst_rect.left; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
273 out_rect_vid.x1 = dst_rect.right; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
274 out_rect_vid.y0 = dst_rect.top; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
275 out_rect_vid.y1 = dst_rect.bottom; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
276 src_rect_vid.x0 = src_rect.left; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
277 src_rect_vid.x1 = src_rect.right; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
278 src_rect_vid.y0 = src_rect.top; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
279 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
|
280 border_x = borders.left; |
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
281 border_y = borders.top; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
282 #ifdef CONFIG_FREETYPE |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
283 // adjust font size to display size |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
284 force_load_font = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
285 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
286 vo_osd_changed(OSDTYPE_OSD); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
287 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
288 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
|
289 if (output_surface_width < vo_dwidth) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
290 output_surface_width += output_surface_width >> 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
291 output_surface_width = FFMAX(output_surface_width, vo_dwidth); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
292 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
293 if (output_surface_height < vo_dheight) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
294 output_surface_height += output_surface_height >> 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
295 output_surface_height = FFMAX(output_surface_height, vo_dheight); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
296 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
297 // Creation of output_surfaces |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
298 for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) { |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
299 if (output_surfaces[i] != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
300 vdp_output_surface_destroy(output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
301 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
|
302 output_surface_width, output_surface_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
303 &output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
304 CHECK_ST_WARNING("Error when calling vdp_output_surface_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
305 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
|
306 } |
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 video_to_output_surface(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
309 if (visible_buf) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
310 flip_page(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
311 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
312 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
313 /* Initialize vdp_get_proc_address, called from preinit() */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
314 static int win_x11_init_vdpau_procs(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
315 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
316 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
317 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
318 struct vdp_function { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
319 const int id; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
320 void *pointer; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
321 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
322 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
323 const struct vdp_function *dsc; |
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 static const struct vdp_function vdp_func[] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
326 {VDP_FUNC_ID_GET_ERROR_STRING, &vdp_get_error_string}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
327 {VDP_FUNC_ID_DEVICE_DESTROY, &vdp_device_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
328 {VDP_FUNC_ID_VIDEO_SURFACE_CREATE, &vdp_video_surface_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
329 {VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, &vdp_video_surface_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
330 {VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
331 &vdp_video_surface_put_bits_y_cb_cr}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
332 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
333 &vdp_output_surface_put_bits_native}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
334 {VDP_FUNC_ID_OUTPUT_SURFACE_CREATE, &vdp_output_surface_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
335 {VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY, &vdp_output_surface_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
336 {VDP_FUNC_ID_VIDEO_MIXER_CREATE, &vdp_video_mixer_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
337 {VDP_FUNC_ID_VIDEO_MIXER_DESTROY, &vdp_video_mixer_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
338 {VDP_FUNC_ID_VIDEO_MIXER_RENDER, &vdp_video_mixer_render}, |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
339 {VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
340 &vdp_video_mixer_set_feature_enables}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
341 {VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
342 &vdp_video_mixer_set_attribute_values}, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
343 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
344 &vdp_presentation_queue_target_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
345 {VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE, &vdp_presentation_queue_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
346 {VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
347 &vdp_presentation_queue_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
348 {VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
349 &vdp_presentation_queue_display}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
350 {VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
351 &vdp_presentation_queue_block_until_surface_idle}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
352 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
353 &vdp_presentation_queue_target_create_x11}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
354 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
355 &vdp_output_surface_render_output_surface}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
356 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
357 &vdp_output_surface_put_bits_indexed}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
358 {VDP_FUNC_ID_DECODER_CREATE, &vdp_decoder_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
359 {VDP_FUNC_ID_DECODER_RENDER, &vdp_decoder_render}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
360 {VDP_FUNC_ID_DECODER_DESTROY, &vdp_decoder_destroy}, |
28675 | 361 {VDP_FUNC_ID_BITMAP_SURFACE_CREATE, &vdp_bitmap_surface_create}, |
362 {VDP_FUNC_ID_BITMAP_SURFACE_DESTROY, &vdp_bitmap_surface_destroy}, | |
363 {VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE, | |
364 &vdp_bitmap_surface_putbits_native}, | |
365 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE, | |
366 &vdp_output_surface_render_bitmap_surface}, | |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
367 {VDP_FUNC_ID_GENERATE_CSC_MATRIX, &vdp_generate_csc_matrix}, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
368 {0, NULL} |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
369 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
370 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
371 vdp_st = vdp_device_create(mDisplay, mScreen, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
372 &vdp_device, &vdp_get_proc_address); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
373 if (vdp_st != VDP_STATUS_OK) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
374 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
|
375 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
376 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
377 |
29067
a560ab3e03e5
Make sure we do not accidentally use the vdp_get_error_string from the
reimar
parents:
29066
diff
changeset
|
378 vdp_get_error_string = NULL; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
379 for (dsc = vdp_func; dsc->pointer; dsc++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
380 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
|
381 if (vdp_st != VDP_STATUS_OK) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
382 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
|
383 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
384 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
385 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
386 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
387 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
388 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
389 /* Initialize vdpau_flip_queue, called from config() */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
390 static int win_x11_init_vdpau_flip_queue(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
391 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
392 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
393 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
394 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
|
395 &vdp_flip_target); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
396 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
|
397 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
398 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
|
399 &vdp_flip_queue); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
400 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create") |
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 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
403 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
404 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
405 static int create_vdp_mixer(VdpChromaType vdp_chroma_type) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
406 #define VDP_NUM_MIXER_PARAMETER 3 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
407 #define MAX_NUM_FEATURES 5 |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
408 int i; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
409 VdpStatus vdp_st; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
410 int feature_count = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
411 VdpVideoMixerFeature features[MAX_NUM_FEATURES]; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
412 VdpBool feature_enables[MAX_NUM_FEATURES]; |
28658 | 413 static const VdpVideoMixerAttribute denoise_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL}; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
414 const void * const denoise_value[] = {&denoise}; |
28658 | 415 static const VdpVideoMixerAttribute sharpen_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL}; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
416 const void * const sharpen_value[] = {&sharpen}; |
28944
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
417 static const VdpVideoMixerAttribute skip_chroma_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE}; |
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
418 const uint8_t skip_chroma_value = 1; |
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
419 const void * const skip_chroma_value_ptr[] = {&skip_chroma_value}; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
420 static const VdpVideoMixerParameter parameters[VDP_NUM_MIXER_PARAMETER] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
421 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
422 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
423 VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE |
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 const void *const parameter_values[VDP_NUM_MIXER_PARAMETER] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
426 &vid_width, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
427 &vid_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
428 &vdp_chroma_type |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
429 }; |
28934 | 430 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL; |
28708 | 431 if (deint == 4) |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
432 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
433 if (pullup) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
434 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
435 if (denoise) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
436 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
437 if (sharpen) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
438 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
439 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
440 vdp_st = vdp_video_mixer_create(vdp_device, feature_count, features, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
441 VDP_NUM_MIXER_PARAMETER, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
442 parameters, parameter_values, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
443 &video_mixer); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
444 CHECK_ST_ERROR("Error when calling vdp_video_mixer_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
445 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
446 for (i = 0; i < feature_count; i++) feature_enables[i] = VDP_TRUE; |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
447 if (deint < 3) |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
448 feature_enables[0] = VDP_FALSE; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
449 if (feature_count) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
450 vdp_video_mixer_set_feature_enables(video_mixer, feature_count, features, feature_enables); |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
451 if (denoise) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
452 vdp_video_mixer_set_attribute_values(video_mixer, 1, denoise_attrib, denoise_value); |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
453 if (sharpen) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
454 vdp_video_mixer_set_attribute_values(video_mixer, 1, sharpen_attrib, sharpen_value); |
28944
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
455 if (!chroma_deint) |
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
456 vdp_video_mixer_set_attribute_values(video_mixer, 1, skip_chroma_attrib, skip_chroma_value_ptr); |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
457 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
458 return 0; |
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 // Free everything specific to a certain video file |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
462 static void free_video_specific(void) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
463 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
464 VdpStatus vdp_st; |
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 if (decoder != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
467 vdp_decoder_destroy(decoder); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
468 decoder = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
469 decoder_max_refs = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
470 |
28936
fd9de1e70d47
Move initialisation of deint_surfaces[] to free_video_specific().
cehoyos
parents:
28935
diff
changeset
|
471 for (i = 0; i < 3; i++) |
fd9de1e70d47
Move initialisation of deint_surfaces[] to free_video_specific().
cehoyos
parents:
28935
diff
changeset
|
472 deint_surfaces[i] = VDP_INVALID_HANDLE; |
fd9de1e70d47
Move initialisation of deint_surfaces[] to free_video_specific().
cehoyos
parents:
28935
diff
changeset
|
473 |
29017
c9a2d95c580a
New vdpau deinterlacing code needs one reference surface less.
cehoyos
parents:
29016
diff
changeset
|
474 for (i = 0; i < 2; i++) |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
475 if (deint_mpi[i]) { |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
476 deint_mpi[i]->usage_count--; |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
477 deint_mpi[i] = NULL; |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
478 } |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
479 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
480 for (i = 0; i < MAX_VIDEO_SURFACES; i++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
481 if (surface_render[i].surface != VDP_INVALID_HANDLE) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
482 vdp_st = vdp_video_surface_destroy(surface_render[i].surface); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
483 CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
484 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
485 surface_render[i].surface = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
486 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
487 |
28676
d5c295360163
Only check for vdp_video_mixer_destroy failure when we actually executed that function.
reimar
parents:
28675
diff
changeset
|
488 if (video_mixer != VDP_INVALID_HANDLE) { |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
489 vdp_st = vdp_video_mixer_destroy(video_mixer); |
28676
d5c295360163
Only check for vdp_video_mixer_destroy failure when we actually executed that function.
reimar
parents:
28675
diff
changeset
|
490 CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy") |
d5c295360163
Only check for vdp_video_mixer_destroy failure when we actually executed that function.
reimar
parents:
28675
diff
changeset
|
491 } |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
492 video_mixer = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
493 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
494 |
28989 | 495 static int create_vdp_decoder(int max_refs) |
496 { | |
497 VdpStatus vdp_st; | |
498 VdpDecoderProfile vdp_decoder_profile; | |
499 if (decoder != VDP_INVALID_HANDLE) | |
500 vdp_decoder_destroy(decoder); | |
501 switch (image_format) { | |
502 case IMGFMT_VDPAU_MPEG1: | |
503 vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1; | |
504 break; | |
505 case IMGFMT_VDPAU_MPEG2: | |
506 vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG2_MAIN; | |
507 break; | |
508 case IMGFMT_VDPAU_H264: | |
509 vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH; | |
510 mp_msg(MSGT_VO, MSGL_V, "[vdpau] Creating H264 hardware decoder for %d reference frames.\n", max_refs); | |
511 break; | |
512 case IMGFMT_VDPAU_WMV3: | |
513 vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN; | |
514 break; | |
515 case IMGFMT_VDPAU_VC1: | |
516 vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED; | |
517 break; | |
518 } | |
519 vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile, | |
520 vid_width, vid_height, max_refs, &decoder); | |
521 CHECK_ST_WARNING("Failed creating VDPAU decoder"); | |
522 if (vdp_st != VDP_STATUS_OK) { | |
523 decoder = VDP_INVALID_HANDLE; | |
524 decoder_max_refs = 0; | |
28991 | 525 return 0; |
28989 | 526 } |
527 decoder_max_refs = max_refs; | |
28991 | 528 return 1; |
28989 | 529 } |
530 | |
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 * connect to X server, create and map window, initialize all |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
533 * VDPAU objects, create different surfaces etc. |
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 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
|
536 uint32_t d_height, uint32_t flags, char *title, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
537 uint32_t format) |
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 XVisualInfo vinfo; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
540 XSetWindowAttributes xswa; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
541 XWindowAttributes attribs; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
542 unsigned long xswamask; |
28936
fd9de1e70d47
Move initialisation of deint_surfaces[] to free_video_specific().
cehoyos
parents:
28935
diff
changeset
|
543 int depth; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
544 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
545 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
546 int vm = flags & VOFLAG_MODESWITCHING; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
547 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
548 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
549 image_format = format; |
29005 | 550 vid_width = width; |
551 vid_height = height; | |
552 free_video_specific(); | |
553 if (IMGFMT_IS_VDPAU(image_format) && !create_vdp_decoder(2)) | |
554 return -1; | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
555 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
556 int_pause = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
557 visible_buf = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
558 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
559 #ifdef CONFIG_GUI |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
560 if (use_gui) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
561 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
|
562 else |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
563 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
564 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
565 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
566 if (vm) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
567 vo_vm_switch(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
568 else |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
569 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
570 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
571 depth = attribs.depth; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
572 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
573 depth = 24; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
574 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
575 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
576 xswa.background_pixel = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
577 xswa.border_pixel = 0; |
29234
6c47111fe28e
Do not use flag CWBackPixel when calling vo_x11_create_vo_window():
cehoyos
parents:
29070
diff
changeset
|
578 /* Do not use CWBackPixel: It leads to VDPAU errors after |
6c47111fe28e
Do not use flag CWBackPixel when calling vo_x11_create_vo_window():
cehoyos
parents:
29070
diff
changeset
|
579 aspect ratio changes. */ |
6c47111fe28e
Do not use flag CWBackPixel when calling vo_x11_create_vo_window():
cehoyos
parents:
29070
diff
changeset
|
580 xswamask = CWBorderPixel; |
28582
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 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
|
583 flags, CopyFromParent, "vdpau", title); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
584 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); |
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 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
587 if (vm) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
588 /* Grab the mouse pointer in our window */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
589 if (vo_grabpointer) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
590 XGrabPointer(mDisplay, vo_window, True, 0, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
591 GrabModeAsync, GrabModeAsync, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
592 vo_window, None, CurrentTime); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
593 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); |
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 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
596 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
597 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
598 if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
599 vo_fs = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
600 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
601 /* -----VDPAU related code here -------- */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
602 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
|
603 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
604 |
29066
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
605 vdp_chroma_type = VDP_CHROMA_TYPE_420; |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
606 switch (image_format) { |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
607 case IMGFMT_YV12: |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
608 case IMGFMT_I420: |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
609 case IMGFMT_IYUV: |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
610 vdp_pixel_format = VDP_YCBCR_FORMAT_YV12; |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
611 break; |
29070 | 612 case IMGFMT_NV12: |
613 vdp_pixel_format = VDP_YCBCR_FORMAT_NV12; | |
614 break; | |
29066
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
615 case IMGFMT_YUY2: |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
616 vdp_pixel_format = VDP_YCBCR_FORMAT_YUYV; |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
617 vdp_chroma_type = VDP_CHROMA_TYPE_422; |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
618 break; |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
619 case IMGFMT_UYVY: |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
620 vdp_pixel_format = VDP_YCBCR_FORMAT_UYVY; |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
621 vdp_chroma_type = VDP_CHROMA_TYPE_422; |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
622 } |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
623 if (create_vdp_mixer(vdp_chroma_type)) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
624 return -1; |
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 surface_num = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
627 vid_surface_num = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
628 resize(); |
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 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
631 } |
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 static void check_events(void) |
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 int e = vo_x11_check_events(mDisplay); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
636 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
637 if (e & VO_EVENT_RESIZE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
638 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
639 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
640 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
|
641 /* did we already draw a buffer */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
642 if (visible_buf) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
643 /* redraw the last visible buffer */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
644 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
645 vdp_st = vdp_presentation_queue_display(vdp_flip_queue, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
646 output_surfaces[surface_num], |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
647 vo_dwidth, vo_dheight, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
648 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
649 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
650 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
651 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
652 } |
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 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
|
655 unsigned char *srca, int stride) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
656 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
657 VdpOutputSurface output_surface = output_surfaces[surface_num]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
658 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
659 int i, j; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
660 int pitch; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
661 int index_data_size_required; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
662 VdpRect output_indexed_rect_vid; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
663 VdpOutputSurfaceRenderBlendState blend_state; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
664 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
665 if (!w || !h) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
666 return; |
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 index_data_size_required = 2*w*h; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
669 if (index_data_size < index_data_size_required) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
670 index_data = realloc(index_data, index_data_size_required); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
671 index_data_size = index_data_size_required; |
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 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
674 // index_data creation, component order - I, A, I, A, ..... |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
675 for (i = 0; i < h; i++) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
676 for (j = 0; j < w; j++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
677 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
|
678 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
|
679 } |
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 output_indexed_rect_vid.x0 = x0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
682 output_indexed_rect_vid.y0 = y0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
683 output_indexed_rect_vid.x1 = x0 + w; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
684 output_indexed_rect_vid.y1 = y0 + h; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
685 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
686 pitch = w*2; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
687 |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
688 // write source_data to osd_surface. |
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
689 vdp_st = vdp_output_surface_put_bits_indexed(osd_surface, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
690 VDP_INDEXED_FORMAT_I8A8, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
691 (const void *const*)&index_data, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
692 &pitch, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
693 &output_indexed_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
694 VDP_COLOR_TABLE_FORMAT_B8G8R8X8, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
695 (void *)palette); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
696 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
|
697 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
698 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
|
699 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
|
700 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
|
701 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
|
702 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
|
703 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
|
704 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
|
705 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
706 vdp_st = vdp_output_surface_render_output_surface(output_surface, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
707 &output_indexed_rect_vid, |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
708 osd_surface, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
709 &output_indexed_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
710 NULL, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
711 &blend_state, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
712 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
713 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
|
714 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
715 |
28675 | 716 static void draw_eosd(void) { |
717 VdpStatus vdp_st; | |
718 VdpOutputSurface output_surface = output_surfaces[surface_num]; | |
719 VdpOutputSurfaceRenderBlendState blend_state; | |
720 int i; | |
721 | |
722 blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION; | |
723 blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA; | |
724 blend_state.blend_factor_source_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE; | |
725 blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; | |
726 blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA; | |
727 blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; | |
728 blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; | |
729 | |
730 for (i=0; i<eosd_render_count; i++) { | |
731 vdp_st = vdp_output_surface_render_bitmap_surface( | |
732 output_surface, &eosd_targets[i].dest, | |
733 eosd_targets[i].surface, &eosd_targets[i].source, | |
734 &eosd_targets[i].color, &blend_state, | |
735 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); | |
736 CHECK_ST_WARNING("EOSD: Error when rendering") | |
737 } | |
738 } | |
739 | |
740 static void generate_eosd(mp_eosd_images_t *imgs) { | |
741 VdpStatus vdp_st; | |
742 VdpRect destRect; | |
743 int j, found; | |
744 ass_image_t *img = imgs->imgs; | |
745 ass_image_t *i; | |
746 | |
747 // Nothing changed, no need to redraw | |
748 if (imgs->changed == 0) | |
28807
338065cac802
Remove duplicate OSD drawing introduced due to a conflict between r28840 and r28839.
reimar
parents:
28805
diff
changeset
|
749 return; |
28675 | 750 eosd_render_count = 0; |
751 // There's nothing to render! | |
752 if (!img) | |
753 return; | |
754 | |
755 if (imgs->changed == 1) | |
756 goto eosd_skip_upload; | |
757 | |
758 for (j=0; j<eosd_surface_count; j++) | |
759 eosd_surfaces[j].in_use = 0; | |
760 | |
761 for (i = img; i; i = i->next) { | |
762 // Try to reuse a suitable surface | |
763 found = -1; | |
764 for (j=0; j<eosd_surface_count; j++) { | |
765 if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE && !eosd_surfaces[j].in_use && | |
766 eosd_surfaces[j].w >= i->w && eosd_surfaces[j].h >= i->h) { | |
767 found = j; | |
768 break; | |
769 } | |
770 } | |
771 // None found, allocate a new surface | |
772 if (found < 0) { | |
773 for (j=0; j<eosd_surface_count; j++) { | |
774 if (!eosd_surfaces[j].in_use) { | |
775 if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE) | |
776 vdp_bitmap_surface_destroy(eosd_surfaces[j].surface); | |
777 found = j; | |
778 break; | |
779 } | |
780 } | |
781 // Allocate new space for surface/target arrays | |
782 if (found < 0) { | |
783 j = found = eosd_surface_count; | |
784 eosd_surface_count = eosd_surface_count ? eosd_surface_count*2 : EOSD_SURFACES_INITIAL; | |
785 eosd_surfaces = realloc(eosd_surfaces, eosd_surface_count * sizeof(*eosd_surfaces)); | |
786 eosd_targets = realloc(eosd_targets, eosd_surface_count * sizeof(*eosd_targets)); | |
787 for(j=found; j<eosd_surface_count; j++) { | |
788 eosd_surfaces[j].surface = VDP_INVALID_HANDLE; | |
789 eosd_surfaces[j].in_use = 0; | |
790 } | |
791 } | |
792 vdp_st = vdp_bitmap_surface_create(vdp_device, VDP_RGBA_FORMAT_A8, | |
793 i->w, i->h, VDP_TRUE, &eosd_surfaces[found].surface); | |
794 CHECK_ST_WARNING("EOSD: error when creating surface") | |
795 eosd_surfaces[found].w = i->w; | |
796 eosd_surfaces[found].h = i->h; | |
797 } | |
798 eosd_surfaces[found].in_use = 1; | |
799 eosd_targets[eosd_render_count].surface = eosd_surfaces[found].surface; | |
800 destRect.x0 = 0; | |
801 destRect.y0 = 0; | |
802 destRect.x1 = i->w; | |
803 destRect.y1 = i->h; | |
804 vdp_st = vdp_bitmap_surface_putbits_native(eosd_targets[eosd_render_count].surface, | |
805 (const void *) &i->bitmap, &i->stride, &destRect); | |
806 CHECK_ST_WARNING("EOSD: putbits failed") | |
807 eosd_render_count++; | |
808 } | |
809 | |
810 eosd_skip_upload: | |
811 eosd_render_count = 0; | |
812 for (i = img; i; i = i->next) { | |
813 // Render dest, color, etc. | |
814 eosd_targets[eosd_render_count].color.alpha = 1.0 - ((i->color >> 0) & 0xff) / 255.0; | |
815 eosd_targets[eosd_render_count].color.blue = ((i->color >> 8) & 0xff) / 255.0; | |
816 eosd_targets[eosd_render_count].color.green = ((i->color >> 16) & 0xff) / 255.0; | |
817 eosd_targets[eosd_render_count].color.red = ((i->color >> 24) & 0xff) / 255.0; | |
818 eosd_targets[eosd_render_count].dest.x0 = i->dst_x; | |
819 eosd_targets[eosd_render_count].dest.y0 = i->dst_y; | |
820 eosd_targets[eosd_render_count].dest.x1 = i->w + i->dst_x; | |
821 eosd_targets[eosd_render_count].dest.y1 = i->h + i->dst_y; | |
822 eosd_targets[eosd_render_count].source.x0 = 0; | |
823 eosd_targets[eosd_render_count].source.y0 = 0; | |
824 eosd_targets[eosd_render_count].source.x1 = i->w; | |
825 eosd_targets[eosd_render_count].source.y1 = i->h; | |
826 eosd_render_count++; | |
827 } | |
828 } | |
829 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
830 static void draw_osd(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
831 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
832 mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
833 |
28598
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
834 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
|
835 vid_width, vid_height, draw_osd_I8A8); |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
836 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
837 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
838 static void flip_page(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
839 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
840 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
841 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
|
842 surface_render[vid_surface_num].surface, output_surfaces[surface_num]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
843 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
844 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
|
845 vo_dwidth, vo_dheight, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
846 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
847 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
848 |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
849 surface_num = (surface_num + 1) % NUM_OUTPUT_SURFACES; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
850 visible_buf = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
851 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
852 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
853 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
|
854 int x, int y) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
855 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
856 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
857 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
|
858 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
|
859 if (!IMGFMT_IS_VDPAU(image_format)) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
860 return VO_FALSE; |
28989 | 861 if ((decoder == VDP_INVALID_HANDLE || decoder_max_refs < max_refs) |
28991 | 862 && !create_vdp_decoder(max_refs)) |
28989 | 863 return VO_FALSE; |
864 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
865 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
|
866 CHECK_ST_WARNING("Failed VDPAU decoder rendering"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
867 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
868 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
869 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
870 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
871 static int draw_frame(uint8_t *src[]) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
872 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
873 return VO_ERROR; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
874 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
875 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
876 static struct vdpau_render_state *get_surface(int number) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
877 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
878 if (number > MAX_VIDEO_SURFACES) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
879 return NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
880 if (surface_render[number].surface == VDP_INVALID_HANDLE) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
881 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
882 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
|
883 vid_width, vid_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
884 &surface_render[number].surface); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
885 CHECK_ST_WARNING("Error when calling vdp_video_surface_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
886 if (vdp_st != VDP_STATUS_OK) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
887 return NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
888 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
889 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
|
890 return &surface_render[number]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
891 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
892 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
893 static uint32_t draw_image(mp_image_t *mpi) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
894 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
895 if (IMGFMT_IS_VDPAU(image_format)) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
896 struct vdpau_render_state *rndr = mpi->priv; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
897 vid_surface_num = rndr - surface_render; |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
898 if (deint_buffer_past_frames) { |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
899 mpi->usage_count++; |
29017
c9a2d95c580a
New vdpau deinterlacing code needs one reference surface less.
cehoyos
parents:
29016
diff
changeset
|
900 if (deint_mpi[1]) |
c9a2d95c580a
New vdpau deinterlacing code needs one reference surface less.
cehoyos
parents:
29016
diff
changeset
|
901 deint_mpi[1]->usage_count--; |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
902 deint_mpi[1] = deint_mpi[0]; |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
903 deint_mpi[0] = mpi; |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
904 } |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
905 } else if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
906 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
907 void *destdata[3] = {mpi->planes[0], mpi->planes[2], mpi->planes[1]}; |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
908 struct vdpau_render_state *rndr = get_surface(deint_counter); |
29018
b04ff8b244bb
New VDPAU deinterlacing code needs one reference surface less for software decoding.
cehoyos
parents:
29017
diff
changeset
|
909 deint_counter = (deint_counter + 1) % 3; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
910 vid_surface_num = rndr - surface_render; |
29070 | 911 if (image_format == IMGFMT_NV12) |
912 destdata[1] = destdata[2]; | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
913 vdp_st = vdp_video_surface_put_bits_y_cb_cr(rndr->surface, |
29066
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
914 vdp_pixel_format, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
915 (const void *const*)destdata, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
916 mpi->stride); // pitch |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
917 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
|
918 } |
29054
d865fa57c316
10l: Don't use MP_IMGFIELD_TOP_FIRST if MP_IMGFIELD_ORDERED is not set.
cehoyos
parents:
29026
diff
changeset
|
919 if (mpi->fields & MP_IMGFIELD_ORDERED) |
29055 | 920 top_field_first = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST); |
29054
d865fa57c316
10l: Don't use MP_IMGFIELD_TOP_FIRST if MP_IMGFIELD_ORDERED is not set.
cehoyos
parents:
29026
diff
changeset
|
921 else |
d865fa57c316
10l: Don't use MP_IMGFIELD_TOP_FIRST if MP_IMGFIELD_ORDERED is not set.
cehoyos
parents:
29026
diff
changeset
|
922 top_field_first = 1; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
923 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
924 video_to_output_surface(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
925 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
926 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
927 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
928 static uint32_t get_image(mp_image_t *mpi) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
929 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
930 struct vdpau_render_state *rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
931 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
932 // no dr for non-decoding for now |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
933 if (!IMGFMT_IS_VDPAU(image_format)) return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
934 if (mpi->type != MP_IMGTYPE_NUMBERED) return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
935 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
936 rndr = get_surface(mpi->number); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
937 if (!rndr) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
938 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
|
939 // TODO: this probably breaks things forever, provide a dummy buffer? |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
940 return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
941 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
942 mpi->flags |= MP_IMGFLAG_DIRECT; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
943 mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
944 mpi->planes[0] = mpi->planes[1] = mpi->planes[2] = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
945 // 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
|
946 mpi->planes[0] = (void *)rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
947 mpi->num_planes = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
948 mpi->priv = rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
949 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
950 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
951 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
952 static int query_format(uint32_t format) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
953 { |
28675 | 954 int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_EOSD | VFCAP_EOSD_UNSCALED; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
955 switch (format) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
956 case IMGFMT_YV12: |
29065 | 957 case IMGFMT_I420: |
958 case IMGFMT_IYUV: | |
29070 | 959 case IMGFMT_NV12: |
29066
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
960 case IMGFMT_YUY2: |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
961 case IMGFMT_UYVY: |
28611
00c0123b6df3
Add VOCAP_NOSLICES and use it to allow vo_vdpau to not support slices for
reimar
parents:
28598
diff
changeset
|
962 return default_flags | VOCAP_NOSLICES; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
963 case IMGFMT_VDPAU_MPEG1: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
964 case IMGFMT_VDPAU_MPEG2: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
965 case IMGFMT_VDPAU_H264: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
966 case IMGFMT_VDPAU_WMV3: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
967 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
|
968 return default_flags; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
969 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
970 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
971 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
972 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
973 static void DestroyVdpauObjects(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
974 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
975 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
976 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
977 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
978 free_video_specific(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
979 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
980 vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
981 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
982 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
983 vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
984 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
|
985 |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
986 for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) { |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
987 vdp_st = vdp_output_surface_destroy(output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
988 output_surfaces[i] = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
989 CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
990 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
991 |
28675 | 992 for (i = 0; i<eosd_surface_count; i++) { |
993 if (eosd_surfaces[i].surface != VDP_INVALID_HANDLE) { | |
994 vdp_st = vdp_bitmap_surface_destroy(eosd_surfaces[i].surface); | |
995 CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy") | |
996 } | |
997 eosd_surfaces[i].surface = VDP_INVALID_HANDLE; | |
998 } | |
999 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1000 vdp_st = vdp_device_destroy(vdp_device); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1001 CHECK_ST_WARNING("Error when calling vdp_device_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1002 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1003 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1004 static void uninit(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1005 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1006 if (!vo_config_count) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1007 return; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1008 visible_buf = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1009 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1010 /* Destroy all vdpau objects */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1011 DestroyVdpauObjects(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1012 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1013 free(index_data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1014 index_data = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1015 |
28675 | 1016 free(eosd_surfaces); |
1017 eosd_surfaces = NULL; | |
1018 free(eosd_targets); | |
1019 eosd_targets = NULL; | |
1020 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1021 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1022 vo_vm_close(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1023 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1024 vo_x11_uninit(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1025 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1026 dlclose(vdpau_lib_handle); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1027 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1028 |
28828
56eee6ffba9b
Make data related to suboption parsing const in libvo
reimar
parents:
28807
diff
changeset
|
1029 static const opt_t subopts[] = { |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1030 {"deint", OPT_ARG_INT, &deint, (opt_test_f)int_non_neg}, |
28944
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
1031 {"chroma-deint", OPT_ARG_BOOL, &chroma_deint, NULL}, |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1032 {"pullup", OPT_ARG_BOOL, &pullup, NULL}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1033 {"denoise", OPT_ARG_FLOAT, &denoise, NULL}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1034 {"sharpen", OPT_ARG_FLOAT, &sharpen, NULL}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1035 {NULL} |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1036 }; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1037 |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1038 static const char help_msg[] = |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1039 "\n-vo vdpau command line help:\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1040 "Example: mplayer -vo vdpau:deint=2\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1041 "\nOptions:\n" |
28707
a81065b771e7
Document that all vdpau deinterlacers respect -field-dominance.
cehoyos
parents:
28702
diff
changeset
|
1042 " deint (all modes > 0 respect -field-dominance)\n" |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1043 " 0: no deinterlacing\n" |
28708 | 1044 " 1: only show first field\n" |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
1045 " 2: bob deinterlacing\n" |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
1046 " 3: temporal deinterlacing (resource-hungry)\n" |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
1047 " 4: temporal-spatial deinterlacing (very resource-hungry)\n" |
28944
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
1048 " chroma-deint\n" |
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
1049 " Operate on luma and chroma when using temporal deinterlacing (default)\n" |
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
1050 " Use nochroma-deint to speed up temporal deinterlacing\n" |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1051 " pullup\n" |
28935 | 1052 " Try to apply inverse-telecine (needs temporal deinterlacing)\n" |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1053 " denoise\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1054 " Apply denoising, argument is strength from 0.0 to 1.0\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1055 " sharpen\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1056 " Apply sharpening or softening, argument is strength from -1.0 to 1.0\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1057 ; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1058 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1059 static int preinit(const char *arg) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1060 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1061 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1062 static const char *vdpaulibrary = "libvdpau.so.1"; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1063 static const char *vdpau_device_create = "vdp_device_create_x11"; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1064 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1065 deint = 0; |
28709
4e89476f8952
Do not forget the chosen deinterlacer for -vo vdpau.
cehoyos
parents:
28708
diff
changeset
|
1066 deint_type = 3; |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1067 deint_counter = 0; |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
1068 deint_buffer_past_frames = 0; |
29017
c9a2d95c580a
New vdpau deinterlacing code needs one reference surface less.
cehoyos
parents:
29016
diff
changeset
|
1069 deint_mpi[0] = deint_mpi[1] = NULL; |
28944
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
1070 chroma_deint = 1; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1071 pullup = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1072 denoise = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1073 sharpen = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1074 if (subopt_parse(arg, subopts) != 0) { |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1075 mp_msg(MSGT_VO, MSGL_FATAL, help_msg); |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1076 return -1; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1077 } |
28709
4e89476f8952
Do not forget the chosen deinterlacer for -vo vdpau.
cehoyos
parents:
28708
diff
changeset
|
1078 if (deint) |
4e89476f8952
Do not forget the chosen deinterlacer for -vo vdpau.
cehoyos
parents:
28708
diff
changeset
|
1079 deint_type = deint; |
29026
17e9f67f086b
Simplify vdpau deinterlacing code and fix timing for deint=2.
cehoyos
parents:
29018
diff
changeset
|
1080 if (deint > 1) |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
1081 deint_buffer_past_frames = 1; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1082 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1083 vdpau_lib_handle = dlopen(vdpaulibrary, RTLD_LAZY); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1084 if (!vdpau_lib_handle) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1085 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
|
1086 vdpaulibrary); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1087 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1088 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1089 vdp_device_create = dlsym(vdpau_lib_handle, vdpau_device_create); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1090 if (!vdp_device_create) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1091 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
|
1092 vdpau_device_create, vdpaulibrary); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1093 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1094 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1095 if (!vo_init() || win_x11_init_vdpau_procs()) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1096 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1097 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1098 decoder = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1099 for (i = 0; i < MAX_VIDEO_SURFACES; i++) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1100 surface_render[i].surface = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1101 video_mixer = VDP_INVALID_HANDLE; |
28774
95123b577ad0
Make sure all output_surfaces are initialized in preinit.
reimar
parents:
28729
diff
changeset
|
1102 for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1103 output_surfaces[i] = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1104 vdp_flip_queue = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1105 output_surface_width = output_surface_height = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1106 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1107 // full grayscale palette. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1108 for (i = 0; i < PALETTE_SIZE; ++i) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1109 palette[i] = (i << 16) | (i << 8) | i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1110 index_data = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1111 index_data_size = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1112 |
28675 | 1113 eosd_surface_count = eosd_render_count = 0; |
1114 eosd_surfaces = NULL; | |
1115 eosd_targets = NULL; | |
1116 | |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1117 procamp.struct_version = VDP_PROCAMP_VERSION; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1118 procamp.brightness = 0.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1119 procamp.contrast = 1.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1120 procamp.saturation = 1.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1121 procamp.hue = 0.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1122 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1123 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1124 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1125 |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1126 static int get_equalizer(char *name, int *value) { |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1127 if (!strcasecmp(name, "brightness")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1128 *value = procamp.brightness * 100; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1129 else if (!strcasecmp(name, "contrast")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1130 *value = (procamp.contrast-1.0) * 100; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1131 else if (!strcasecmp(name, "saturation")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1132 *value = (procamp.saturation-1.0) * 100; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1133 else if (!strcasecmp(name, "hue")) |
28729 | 1134 *value = procamp.hue * 100 / M_PI; |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1135 else |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1136 return VO_NOTIMPL; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1137 return VO_TRUE; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1138 } |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1139 |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1140 static int set_equalizer(char *name, int value) { |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1141 VdpStatus vdp_st; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1142 VdpCSCMatrix matrix; |
28728
c9b2f40aaf18
Make VdpVideoMixerAttribute attributes[] static const.
cehoyos
parents:
28725
diff
changeset
|
1143 static const VdpVideoMixerAttribute attributes[] = {VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX}; |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1144 const void *attribute_values[] = {&matrix}; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1145 |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1146 if (!strcasecmp(name, "brightness")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1147 procamp.brightness = value / 100.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1148 else if (!strcasecmp(name, "contrast")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1149 procamp.contrast = value / 100.0 + 1.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1150 else if (!strcasecmp(name, "saturation")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1151 procamp.saturation = value / 100.0 + 1.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1152 else if (!strcasecmp(name, "hue")) |
28729 | 1153 procamp.hue = value / 100.0 * M_PI; |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1154 else |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1155 return VO_NOTIMPL; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1156 |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1157 vdp_st = vdp_generate_csc_matrix(&procamp, VDP_COLOR_STANDARD_ITUR_BT_601, |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1158 &matrix); |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1159 CHECK_ST_WARNING("Error when generating CSC matrix") |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1160 vdp_st = vdp_video_mixer_set_attribute_values(video_mixer, 1, attributes, |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1161 attribute_values); |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1162 CHECK_ST_WARNING("Error when setting CSC matrix") |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1163 return VO_TRUE; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1164 } |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1165 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1166 static int control(uint32_t request, void *data, ...) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1167 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1168 switch (request) { |
28701
fc457469ed7b
Support "D" to (de-)activate deinterlacing when using vo vdpau.
cehoyos
parents:
28699
diff
changeset
|
1169 case VOCTRL_GET_DEINTERLACE: |
fc457469ed7b
Support "D" to (de-)activate deinterlacing when using vo vdpau.
cehoyos
parents:
28699
diff
changeset
|
1170 *(int*)data = deint; |
fc457469ed7b
Support "D" to (de-)activate deinterlacing when using vo vdpau.
cehoyos
parents:
28699
diff
changeset
|
1171 return VO_TRUE; |
fc457469ed7b
Support "D" to (de-)activate deinterlacing when using vo vdpau.
cehoyos
parents:
28699
diff
changeset
|
1172 case VOCTRL_SET_DEINTERLACE: |
fc457469ed7b
Support "D" to (de-)activate deinterlacing when using vo vdpau.
cehoyos
parents:
28699
diff
changeset
|
1173 deint = *(int*)data; |
28709
4e89476f8952
Do not forget the chosen deinterlacer for -vo vdpau.
cehoyos
parents:
28708
diff
changeset
|
1174 if (deint) |
4e89476f8952
Do not forget the chosen deinterlacer for -vo vdpau.
cehoyos
parents:
28708
diff
changeset
|
1175 deint = deint_type; |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1176 if (deint_type > 2) { |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1177 VdpStatus vdp_st; |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1178 VdpVideoMixerFeature features[1] = |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1179 {deint_type == 3 ? |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1180 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL : |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1181 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL}; |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1182 VdpBool feature_enables[1] = {deint ? VDP_TRUE : VDP_FALSE}; |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1183 vdp_st = vdp_video_mixer_set_feature_enables(video_mixer, 1, |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1184 features, |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1185 feature_enables); |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1186 CHECK_ST_WARNING("Error changing deinterlacing settings") |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
1187 deint_buffer_past_frames = 1; |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1188 } |
28701
fc457469ed7b
Support "D" to (de-)activate deinterlacing when using vo vdpau.
cehoyos
parents:
28699
diff
changeset
|
1189 return VO_TRUE; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1190 case VOCTRL_PAUSE: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1191 return (int_pause = 1); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1192 case VOCTRL_RESUME: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1193 return (int_pause = 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1194 case VOCTRL_QUERY_FORMAT: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1195 return query_format(*(uint32_t *)data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1196 case VOCTRL_GET_IMAGE: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1197 return get_image(data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1198 case VOCTRL_DRAW_IMAGE: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1199 return draw_image(data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1200 case VOCTRL_GUISUPPORT: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1201 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1202 case VOCTRL_BORDER: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1203 vo_x11_border(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1204 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1205 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1206 case VOCTRL_FULLSCREEN: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1207 vo_x11_fullscreen(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1208 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1209 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1210 case VOCTRL_GET_PANSCAN: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1211 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1212 case VOCTRL_SET_PANSCAN: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1213 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1214 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1215 case VOCTRL_SET_EQUALIZER: { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1216 va_list ap; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1217 int value; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1218 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1219 va_start(ap, data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1220 value = va_arg(ap, int); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1221 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1222 va_end(ap); |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1223 return set_equalizer(data, value); |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1224 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1225 case VOCTRL_GET_EQUALIZER: { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1226 va_list ap; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1227 int *value; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1228 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1229 va_start(ap, data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1230 value = va_arg(ap, int *); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1231 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1232 va_end(ap); |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1233 return get_equalizer(data, value); |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1234 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1235 case VOCTRL_ONTOP: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1236 vo_x11_ontop(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1237 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1238 case VOCTRL_UPDATE_SCREENINFO: |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1239 update_xinerama_info(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1240 return VO_TRUE; |
28675 | 1241 case VOCTRL_DRAW_EOSD: |
1242 if (!data) | |
1243 return VO_FALSE; | |
1244 generate_eosd(data); | |
28804
5ccdec6c14f0
Draw EOSD with VOCTRL_DRAW_EOSD instead of along with OSD.
greg
parents:
28774
diff
changeset
|
1245 draw_eosd(); |
28675 | 1246 return VO_TRUE; |
1247 case VOCTRL_GET_EOSD_RES: { | |
1248 mp_eosd_res_t *r = data; | |
1249 r->mt = r->mb = r->ml = r->mr = 0; | |
1250 if (vo_fs) { | |
1251 r->w = vo_screenwidth; | |
1252 r->h = vo_screenheight; | |
1253 r->ml = r->mr = border_x; | |
1254 r->mt = r->mb = border_y; | |
28699 | 1255 } else { |
1256 r->w = vo_dwidth; | |
1257 r->h = vo_dheight; | |
1258 } | |
28675 | 1259 return VO_TRUE; |
1260 } | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1261 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1262 return VO_NOTIMPL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1263 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1264 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1265 /* @} */ |