Mercurial > mplayer.hg
annotate libvo/vo_vdpau.c @ 31666:796b778e2411
Enable robust resync for mpg123 decoder.
This prevents the decoder from giving up give after long pieces of invalid
data, for example during transmission errors with DVB-T and similar.
patch by Thomas Orgis, thomas-forum orgis org
author | diego |
---|---|
date | Tue, 13 Jul 2010 15:11:34 +0000 |
parents | afa2737707e6 |
children | 550ffba86d9c |
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 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
37 #include "config.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
38 #include "mp_msg.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
39 #include "video_out.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
40 #include "video_out_internal.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
41 #include "x11_common.h" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
42 #include "aspect.h" |
31317
afa2737707e6
Add missing font_load.h include (previously hidden by gui include).
reimar
parents:
31316
diff
changeset
|
43 #include "font_load.h" |
28582
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 "libavutil/common.h" |
28729 | 50 #include "libavutil/mathematics.h" |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
51 |
28675 | 52 #include "libass/ass_mp.h" |
53 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
54 static vo_info_t info = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
55 "VDPAU with X11", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
56 "vdpau", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
57 "Rajib Mahapatra <rmahapatra@nvidia.com> and others", |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
58 "" |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
59 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
60 |
30925
f8939d5b14b5
Mark some more LIBVO_EXTERN declarations as const where possible.
reimar
parents:
30758
diff
changeset
|
61 const LIBVO_EXTERN(vdpau) |
28582
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 #define CHECK_ST_ERROR(message) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
64 if (vdp_st != VDP_STATUS_OK) { \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
65 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
66 message, vdp_get_error_string(vdp_st)); \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
67 return -1; \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
68 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
69 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
70 #define CHECK_ST_WARNING(message) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
71 if (vdp_st != VDP_STATUS_OK) \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
72 mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
73 message, vdp_get_error_string(vdp_st)); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
74 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
75 /* number of video and output surfaces */ |
30006
73d653fd865f
Improve VDPAU render performance by increasing number of output surfaces.
cehoyos
parents:
29861
diff
changeset
|
76 #define NUM_OUTPUT_SURFACES 3 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
77 #define MAX_VIDEO_SURFACES 50 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
78 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
79 /* number of palette entries */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
80 #define PALETTE_SIZE 256 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
81 |
28675 | 82 /* Initial maximum number of EOSD surfaces */ |
83 #define EOSD_SURFACES_INITIAL 512 | |
84 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
85 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
86 * Global variable declaration - VDPAU specific |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
87 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
88 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
89 /* 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
|
90 * win_x11_init_vdpau_flip_queue() functions |
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 static VdpDevice vdp_device; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
93 static VdpGetProcAddress *vdp_get_proc_address; |
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 VdpPresentationQueueTarget vdp_flip_target; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
96 static VdpPresentationQueue vdp_flip_queue; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
97 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
98 static VdpDeviceDestroy *vdp_device_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
99 static VdpVideoSurfaceCreate *vdp_video_surface_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
100 static VdpVideoSurfaceDestroy *vdp_video_surface_destroy; |
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 VdpGetErrorString *vdp_get_error_string; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
103 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
104 /* May be used in software filtering/postprocessing options |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
105 * 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
|
106 * system memory. |
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 static VdpVideoSurfacePutBitsYCbCr *vdp_video_surface_put_bits_y_cb_cr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
109 static VdpOutputSurfacePutBitsNative *vdp_output_surface_put_bits_native; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
110 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
111 static VdpOutputSurfaceCreate *vdp_output_surface_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
112 static VdpOutputSurfaceDestroy *vdp_output_surface_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
113 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
114 /* VideoMixer puts video_surface data on displayable output_surface. */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
115 static VdpVideoMixerCreate *vdp_video_mixer_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
116 static VdpVideoMixerDestroy *vdp_video_mixer_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
117 static VdpVideoMixerRender *vdp_video_mixer_render; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
118 static VdpVideoMixerSetFeatureEnables *vdp_video_mixer_set_feature_enables; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
119 static VdpVideoMixerSetAttributeValues *vdp_video_mixer_set_attribute_values; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
120 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
121 static VdpPresentationQueueTargetDestroy *vdp_presentation_queue_target_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
122 static VdpPresentationQueueCreate *vdp_presentation_queue_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
123 static VdpPresentationQueueDestroy *vdp_presentation_queue_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
124 static VdpPresentationQueueDisplay *vdp_presentation_queue_display; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
125 static VdpPresentationQueueBlockUntilSurfaceIdle *vdp_presentation_queue_block_until_surface_idle; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
126 static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
127 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
128 static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
129 static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed; |
28675 | 130 static VdpOutputSurfaceRenderBitmapSurface *vdp_output_surface_render_bitmap_surface; |
131 | |
132 static VdpBitmapSurfaceCreate *vdp_bitmap_surface_create; | |
133 static VdpBitmapSurfaceDestroy *vdp_bitmap_surface_destroy; | |
134 static VdpBitmapSurfacePutBitsNative *vdp_bitmap_surface_putbits_native; | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
135 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
136 static VdpDecoderCreate *vdp_decoder_create; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
137 static VdpDecoderDestroy *vdp_decoder_destroy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
138 static VdpDecoderRender *vdp_decoder_render; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
139 |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
140 static VdpGenerateCSCMatrix *vdp_generate_csc_matrix; |
29735 | 141 static VdpPreemptionCallbackRegister *vdp_preemption_callback_register; |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
142 |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
143 /* 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
|
144 #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
|
145 static VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES + 1]; |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
146 static VdpVideoSurface deint_surfaces[3]; |
29017
c9a2d95c580a
New vdpau deinterlacing code needs one reference surface less.
cehoyos
parents:
29016
diff
changeset
|
147 static mp_image_t *deint_mpi[2]; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
148 static int output_surface_width, output_surface_height; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
149 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
150 static VdpVideoMixer video_mixer; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
151 static int deint; |
28709
4e89476f8952
Do not forget the chosen deinterlacer for -vo vdpau.
cehoyos
parents:
28708
diff
changeset
|
152 static int deint_type; |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
153 static int deint_counter; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
154 static int pullup; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
155 static float denoise; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
156 static float sharpen; |
29727 | 157 static int colorspace; |
28944
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
158 static int chroma_deint; |
29756 | 159 static int force_mixer; |
28684 | 160 static int top_field_first; |
29752 | 161 static int flip; |
29781
508417d485d6
Add new VDPAU feature high-quality-scaling (and require newer library).
cehoyos
parents:
29757
diff
changeset
|
162 static int hqscaling; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
163 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
164 static VdpDecoder decoder; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
165 static int decoder_max_refs; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
166 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
167 static VdpRect src_rect_vid; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
168 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
|
169 static int border_x, border_y; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
170 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
171 static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
172 static int surface_num; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
173 static int vid_surface_num; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
174 static uint32_t vid_width, vid_height; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
175 static uint32_t image_format; |
29066
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
176 static VdpChromaType vdp_chroma_type; |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
177 static VdpYCbCrFormat vdp_pixel_format; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
178 |
29735 | 179 static volatile int is_preempted; |
180 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
181 /* draw_osd */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
182 static unsigned char *index_data; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
183 static int index_data_size; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
184 static uint32_t palette[PALETTE_SIZE]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
185 |
28675 | 186 // EOSD |
187 // Pool of surfaces | |
188 struct { | |
189 VdpBitmapSurface surface; | |
190 int w; | |
191 int h; | |
192 char in_use; | |
193 } *eosd_surfaces; | |
194 | |
195 // List of surfaces to be rendered | |
196 struct { | |
197 VdpBitmapSurface surface; | |
198 VdpRect source; | |
199 VdpRect dest; | |
200 VdpColor color; | |
201 } *eosd_targets; | |
202 | |
203 static int eosd_render_count; | |
204 static int eosd_surface_count; | |
205 | |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
206 // Video equalizer |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
207 static VdpProcamp procamp; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
208 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
209 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
210 * X11 specific |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
211 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
212 static int visible_buf; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
213 static int int_pause; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
214 |
28805
b382d065ba53
As for vo_gl, do not rely on draw_osd to render EOSD.
reimar
parents:
28804
diff
changeset
|
215 static void draw_eosd(void); |
b382d065ba53
As for vo_gl, do not rely on draw_osd to render EOSD.
reimar
parents:
28804
diff
changeset
|
216 |
29016
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
217 static void push_deint_surface(VdpVideoSurface surface) |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
218 { |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
219 deint_surfaces[2] = deint_surfaces[1]; |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
220 deint_surfaces[1] = deint_surfaces[0]; |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
221 deint_surfaces[0] = surface; |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
222 } |
8e95cca7c58d
Stephen Warren reported that VDPAU deinterlacing did not work correctly.
cehoyos
parents:
29005
diff
changeset
|
223 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
224 static void video_to_output_surface(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
225 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
226 VdpTime dummy; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
227 VdpStatus vdp_st; |
28684 | 228 int i; |
29026
17e9f67f086b
Simplify vdpau deinterlacing code and fix timing for deint=2.
cehoyos
parents:
29018
diff
changeset
|
229 if (vid_surface_num < 0) |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
230 return; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
231 |
29026
17e9f67f086b
Simplify vdpau deinterlacing code and fix timing for deint=2.
cehoyos
parents:
29018
diff
changeset
|
232 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
|
233 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
|
234 |
28708 | 235 for (i = 0; i <= !!(deint > 1); i++) { |
28684 | 236 int field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; |
237 VdpOutputSurface output_surface; | |
28724 | 238 if (i) { |
28805
b382d065ba53
As for vo_gl, do not rely on draw_osd to render EOSD.
reimar
parents:
28804
diff
changeset
|
239 draw_eosd(); |
28724 | 240 draw_osd(); |
28684 | 241 flip_page(); |
28724 | 242 } |
28684 | 243 if (deint) |
29026
17e9f67f086b
Simplify vdpau deinterlacing code and fix timing for deint=2.
cehoyos
parents:
29018
diff
changeset
|
244 field = (top_field_first == i) ^ (deint > 1) ? |
28684 | 245 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD: |
246 VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; | |
247 output_surface = output_surfaces[surface_num]; | |
248 vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue, | |
249 output_surface, | |
250 &dummy); | |
251 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
|
252 |
28689 | 253 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
|
254 field, 2, deint_surfaces + 1, |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
255 deint_surfaces[0], |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
256 1, &surface_render[vid_surface_num].surface, |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
257 &src_rect_vid, |
28689 | 258 output_surface, |
259 NULL, &out_rect_vid, 0, NULL); | |
260 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
|
261 push_deint_surface(surface_render[vid_surface_num].surface); |
28684 | 262 } |
28582
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 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
265 static void resize(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
266 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
267 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
268 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
269 struct vo_rect src_rect; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
270 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
|
271 struct vo_rect borders; |
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
272 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
|
273 out_rect_vid.x0 = dst_rect.left; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
274 out_rect_vid.x1 = dst_rect.right; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
275 out_rect_vid.y0 = dst_rect.top; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
276 out_rect_vid.y1 = dst_rect.bottom; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
277 src_rect_vid.x0 = src_rect.left; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
278 src_rect_vid.x1 = src_rect.right; |
29752 | 279 src_rect_vid.y0 = flip ? src_rect.bottom : src_rect.top; |
280 src_rect_vid.y1 = flip ? src_rect.top : src_rect.bottom; | |
28598
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
281 border_x = borders.left; |
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
282 border_y = borders.top; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
283 #ifdef CONFIG_FREETYPE |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
284 // adjust font size to display size |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
285 force_load_font = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
286 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
287 vo_osd_changed(OSDTYPE_OSD); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
288 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
289 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
|
290 if (output_surface_width < vo_dwidth) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
291 output_surface_width += output_surface_width >> 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
292 output_surface_width = FFMAX(output_surface_width, vo_dwidth); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
293 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
294 if (output_surface_height < vo_dheight) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
295 output_surface_height += output_surface_height >> 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
296 output_surface_height = FFMAX(output_surface_height, vo_dheight); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
297 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
298 // Creation of output_surfaces |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
299 for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) { |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
300 if (output_surfaces[i] != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
301 vdp_output_surface_destroy(output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
302 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
|
303 output_surface_width, output_surface_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
304 &output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
305 CHECK_ST_WARNING("Error when calling vdp_output_surface_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
306 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
|
307 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
308 } |
29756 | 309 if (image_format == IMGFMT_BGRA) { |
310 vdp_st = vdp_output_surface_render_output_surface(output_surfaces[surface_num], | |
311 NULL, VDP_INVALID_HANDLE, | |
312 NULL, NULL, NULL, | |
313 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); | |
314 CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface") | |
315 vdp_st = vdp_output_surface_render_output_surface(output_surfaces[1 - surface_num], | |
316 NULL, VDP_INVALID_HANDLE, | |
317 NULL, NULL, NULL, | |
318 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); | |
319 CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface") | |
320 } else | |
29757 | 321 video_to_output_surface(); |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
322 if (visible_buf) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
323 flip_page(); |
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 |
29735 | 326 static void preemption_callback(VdpDevice device, void *context) |
327 { | |
328 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Display preemption detected\n"); | |
329 is_preempted = 1; | |
330 } | |
331 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
332 /* Initialize vdp_get_proc_address, called from preinit() */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
333 static int win_x11_init_vdpau_procs(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
334 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
335 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
336 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
337 struct vdp_function { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
338 const int id; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
339 void *pointer; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
340 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
341 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
342 const struct vdp_function *dsc; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
343 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
344 static const struct vdp_function vdp_func[] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
345 {VDP_FUNC_ID_GET_ERROR_STRING, &vdp_get_error_string}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
346 {VDP_FUNC_ID_DEVICE_DESTROY, &vdp_device_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
347 {VDP_FUNC_ID_VIDEO_SURFACE_CREATE, &vdp_video_surface_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
348 {VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, &vdp_video_surface_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
349 {VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
350 &vdp_video_surface_put_bits_y_cb_cr}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
351 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
352 &vdp_output_surface_put_bits_native}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
353 {VDP_FUNC_ID_OUTPUT_SURFACE_CREATE, &vdp_output_surface_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
354 {VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY, &vdp_output_surface_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
355 {VDP_FUNC_ID_VIDEO_MIXER_CREATE, &vdp_video_mixer_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
356 {VDP_FUNC_ID_VIDEO_MIXER_DESTROY, &vdp_video_mixer_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
357 {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
|
358 {VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
359 &vdp_video_mixer_set_feature_enables}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
360 {VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
361 &vdp_video_mixer_set_attribute_values}, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
362 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
363 &vdp_presentation_queue_target_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
364 {VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE, &vdp_presentation_queue_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
365 {VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
366 &vdp_presentation_queue_destroy}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
367 {VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
368 &vdp_presentation_queue_display}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
369 {VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
370 &vdp_presentation_queue_block_until_surface_idle}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
371 {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
372 &vdp_presentation_queue_target_create_x11}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
373 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
374 &vdp_output_surface_render_output_surface}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
375 {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
376 &vdp_output_surface_put_bits_indexed}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
377 {VDP_FUNC_ID_DECODER_CREATE, &vdp_decoder_create}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
378 {VDP_FUNC_ID_DECODER_RENDER, &vdp_decoder_render}, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
379 {VDP_FUNC_ID_DECODER_DESTROY, &vdp_decoder_destroy}, |
28675 | 380 {VDP_FUNC_ID_BITMAP_SURFACE_CREATE, &vdp_bitmap_surface_create}, |
381 {VDP_FUNC_ID_BITMAP_SURFACE_DESTROY, &vdp_bitmap_surface_destroy}, | |
382 {VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE, | |
383 &vdp_bitmap_surface_putbits_native}, | |
384 {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE, | |
385 &vdp_output_surface_render_bitmap_surface}, | |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
386 {VDP_FUNC_ID_GENERATE_CSC_MATRIX, &vdp_generate_csc_matrix}, |
29735 | 387 {VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER, |
388 &vdp_preemption_callback_register}, | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
389 {0, NULL} |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
390 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
391 |
29861
356c49d60826
Do not dynamically load libvdpau.so.1, but link at compile time.
cehoyos
parents:
29843
diff
changeset
|
392 vdp_st = vdp_device_create_x11(mDisplay, mScreen, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
393 &vdp_device, &vdp_get_proc_address); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
394 if (vdp_st != VDP_STATUS_OK) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
395 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
|
396 return -1; |
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 |
29067
a560ab3e03e5
Make sure we do not accidentally use the vdp_get_error_string from the
reimar
parents:
29066
diff
changeset
|
399 vdp_get_error_string = NULL; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
400 for (dsc = vdp_func; dsc->pointer; dsc++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
401 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
|
402 if (vdp_st != VDP_STATUS_OK) { |
29713 | 403 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_get_proc_address(function id %d): %s\n", |
404 dsc->id, vdp_get_error_string ? vdp_get_error_string(vdp_st) : "?"); | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
405 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
406 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
407 } |
29735 | 408 vdp_st = vdp_preemption_callback_register(vdp_device, |
409 preemption_callback, NULL); | |
410 CHECK_ST_ERROR("Error when calling vdp_preemption_callback_register") | |
411 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
412 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
413 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
414 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
415 /* Initialize vdpau_flip_queue, called from config() */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
416 static int win_x11_init_vdpau_flip_queue(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
417 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
418 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
419 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
420 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
|
421 &vdp_flip_target); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
422 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
|
423 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
424 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
|
425 &vdp_flip_queue); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
426 CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
427 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
428 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
429 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
430 |
29727 | 431 static int update_csc_matrix(void) |
432 { | |
433 VdpStatus vdp_st; | |
434 VdpCSCMatrix matrix; | |
435 static const VdpVideoMixerAttribute attributes[] = {VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX}; | |
436 const void *attribute_values[] = {&matrix}; | |
29729 | 437 static const VdpColorStandard vdp_colors[] = {0, VDP_COLOR_STANDARD_ITUR_BT_601, VDP_COLOR_STANDARD_ITUR_BT_709, VDP_COLOR_STANDARD_SMPTE_240M}; |
438 static const char * const vdp_names[] = {NULL, "BT.601", "BT.709", "SMPTE-240M"}; | |
29727 | 439 int csp = colorspace; |
440 | |
441 if (!csp) | |
442 csp = vid_width >= 1280 || vid_height > 576 ? 2 : 1; | |
443 | |
444 mp_msg(MSGT_VO, MSGL_V, "[vdpau] Updating CSC matrix for %s\n", | |
445 vdp_names[csp]); | |
446 | |
447 vdp_st = vdp_generate_csc_matrix(&procamp, vdp_colors[csp], &matrix); | |
448 CHECK_ST_WARNING("Error when generating CSC matrix") | |
449 | |
450 vdp_st = vdp_video_mixer_set_attribute_values(video_mixer, 1, attributes, | |
451 attribute_values); | |
452 CHECK_ST_WARNING("Error when setting CSC matrix") | |
453 return VO_TRUE; | |
454 } | |
455 | |
29713 | 456 static int create_vdp_mixer(VdpChromaType vdp_chroma_type) |
457 { | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
458 #define VDP_NUM_MIXER_PARAMETER 3 |
29781
508417d485d6
Add new VDPAU feature high-quality-scaling (and require newer library).
cehoyos
parents:
29757
diff
changeset
|
459 #define MAX_NUM_FEATURES 6 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
460 int i; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
461 VdpStatus vdp_st; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
462 int feature_count = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
463 VdpVideoMixerFeature features[MAX_NUM_FEATURES]; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
464 VdpBool feature_enables[MAX_NUM_FEATURES]; |
28658 | 465 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
|
466 const void * const denoise_value[] = {&denoise}; |
28658 | 467 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
|
468 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
|
469 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
|
470 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
|
471 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
|
472 static const VdpVideoMixerParameter parameters[VDP_NUM_MIXER_PARAMETER] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
473 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
474 VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
475 VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
476 }; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
477 const void *const parameter_values[VDP_NUM_MIXER_PARAMETER] = { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
478 &vid_width, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
479 &vid_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
480 &vdp_chroma_type |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
481 }; |
28934 | 482 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL; |
28708 | 483 if (deint == 4) |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
484 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
|
485 if (pullup) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
486 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
487 if (denoise) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
488 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
489 if (sharpen) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
490 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS; |
29781
508417d485d6
Add new VDPAU feature high-quality-scaling (and require newer library).
cehoyos
parents:
29757
diff
changeset
|
491 if (hqscaling) |
508417d485d6
Add new VDPAU feature high-quality-scaling (and require newer library).
cehoyos
parents:
29757
diff
changeset
|
492 features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 + (hqscaling - 1); |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
493 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
494 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
|
495 VDP_NUM_MIXER_PARAMETER, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
496 parameters, parameter_values, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
497 &video_mixer); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
498 CHECK_ST_ERROR("Error when calling vdp_video_mixer_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
499 |
29713 | 500 for (i = 0; i < feature_count; i++) |
501 feature_enables[i] = VDP_TRUE; | |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
502 if (deint < 3) |
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
503 feature_enables[0] = VDP_FALSE; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
504 if (feature_count) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
505 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
|
506 if (denoise) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
507 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
|
508 if (sharpen) |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
509 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
|
510 if (!chroma_deint) |
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
511 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
|
512 |
29727 | 513 update_csc_matrix(); |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
514 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
515 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
516 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
517 // Free everything specific to a certain video file |
29713 | 518 static void free_video_specific(void) |
519 { | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
520 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
521 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
522 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
523 if (decoder != VDP_INVALID_HANDLE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
524 vdp_decoder_destroy(decoder); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
525 decoder = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
526 decoder_max_refs = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
527 |
28936
fd9de1e70d47
Move initialisation of deint_surfaces[] to free_video_specific().
cehoyos
parents:
28935
diff
changeset
|
528 for (i = 0; i < 3; i++) |
fd9de1e70d47
Move initialisation of deint_surfaces[] to free_video_specific().
cehoyos
parents:
28935
diff
changeset
|
529 deint_surfaces[i] = VDP_INVALID_HANDLE; |
fd9de1e70d47
Move initialisation of deint_surfaces[] to free_video_specific().
cehoyos
parents:
28935
diff
changeset
|
530 |
29017
c9a2d95c580a
New vdpau deinterlacing code needs one reference surface less.
cehoyos
parents:
29016
diff
changeset
|
531 for (i = 0; i < 2; i++) |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
532 if (deint_mpi[i]) { |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
533 deint_mpi[i]->usage_count--; |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
534 deint_mpi[i] = NULL; |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
535 } |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
536 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
537 for (i = 0; i < MAX_VIDEO_SURFACES; i++) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
538 if (surface_render[i].surface != VDP_INVALID_HANDLE) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
539 vdp_st = vdp_video_surface_destroy(surface_render[i].surface); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
540 CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
541 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
542 surface_render[i].surface = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
543 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
544 |
28676
d5c295360163
Only check for vdp_video_mixer_destroy failure when we actually executed that function.
reimar
parents:
28675
diff
changeset
|
545 if (video_mixer != VDP_INVALID_HANDLE) { |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
546 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
|
547 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
|
548 } |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
549 video_mixer = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
550 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
551 |
29828
fe055da6637c
Fail in query_format() if a VDPAU decoder is not available.
cehoyos
parents:
29827
diff
changeset
|
552 static int create_vdp_decoder(uint32_t format, uint32_t width, uint32_t height, |
fe055da6637c
Fail in query_format() if a VDPAU decoder is not available.
cehoyos
parents:
29827
diff
changeset
|
553 int max_refs) |
28989 | 554 { |
555 VdpStatus vdp_st; | |
556 VdpDecoderProfile vdp_decoder_profile; | |
557 if (decoder != VDP_INVALID_HANDLE) | |
558 vdp_decoder_destroy(decoder); | |
29828
fe055da6637c
Fail in query_format() if a VDPAU decoder is not available.
cehoyos
parents:
29827
diff
changeset
|
559 switch (format) { |
29713 | 560 case IMGFMT_VDPAU_MPEG1: |
561 vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1; | |
562 break; | |
563 case IMGFMT_VDPAU_MPEG2: | |
564 vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG2_MAIN; | |
565 break; | |
566 case IMGFMT_VDPAU_H264: | |
567 vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH; | |
568 mp_msg(MSGT_VO, MSGL_V, "[vdpau] Creating H264 hardware decoder for %d reference frames.\n", max_refs); | |
569 break; | |
570 case IMGFMT_VDPAU_WMV3: | |
571 vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN; | |
572 break; | |
573 case IMGFMT_VDPAU_VC1: | |
574 vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED; | |
575 break; | |
29843
f6d56a15f1d8
Support VDPAU hardware accelerated decoding of MPEG-4 ASP on capable
cehoyos
parents:
29830
diff
changeset
|
576 case IMGFMT_VDPAU_MPEG4: |
f6d56a15f1d8
Support VDPAU hardware accelerated decoding of MPEG-4 ASP on capable
cehoyos
parents:
29830
diff
changeset
|
577 vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP; |
f6d56a15f1d8
Support VDPAU hardware accelerated decoding of MPEG-4 ASP on capable
cehoyos
parents:
29830
diff
changeset
|
578 break; |
29827
d6d8b9d5a4fb
Add a default to switch(image_format), suppresses a warning after a future patch.
cehoyos
parents:
29781
diff
changeset
|
579 default: |
d6d8b9d5a4fb
Add a default to switch(image_format), suppresses a warning after a future patch.
cehoyos
parents:
29781
diff
changeset
|
580 goto err_out; |
28989 | 581 } |
582 vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile, | |
29828
fe055da6637c
Fail in query_format() if a VDPAU decoder is not available.
cehoyos
parents:
29827
diff
changeset
|
583 width, height, max_refs, &decoder); |
28989 | 584 CHECK_ST_WARNING("Failed creating VDPAU decoder"); |
585 if (vdp_st != VDP_STATUS_OK) { | |
29827
d6d8b9d5a4fb
Add a default to switch(image_format), suppresses a warning after a future patch.
cehoyos
parents:
29781
diff
changeset
|
586 err_out: |
28989 | 587 decoder = VDP_INVALID_HANDLE; |
588 decoder_max_refs = 0; | |
28991 | 589 return 0; |
28989 | 590 } |
591 decoder_max_refs = max_refs; | |
28991 | 592 return 1; |
28989 | 593 } |
594 | |
29735 | 595 static void mark_vdpau_objects_uninitialized(void) |
596 { | |
597 int i; | |
598 | |
599 decoder = VDP_INVALID_HANDLE; | |
600 for (i = 0; i < MAX_VIDEO_SURFACES; i++) | |
601 surface_render[i].surface = VDP_INVALID_HANDLE; | |
602 for (i = 0; i < 3; i++) { | |
603 deint_surfaces[i] = VDP_INVALID_HANDLE; | |
604 if (i < 2 && deint_mpi[i]) | |
605 deint_mpi[i]->usage_count--; | |
606 deint_mpi[i] = NULL; | |
607 } | |
608 video_mixer = VDP_INVALID_HANDLE; | |
609 vdp_flip_queue = VDP_INVALID_HANDLE; | |
610 vdp_flip_target = VDP_INVALID_HANDLE; | |
611 for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) | |
612 output_surfaces[i] = VDP_INVALID_HANDLE; | |
613 vdp_device = VDP_INVALID_HANDLE; | |
614 for (i = 0; i < eosd_surface_count; i++) | |
615 eosd_surfaces[i].surface = VDP_INVALID_HANDLE; | |
616 output_surface_width = output_surface_height = -1; | |
617 eosd_render_count = 0; | |
618 visible_buf = 0; | |
619 } | |
620 | |
621 static int handle_preemption(void) | |
622 { | |
623 if (!is_preempted) | |
624 return 0; | |
625 is_preempted = 0; | |
626 mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Attempting to recover from preemption.\n"); | |
627 mark_vdpau_objects_uninitialized(); | |
628 if (win_x11_init_vdpau_procs() < 0 || | |
629 win_x11_init_vdpau_flip_queue() < 0 || | |
630 create_vdp_mixer(vdp_chroma_type) < 0) { | |
631 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Recovering from preemption failed\n"); | |
632 is_preempted = 1; | |
633 return -1; | |
634 } | |
635 resize(); | |
636 mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Recovered from display preemption.\n"); | |
637 return 1; | |
638 } | |
639 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
640 /* |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
641 * connect to X server, create and map window, initialize all |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
642 * VDPAU objects, create different surfaces etc. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
643 */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
644 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
|
645 uint32_t d_height, uint32_t flags, char *title, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
646 uint32_t format) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
647 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
648 XVisualInfo vinfo; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
649 XSetWindowAttributes xswa; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
650 XWindowAttributes attribs; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
651 unsigned long xswamask; |
28936
fd9de1e70d47
Move initialisation of deint_surfaces[] to free_video_specific().
cehoyos
parents:
28935
diff
changeset
|
652 int depth; |
28582
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 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
655 int vm = flags & VOFLAG_MODESWITCHING; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
656 #endif |
29752 | 657 flip = flags & VOFLAG_FLIPPING; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
658 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
659 image_format = format; |
29005 | 660 vid_width = width; |
661 vid_height = height; | |
662 free_video_specific(); | |
29828
fe055da6637c
Fail in query_format() if a VDPAU decoder is not available.
cehoyos
parents:
29827
diff
changeset
|
663 if (IMGFMT_IS_VDPAU(image_format) |
fe055da6637c
Fail in query_format() if a VDPAU decoder is not available.
cehoyos
parents:
29827
diff
changeset
|
664 && !create_vdp_decoder(image_format, vid_width, vid_height, 2)) |
29005 | 665 return -1; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
666 |
29713 | 667 int_pause = 0; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
668 visible_buf = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
669 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
670 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
671 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
672 if (vm) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
673 vo_vm_switch(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
674 else |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
675 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
676 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
677 depth = attribs.depth; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
678 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
679 depth = 24; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
680 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
681 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
682 xswa.background_pixel = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
683 xswa.border_pixel = 0; |
29234
6c47111fe28e
Do not use flag CWBackPixel when calling vo_x11_create_vo_window():
cehoyos
parents:
29070
diff
changeset
|
684 /* 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
|
685 aspect ratio changes. */ |
6c47111fe28e
Do not use flag CWBackPixel when calling vo_x11_create_vo_window():
cehoyos
parents:
29070
diff
changeset
|
686 xswamask = CWBorderPixel; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
687 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
688 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
|
689 flags, CopyFromParent, "vdpau", title); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
690 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
691 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
692 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
693 if (vm) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
694 /* Grab the mouse pointer in our window */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
695 if (vo_grabpointer) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
696 XGrabPointer(mDisplay, vo_window, True, 0, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
697 GrabModeAsync, GrabModeAsync, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
698 vo_window, None, CurrentTime); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
699 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
700 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
701 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
702 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
703 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
704 if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
705 vo_fs = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
706 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
707 /* -----VDPAU related code here -------- */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
708 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
|
709 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
710 |
29066
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
711 vdp_chroma_type = VDP_CHROMA_TYPE_420; |
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
712 switch (image_format) { |
29713 | 713 case IMGFMT_YV12: |
714 case IMGFMT_I420: | |
715 case IMGFMT_IYUV: | |
716 vdp_pixel_format = VDP_YCBCR_FORMAT_YV12; | |
717 break; | |
718 case IMGFMT_NV12: | |
719 vdp_pixel_format = VDP_YCBCR_FORMAT_NV12; | |
720 break; | |
721 case IMGFMT_YUY2: | |
722 vdp_pixel_format = VDP_YCBCR_FORMAT_YUYV; | |
723 vdp_chroma_type = VDP_CHROMA_TYPE_422; | |
724 break; | |
725 case IMGFMT_UYVY: | |
726 vdp_pixel_format = VDP_YCBCR_FORMAT_UYVY; | |
727 vdp_chroma_type = VDP_CHROMA_TYPE_422; | |
29066
ab51a502ebb5
Add support for IMGFMT_YUY2 and IMGFMT_UYVY to vo vdpau.
cehoyos
parents:
29065
diff
changeset
|
728 } |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
729 if (create_vdp_mixer(vdp_chroma_type)) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
730 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
731 |
29713 | 732 surface_num = 0; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
733 vid_surface_num = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
734 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
735 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
736 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
737 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
738 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
739 static void check_events(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
740 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
741 int e = vo_x11_check_events(mDisplay); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
742 |
29735 | 743 if (handle_preemption() < 0) |
744 return; | |
745 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
746 if (e & VO_EVENT_RESIZE) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
747 resize(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
748 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
749 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
|
750 /* did we already draw a buffer */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
751 if (visible_buf) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
752 /* redraw the last visible buffer */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
753 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
754 vdp_st = vdp_presentation_queue_display(vdp_flip_queue, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
755 output_surfaces[surface_num], |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
756 vo_dwidth, vo_dheight, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
757 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
758 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
759 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
760 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
761 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
762 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
763 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
|
764 unsigned char *srca, int stride) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
765 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
766 VdpOutputSurface output_surface = output_surfaces[surface_num]; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
767 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
768 int i, j; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
769 int pitch; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
770 int index_data_size_required; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
771 VdpRect output_indexed_rect_vid; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
772 VdpOutputSurfaceRenderBlendState blend_state; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
773 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
774 if (!w || !h) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
775 return; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
776 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
777 index_data_size_required = 2*w*h; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
778 if (index_data_size < index_data_size_required) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
779 index_data = realloc(index_data, index_data_size_required); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
780 index_data_size = index_data_size_required; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
781 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
782 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
783 // index_data creation, component order - I, A, I, A, ..... |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
784 for (i = 0; i < h; i++) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
785 for (j = 0; j < w; j++) { |
29713 | 786 index_data[i*2*w + j*2] = src [i*stride + j]; |
787 index_data[i*2*w + j*2 + 1] = -srca[i*stride + j]; | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
788 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
789 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
790 output_indexed_rect_vid.x0 = x0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
791 output_indexed_rect_vid.y0 = y0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
792 output_indexed_rect_vid.x1 = x0 + w; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
793 output_indexed_rect_vid.y1 = y0 + h; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
794 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
795 pitch = w*2; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
796 |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
797 // write source_data to osd_surface. |
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
798 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
|
799 VDP_INDEXED_FORMAT_I8A8, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
800 (const void *const*)&index_data, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
801 &pitch, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
802 &output_indexed_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
803 VDP_COLOR_TABLE_FORMAT_B8G8R8X8, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
804 (void *)palette); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
805 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
|
806 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
807 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
|
808 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
|
809 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
|
810 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
|
811 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
|
812 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
|
813 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
|
814 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
815 vdp_st = vdp_output_surface_render_output_surface(output_surface, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
816 &output_indexed_rect_vid, |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
817 osd_surface, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
818 &output_indexed_rect_vid, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
819 NULL, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
820 &blend_state, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
821 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
822 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
|
823 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
824 |
29713 | 825 static void draw_eosd(void) |
826 { | |
28675 | 827 VdpStatus vdp_st; |
828 VdpOutputSurface output_surface = output_surfaces[surface_num]; | |
829 VdpOutputSurfaceRenderBlendState blend_state; | |
830 int i; | |
831 | |
832 blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION; | |
833 blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA; | |
834 blend_state.blend_factor_source_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE; | |
835 blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; | |
836 blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA; | |
837 blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; | |
838 blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; | |
839 | |
29713 | 840 for (i = 0; i < eosd_render_count; i++) { |
28675 | 841 vdp_st = vdp_output_surface_render_bitmap_surface( |
842 output_surface, &eosd_targets[i].dest, | |
843 eosd_targets[i].surface, &eosd_targets[i].source, | |
844 &eosd_targets[i].color, &blend_state, | |
845 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); | |
846 CHECK_ST_WARNING("EOSD: Error when rendering") | |
847 } | |
848 } | |
849 | |
29713 | 850 static void generate_eosd(mp_eosd_images_t *imgs) |
851 { | |
28675 | 852 VdpStatus vdp_st; |
853 VdpRect destRect; | |
854 int j, found; | |
855 ass_image_t *img = imgs->imgs; | |
856 ass_image_t *i; | |
857 | |
858 // Nothing changed, no need to redraw | |
859 if (imgs->changed == 0) | |
28807
338065cac802
Remove duplicate OSD drawing introduced due to a conflict between r28840 and r28839.
reimar
parents:
28805
diff
changeset
|
860 return; |
28675 | 861 eosd_render_count = 0; |
862 // There's nothing to render! | |
863 if (!img) | |
864 return; | |
865 | |
866 if (imgs->changed == 1) | |
867 goto eosd_skip_upload; | |
868 | |
29713 | 869 for (j = 0; j < eosd_surface_count; j++) |
28675 | 870 eosd_surfaces[j].in_use = 0; |
871 | |
872 for (i = img; i; i = i->next) { | |
873 // Try to reuse a suitable surface | |
874 found = -1; | |
29713 | 875 for (j = 0; j < eosd_surface_count; j++) { |
28675 | 876 if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE && !eosd_surfaces[j].in_use && |
877 eosd_surfaces[j].w >= i->w && eosd_surfaces[j].h >= i->h) { | |
878 found = j; | |
879 break; | |
880 } | |
881 } | |
882 // None found, allocate a new surface | |
883 if (found < 0) { | |
29713 | 884 for (j = 0; j < eosd_surface_count; j++) { |
28675 | 885 if (!eosd_surfaces[j].in_use) { |
886 if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE) | |
887 vdp_bitmap_surface_destroy(eosd_surfaces[j].surface); | |
888 found = j; | |
889 break; | |
890 } | |
891 } | |
892 // Allocate new space for surface/target arrays | |
893 if (found < 0) { | |
894 j = found = eosd_surface_count; | |
895 eosd_surface_count = eosd_surface_count ? eosd_surface_count*2 : EOSD_SURFACES_INITIAL; | |
896 eosd_surfaces = realloc(eosd_surfaces, eosd_surface_count * sizeof(*eosd_surfaces)); | |
897 eosd_targets = realloc(eosd_targets, eosd_surface_count * sizeof(*eosd_targets)); | |
29713 | 898 for (j = found; j < eosd_surface_count; j++) { |
28675 | 899 eosd_surfaces[j].surface = VDP_INVALID_HANDLE; |
900 eosd_surfaces[j].in_use = 0; | |
901 } | |
902 } | |
903 vdp_st = vdp_bitmap_surface_create(vdp_device, VDP_RGBA_FORMAT_A8, | |
904 i->w, i->h, VDP_TRUE, &eosd_surfaces[found].surface); | |
905 CHECK_ST_WARNING("EOSD: error when creating surface") | |
906 eosd_surfaces[found].w = i->w; | |
907 eosd_surfaces[found].h = i->h; | |
908 } | |
909 eosd_surfaces[found].in_use = 1; | |
910 eosd_targets[eosd_render_count].surface = eosd_surfaces[found].surface; | |
911 destRect.x0 = 0; | |
912 destRect.y0 = 0; | |
913 destRect.x1 = i->w; | |
914 destRect.y1 = i->h; | |
915 vdp_st = vdp_bitmap_surface_putbits_native(eosd_targets[eosd_render_count].surface, | |
916 (const void *) &i->bitmap, &i->stride, &destRect); | |
917 CHECK_ST_WARNING("EOSD: putbits failed") | |
918 eosd_render_count++; | |
919 } | |
920 | |
921 eosd_skip_upload: | |
922 eosd_render_count = 0; | |
923 for (i = img; i; i = i->next) { | |
924 // Render dest, color, etc. | |
29713 | 925 eosd_targets[eosd_render_count].color.alpha = 1.0 - ((i->color >> 0) & 0xff) / 255.0; |
926 eosd_targets[eosd_render_count].color.blue = ((i->color >> 8) & 0xff) / 255.0; | |
927 eosd_targets[eosd_render_count].color.green = ((i->color >> 16) & 0xff) / 255.0; | |
928 eosd_targets[eosd_render_count].color.red = ((i->color >> 24) & 0xff) / 255.0; | |
929 eosd_targets[eosd_render_count].dest.x0 = i->dst_x; | |
930 eosd_targets[eosd_render_count].dest.y0 = i->dst_y; | |
931 eosd_targets[eosd_render_count].dest.x1 = i->w + i->dst_x; | |
932 eosd_targets[eosd_render_count].dest.y1 = i->h + i->dst_y; | |
933 eosd_targets[eosd_render_count].source.x0 = 0; | |
934 eosd_targets[eosd_render_count].source.y0 = 0; | |
935 eosd_targets[eosd_render_count].source.x1 = i->w; | |
936 eosd_targets[eosd_render_count].source.y1 = i->h; | |
28675 | 937 eosd_render_count++; |
938 } | |
939 } | |
940 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
941 static void draw_osd(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
942 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
943 mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
944 |
29735 | 945 if (handle_preemption() < 0) |
946 return; | |
947 | |
28598
4172d83194f2
Extend calc_src_dst_rects to also calculate the border values needed for
reimar
parents:
28582
diff
changeset
|
948 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
|
949 vid_width, vid_height, draw_osd_I8A8); |
28582
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 void flip_page(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
953 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
954 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
955 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
|
956 surface_render[vid_surface_num].surface, output_surfaces[surface_num]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
957 |
29735 | 958 if (handle_preemption() < 0) |
959 return; | |
960 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
961 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
|
962 vo_dwidth, vo_dheight, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
963 0); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
964 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
965 |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
966 surface_num = (surface_num + 1) % NUM_OUTPUT_SURFACES; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
967 visible_buf = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
968 } |
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 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
|
971 int x, int y) |
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 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
974 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
|
975 int max_refs = image_format == IMGFMT_VDPAU_H264 ? rndr->info.h264.num_ref_frames : 2; |
29735 | 976 |
977 if (handle_preemption() < 0) | |
978 return VO_TRUE; | |
979 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
980 if (!IMGFMT_IS_VDPAU(image_format)) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
981 return VO_FALSE; |
28989 | 982 if ((decoder == VDP_INVALID_HANDLE || decoder_max_refs < max_refs) |
29828
fe055da6637c
Fail in query_format() if a VDPAU decoder is not available.
cehoyos
parents:
29827
diff
changeset
|
983 && !create_vdp_decoder(image_format, vid_width, vid_height, max_refs)) |
28989 | 984 return VO_FALSE; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29234
diff
changeset
|
985 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
986 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
|
987 CHECK_ST_WARNING("Failed VDPAU decoder rendering"); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
988 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
989 } |
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 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
992 static int draw_frame(uint8_t *src[]) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
993 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
994 return VO_ERROR; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
995 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
996 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
997 static struct vdpau_render_state *get_surface(int number) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
998 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
999 if (number > MAX_VIDEO_SURFACES) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1000 return NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1001 if (surface_render[number].surface == VDP_INVALID_HANDLE) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1002 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1003 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
|
1004 vid_width, vid_height, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1005 &surface_render[number].surface); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1006 CHECK_ST_WARNING("Error when calling vdp_video_surface_create") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1007 if (vdp_st != VDP_STATUS_OK) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1008 return NULL; |
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 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
|
1011 return &surface_render[number]; |
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 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1014 static uint32_t draw_image(mp_image_t *mpi) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1015 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1016 if (IMGFMT_IS_VDPAU(image_format)) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1017 struct vdpau_render_state *rndr = mpi->priv; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1018 vid_surface_num = rndr - surface_render; |
30009 | 1019 mpi->usage_count++; |
1020 if (deint_mpi[1]) | |
1021 deint_mpi[1]->usage_count--; | |
1022 deint_mpi[1] = deint_mpi[0]; | |
1023 deint_mpi[0] = mpi; | |
29756 | 1024 } else if (image_format == IMGFMT_BGRA) { |
1025 VdpStatus vdp_st; | |
1026 VdpRect r = {0, 0, vid_width, vid_height}; | |
1027 vdp_st = vdp_output_surface_put_bits_native(output_surfaces[2], | |
1028 (void const*const*)mpi->planes, | |
1029 mpi->stride, &r); | |
1030 CHECK_ST_ERROR("Error when calling vdp_output_surface_put_bits_native") | |
1031 vdp_st = vdp_output_surface_render_output_surface(output_surfaces[surface_num], | |
1032 &out_rect_vid, | |
1033 output_surfaces[2], | |
1034 &src_rect_vid, NULL, NULL, | |
1035 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); | |
1036 CHECK_ST_ERROR("Error when calling vdp_output_surface_render_output_surface") | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1037 } else if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1038 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1039 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
|
1040 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
|
1041 deint_counter = (deint_counter + 1) % 3; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1042 vid_surface_num = rndr - surface_render; |
29070 | 1043 if (image_format == IMGFMT_NV12) |
1044 destdata[1] = destdata[2]; | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1045 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
|
1046 vdp_pixel_format, |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1047 (const void *const*)destdata, |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1048 mpi->stride); // pitch |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1049 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
|
1050 } |
29054
d865fa57c316
10l: Don't use MP_IMGFIELD_TOP_FIRST if MP_IMGFIELD_ORDERED is not set.
cehoyos
parents:
29026
diff
changeset
|
1051 if (mpi->fields & MP_IMGFIELD_ORDERED) |
29055 | 1052 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
|
1053 else |
d865fa57c316
10l: Don't use MP_IMGFIELD_TOP_FIRST if MP_IMGFIELD_ORDERED is not set.
cehoyos
parents:
29026
diff
changeset
|
1054 top_field_first = 1; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1055 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1056 video_to_output_surface(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1057 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1058 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1059 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1060 static uint32_t get_image(mp_image_t *mpi) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1061 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1062 struct vdpau_render_state *rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1063 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1064 // no dr for non-decoding for now |
29716 | 1065 if (!IMGFMT_IS_VDPAU(image_format)) |
1066 return VO_FALSE; | |
1067 if (mpi->type != MP_IMGTYPE_NUMBERED) | |
1068 return VO_FALSE; | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1069 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1070 rndr = get_surface(mpi->number); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1071 if (!rndr) { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1072 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
|
1073 // TODO: this probably breaks things forever, provide a dummy buffer? |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1074 return VO_FALSE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1075 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1076 mpi->flags |= MP_IMGFLAG_DIRECT; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1077 mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1078 mpi->planes[0] = mpi->planes[1] = mpi->planes[2] = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1079 // 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
|
1080 mpi->planes[0] = (void *)rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1081 mpi->num_planes = 1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1082 mpi->priv = rndr; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1083 return VO_TRUE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1084 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1085 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1086 static int query_format(uint32_t format) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1087 { |
29752 | 1088 int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_EOSD | VFCAP_EOSD_UNSCALED | VFCAP_FLIP; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1089 switch (format) { |
29756 | 1090 case IMGFMT_BGRA: |
1091 if (force_mixer) | |
1092 return 0; | |
29713 | 1093 case IMGFMT_YV12: |
1094 case IMGFMT_I420: | |
1095 case IMGFMT_IYUV: | |
1096 case IMGFMT_NV12: | |
1097 case IMGFMT_YUY2: | |
1098 case IMGFMT_UYVY: | |
1099 return default_flags | VOCAP_NOSLICES; | |
1100 case IMGFMT_VDPAU_MPEG1: | |
1101 case IMGFMT_VDPAU_MPEG2: | |
1102 case IMGFMT_VDPAU_H264: | |
1103 case IMGFMT_VDPAU_WMV3: | |
1104 case IMGFMT_VDPAU_VC1: | |
29843
f6d56a15f1d8
Support VDPAU hardware accelerated decoding of MPEG-4 ASP on capable
cehoyos
parents:
29830
diff
changeset
|
1105 case IMGFMT_VDPAU_MPEG4: |
29830
9fcc27d1fe1f
100: Fix function parameters when calling create_vdp_decoder() from query_format().
cehoyos
parents:
29829
diff
changeset
|
1106 if (create_vdp_decoder(format, 48, 48, 2)) |
29829 | 1107 return default_flags; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1108 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1109 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1110 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1111 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1112 static void DestroyVdpauObjects(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1113 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1114 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1115 VdpStatus vdp_st; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1116 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1117 free_video_specific(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1118 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1119 vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1120 CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1121 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1122 vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1123 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
|
1124 |
28696
fdc03572004c
Change code to actually work when NUM_OUTPUT_SURFACES is changed.
reimar
parents:
28689
diff
changeset
|
1125 for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) { |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1126 vdp_st = vdp_output_surface_destroy(output_surfaces[i]); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1127 output_surfaces[i] = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1128 CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1129 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1130 |
28675 | 1131 for (i = 0; i<eosd_surface_count; i++) { |
1132 if (eosd_surfaces[i].surface != VDP_INVALID_HANDLE) { | |
1133 vdp_st = vdp_bitmap_surface_destroy(eosd_surfaces[i].surface); | |
1134 CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy") | |
1135 } | |
1136 eosd_surfaces[i].surface = VDP_INVALID_HANDLE; | |
1137 } | |
1138 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1139 vdp_st = vdp_device_destroy(vdp_device); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1140 CHECK_ST_WARNING("Error when calling vdp_device_destroy") |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1141 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1142 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1143 static void uninit(void) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1144 { |
29751
593354e0500d
Free memory allocated in ff_vdpau_add_data_chunk() on uninit.
cehoyos
parents:
29735
diff
changeset
|
1145 int i; |
593354e0500d
Free memory allocated in ff_vdpau_add_data_chunk() on uninit.
cehoyos
parents:
29735
diff
changeset
|
1146 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1147 if (!vo_config_count) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1148 return; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1149 visible_buf = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1150 |
29751
593354e0500d
Free memory allocated in ff_vdpau_add_data_chunk() on uninit.
cehoyos
parents:
29735
diff
changeset
|
1151 for (i = 0; i < MAX_VIDEO_SURFACES; i++) { |
593354e0500d
Free memory allocated in ff_vdpau_add_data_chunk() on uninit.
cehoyos
parents:
29735
diff
changeset
|
1152 // Allocated in ff_vdpau_add_data_chunk() |
593354e0500d
Free memory allocated in ff_vdpau_add_data_chunk() on uninit.
cehoyos
parents:
29735
diff
changeset
|
1153 av_freep(&surface_render[i].bitstream_buffers); |
593354e0500d
Free memory allocated in ff_vdpau_add_data_chunk() on uninit.
cehoyos
parents:
29735
diff
changeset
|
1154 surface_render[i].bitstream_buffers_allocated = 0; |
593354e0500d
Free memory allocated in ff_vdpau_add_data_chunk() on uninit.
cehoyos
parents:
29735
diff
changeset
|
1155 } |
593354e0500d
Free memory allocated in ff_vdpau_add_data_chunk() on uninit.
cehoyos
parents:
29735
diff
changeset
|
1156 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1157 /* Destroy all vdpau objects */ |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1158 DestroyVdpauObjects(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1159 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1160 free(index_data); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1161 index_data = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1162 |
28675 | 1163 free(eosd_surfaces); |
1164 eosd_surfaces = NULL; | |
1165 free(eosd_targets); | |
1166 eosd_targets = NULL; | |
1167 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1168 #ifdef CONFIG_XF86VM |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1169 vo_vm_close(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1170 #endif |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1171 vo_x11_uninit(); |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1172 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1173 |
28828
56eee6ffba9b
Make data related to suboption parsing const in libvo
reimar
parents:
28807
diff
changeset
|
1174 static const opt_t subopts[] = { |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1175 {"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
|
1176 {"chroma-deint", OPT_ARG_BOOL, &chroma_deint, NULL}, |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1177 {"pullup", OPT_ARG_BOOL, &pullup, NULL}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1178 {"denoise", OPT_ARG_FLOAT, &denoise, NULL}, |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1179 {"sharpen", OPT_ARG_FLOAT, &sharpen, NULL}, |
29727 | 1180 {"colorspace", OPT_ARG_INT, &colorspace, NULL}, |
29756 | 1181 {"force-mixer", OPT_ARG_BOOL, &force_mixer, NULL}, |
29781
508417d485d6
Add new VDPAU feature high-quality-scaling (and require newer library).
cehoyos
parents:
29757
diff
changeset
|
1182 {"hqscaling", OPT_ARG_INT, &hqscaling, (opt_test_f)int_non_neg}, |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1183 {NULL} |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1184 }; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1185 |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1186 static const char help_msg[] = |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1187 "\n-vo vdpau command line help:\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1188 "Example: mplayer -vo vdpau:deint=2\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1189 "\nOptions:\n" |
28707
a81065b771e7
Document that all vdpau deinterlacers respect -field-dominance.
cehoyos
parents:
28702
diff
changeset
|
1190 " deint (all modes > 0 respect -field-dominance)\n" |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1191 " 0: no deinterlacing\n" |
28708 | 1192 " 1: only show first field\n" |
28956
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
1193 " 2: bob deinterlacing\n" |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
1194 " 3: temporal deinterlacing (resource-hungry)\n" |
6d0da4fd4544
Allow to use vdpau temporal deinterlacers with hardware accelerated decoding.
cehoyos
parents:
28944
diff
changeset
|
1195 " 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
|
1196 " chroma-deint\n" |
cb18135338dd
Add chroma-deint option to vo vdpau (nochroma-deint speeds up deinterlacing).
cehoyos
parents:
28936
diff
changeset
|
1197 " 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
|
1198 " 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
|
1199 " pullup\n" |
30758
33765d7d6e0a
Documentation: Add linebreak and try to be less ambiguous.
cehoyos
parents:
30462
diff
changeset
|
1200 " Try to skip deinterlacing for progressive frames\n" |
33765d7d6e0a
Documentation: Add linebreak and try to be less ambiguous.
cehoyos
parents:
30462
diff
changeset
|
1201 " (needs at least temporal deinterlacing, useful for telecined content)\n" |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1202 " denoise\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1203 " 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
|
1204 " sharpen\n" |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1205 " Apply sharpening or softening, argument is strength from -1.0 to 1.0\n" |
29727 | 1206 " colorspace\n" |
1207 " 0: guess based on video resolution\n" | |
1208 " 1: ITU-R BT.601 (default)\n" | |
1209 " 2: ITU-R BT.709\n" | |
29729 | 1210 " 3: SMPTE-240M\n" |
29781
508417d485d6
Add new VDPAU feature high-quality-scaling (and require newer library).
cehoyos
parents:
29757
diff
changeset
|
1211 " hqscaling\n" |
508417d485d6
Add new VDPAU feature high-quality-scaling (and require newer library).
cehoyos
parents:
29757
diff
changeset
|
1212 " 0: default VDPAU scaler\n" |
508417d485d6
Add new VDPAU feature high-quality-scaling (and require newer library).
cehoyos
parents:
29757
diff
changeset
|
1213 " 1-9: high quality VDPAU scaler (needs capable hardware)\n" |
29756 | 1214 " force-mixer\n" |
1215 " Use the VDPAU mixer (default)\n" | |
1216 " Use noforce-mixer to allow BGRA output (disables all above options)\n" | |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1217 ; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1218 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1219 static int preinit(const char *arg) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1220 { |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1221 int i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1222 |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1223 deint = 0; |
28709
4e89476f8952
Do not forget the chosen deinterlacer for -vo vdpau.
cehoyos
parents:
28708
diff
changeset
|
1224 deint_type = 3; |
28933
b0badbd680c6
Initial support for advanced VDPAU deinterlacers (software-decoded video
cehoyos
parents:
28892
diff
changeset
|
1225 deint_counter = 0; |
29017
c9a2d95c580a
New vdpau deinterlacing code needs one reference surface less.
cehoyos
parents:
29016
diff
changeset
|
1226 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
|
1227 chroma_deint = 1; |
29713 | 1228 pullup = 0; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1229 denoise = 0; |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1230 sharpen = 0; |
29727 | 1231 colorspace = 1; |
29756 | 1232 force_mixer = 1; |
29781
508417d485d6
Add new VDPAU feature high-quality-scaling (and require newer library).
cehoyos
parents:
29757
diff
changeset
|
1233 hqscaling = 0; |
28638
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1234 if (subopt_parse(arg, subopts) != 0) { |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1235 mp_msg(MSGT_VO, MSGL_FATAL, help_msg); |
7b16ccf423b4
Add support for VDPAU deinterlacing, pullup, denoise and sharpening.
reimar
parents:
28611
diff
changeset
|
1236 return -1; |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1237 } |
28709
4e89476f8952
Do not forget the chosen deinterlacer for -vo vdpau.
cehoyos
parents:
28708
diff
changeset
|
1238 if (deint) |
4e89476f8952
Do not forget the chosen deinterlacer for -vo vdpau.
cehoyos
parents:
28708
diff
changeset
|
1239 deint_type = deint; |
29729 | 1240 if (colorspace < 0 || colorspace > 3) { |
29727 | 1241 mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] Invalid color space specified, " |
1242 "using BT.601\n"); | |
1243 colorspace = 1; | |
1244 } | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1245 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1246 if (!vo_init() || win_x11_init_vdpau_procs()) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1247 return -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1248 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1249 decoder = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1250 for (i = 0; i < MAX_VIDEO_SURFACES; i++) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1251 surface_render[i].surface = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1252 video_mixer = VDP_INVALID_HANDLE; |
28774
95123b577ad0
Make sure all output_surfaces are initialized in preinit.
reimar
parents:
28729
diff
changeset
|
1253 for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1254 output_surfaces[i] = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1255 vdp_flip_queue = VDP_INVALID_HANDLE; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1256 output_surface_width = output_surface_height = -1; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1257 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1258 // full grayscale palette. |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1259 for (i = 0; i < PALETTE_SIZE; ++i) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1260 palette[i] = (i << 16) | (i << 8) | i; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1261 index_data = NULL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1262 index_data_size = 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1263 |
28675 | 1264 eosd_surface_count = eosd_render_count = 0; |
1265 eosd_surfaces = NULL; | |
1266 eosd_targets = NULL; | |
1267 | |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1268 procamp.struct_version = VDP_PROCAMP_VERSION; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1269 procamp.brightness = 0.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1270 procamp.contrast = 1.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1271 procamp.saturation = 1.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1272 procamp.hue = 0.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1273 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1274 return 0; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1275 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1276 |
29713 | 1277 static int get_equalizer(char *name, int *value) |
1278 { | |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1279 if (!strcasecmp(name, "brightness")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1280 *value = procamp.brightness * 100; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1281 else if (!strcasecmp(name, "contrast")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1282 *value = (procamp.contrast-1.0) * 100; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1283 else if (!strcasecmp(name, "saturation")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1284 *value = (procamp.saturation-1.0) * 100; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1285 else if (!strcasecmp(name, "hue")) |
28729 | 1286 *value = procamp.hue * 100 / M_PI; |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1287 else |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1288 return VO_NOTIMPL; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1289 return VO_TRUE; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1290 } |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1291 |
29713 | 1292 static int set_equalizer(char *name, int value) |
1293 { | |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1294 if (!strcasecmp(name, "brightness")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1295 procamp.brightness = value / 100.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1296 else if (!strcasecmp(name, "contrast")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1297 procamp.contrast = value / 100.0 + 1.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1298 else if (!strcasecmp(name, "saturation")) |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1299 procamp.saturation = value / 100.0 + 1.0; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1300 else if (!strcasecmp(name, "hue")) |
28729 | 1301 procamp.hue = value / 100.0 * M_PI; |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1302 else |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1303 return VO_NOTIMPL; |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1304 |
29727 | 1305 return update_csc_matrix(); |
28725
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1306 } |
b9c26620ada7
Support brightness, contrast, hue and saturation adjustments via
cehoyos
parents:
28724
diff
changeset
|
1307 |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1308 static int control(uint32_t request, void *data, ...) |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1309 { |
29735 | 1310 if (handle_preemption() < 0) |
1311 return VO_FALSE; | |
1312 | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1313 switch (request) { |
29713 | 1314 case VOCTRL_GET_DEINTERLACE: |
1315 *(int*)data = deint; | |
1316 return VO_TRUE; | |
1317 case VOCTRL_SET_DEINTERLACE: | |
29756 | 1318 if (image_format == IMGFMT_BGRA) |
1319 return VO_NOTIMPL; | |
29713 | 1320 deint = *(int*)data; |
1321 if (deint) | |
1322 deint = deint_type; | |
1323 if (deint_type > 2) { | |
1324 VdpStatus vdp_st; | |
1325 VdpVideoMixerFeature features[1] = | |
1326 {deint_type == 3 ? | |
1327 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL : | |
1328 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL}; | |
1329 VdpBool feature_enables[1] = {deint ? VDP_TRUE : VDP_FALSE}; | |
1330 vdp_st = vdp_video_mixer_set_feature_enables(video_mixer, 1, | |
1331 features, | |
1332 feature_enables); | |
1333 CHECK_ST_WARNING("Error changing deinterlacing settings") | |
1334 } | |
1335 return VO_TRUE; | |
1336 case VOCTRL_PAUSE: | |
29717
afc8b80eb027
cosmetics: Remove some pointless parentheses from return calls.
diego
parents:
29716
diff
changeset
|
1337 return int_pause = 1; |
29713 | 1338 case VOCTRL_RESUME: |
29717
afc8b80eb027
cosmetics: Remove some pointless parentheses from return calls.
diego
parents:
29716
diff
changeset
|
1339 return int_pause = 0; |
29713 | 1340 case VOCTRL_QUERY_FORMAT: |
1341 return query_format(*(uint32_t *)data); | |
1342 case VOCTRL_GET_IMAGE: | |
1343 return get_image(data); | |
1344 case VOCTRL_DRAW_IMAGE: | |
1345 return draw_image(data); | |
1346 case VOCTRL_GUISUPPORT: | |
1347 return VO_TRUE; | |
1348 case VOCTRL_BORDER: | |
1349 vo_x11_border(); | |
1350 resize(); | |
1351 return VO_TRUE; | |
1352 case VOCTRL_FULLSCREEN: | |
1353 vo_x11_fullscreen(); | |
1354 resize(); | |
1355 return VO_TRUE; | |
1356 case VOCTRL_GET_PANSCAN: | |
1357 return VO_TRUE; | |
1358 case VOCTRL_SET_PANSCAN: | |
1359 resize(); | |
1360 return VO_TRUE; | |
1361 case VOCTRL_SET_EQUALIZER: { | |
1362 va_list ap; | |
1363 int value; | |
29756 | 1364 if (image_format == IMGFMT_BGRA) |
1365 return VO_NOTIMPL; | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1366 |
29713 | 1367 va_start(ap, data); |
1368 value = va_arg(ap, int); | |
1369 | |
1370 va_end(ap); | |
1371 return set_equalizer(data, value); | |
1372 } | |
1373 case VOCTRL_GET_EQUALIZER: { | |
1374 va_list ap; | |
1375 int *value; | |
1376 | |
1377 va_start(ap, data); | |
1378 value = va_arg(ap, int *); | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1379 |
29713 | 1380 va_end(ap); |
1381 return get_equalizer(data, value); | |
1382 } | |
1383 case VOCTRL_ONTOP: | |
1384 vo_x11_ontop(); | |
1385 return VO_TRUE; | |
1386 case VOCTRL_UPDATE_SCREENINFO: | |
1387 update_xinerama_info(); | |
1388 return VO_TRUE; | |
1389 case VOCTRL_DRAW_EOSD: | |
1390 if (!data) | |
1391 return VO_FALSE; | |
1392 generate_eosd(data); | |
1393 draw_eosd(); | |
1394 return VO_TRUE; | |
1395 case VOCTRL_GET_EOSD_RES: { | |
1396 mp_eosd_res_t *r = data; | |
1397 r->mt = r->mb = r->ml = r->mr = 0; | |
30065
d5d20b8256b7
Some ugly hacks to make compiling against a newer external version of libass work.
reimar
parents:
30063
diff
changeset
|
1398 r->srcw = vid_width; r->srch = vid_height; |
29713 | 1399 if (vo_fs) { |
1400 r->w = vo_screenwidth; | |
1401 r->h = vo_screenheight; | |
1402 r->ml = r->mr = border_x; | |
1403 r->mt = r->mb = border_y; | |
1404 } else { | |
1405 r->w = vo_dwidth; | |
1406 r->h = vo_dheight; | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1407 } |
29713 | 1408 return VO_TRUE; |
1409 } | |
28582
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1410 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1411 return VO_NOTIMPL; |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1412 } |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1413 |
4d64f83e2fac
Add support for VDPAU video out, including hardware decoding.
reimar
parents:
diff
changeset
|
1414 /* @} */ |