Mercurial > mplayer.hg
annotate libvo/vo_dxr2.c @ 29924:747433f6dc07
map 0x20736D to ffac3, fixes broken mov sample
author | compn |
---|---|
date | Thu, 26 Nov 2009 18:00:45 +0000 |
parents | 0f1b5b68af32 |
children | 76a13038105e |
rev | line source |
---|---|
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
1 /* |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
2 * This file is part of MPlayer. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
3 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
7 * (at your option) any later version. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
8 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
12 * GNU General Public License for more details. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
13 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27750
diff
changeset
|
17 */ |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
18 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
19 #include "fastmemcpy.h" |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
20 #include <stdio.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
21 #include <stdlib.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
22 #include <string.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
23 #include <unistd.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
24 #include <sys/ioctl.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
25 #include <sys/stat.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
26 #include <sys/types.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
27 #include <fcntl.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
28 #include <stdio.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
29 #include <time.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
30 #include <errno.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
31 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
32 #include "config.h" |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
33 #include "video_out.h" |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
34 #include "video_out_internal.h" |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
35 #include "mp_msg.h" |
10594
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
8148
diff
changeset
|
36 #include "m_option.h" |
7970 | 37 #include "sub.h" |
24242
76f5d8892c04
Clean up the way get_path is handled: Compile get_path.c to an object to link
diego
parents:
23457
diff
changeset
|
38 #include "get_path.h" |
19151 | 39 #include "libmpdemux/mpeg_packetizer.h" |
6181 | 40 #include "x11_common.h" |
41 | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
42 #include <dxr2ioctl.h> |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
43 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
44 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
45 extern float monitor_aspect; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
46 extern float movie_aspect; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
47 |
6074
10a30eebafaf
Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents:
6070
diff
changeset
|
48 int dxr2_fd = -1; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
49 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
50 static int movie_w,movie_h; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
51 static int playing = 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
52 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
53 // vo device used to blank the screen for the overlay init |
25219
e82ecde2cbd4
Mark several uses of vo_functions_t as const to stop some of the current
reimar
parents:
25216
diff
changeset
|
54 static const vo_functions_t* sub_vo = NULL; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
55 |
6181 | 56 static uint8_t* sub_img = NULL; |
57 static int sub_x,sub_y,sub_w,sub_h; | |
58 static int sub_x_off,sub_y_off; | |
59 static int sub_config_count; | |
60 static int aspect; | |
7970 | 61 static int sub_vo_win = 0; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
62 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
63 static int use_ol = 1; |
6181 | 64 static int ol_ratio = 1000; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
65 static char *norm = NULL; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
66 static char *ucode = NULL; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
67 static int ar_mode = DXR2_ASPECTRATIOMODE_LETTERBOX; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
68 static int mv_mode = DXR2_MACROVISION_OFF; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
69 static int _75ire_mode = DXR2_75IRE_OFF; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
70 static int bw_mode = DXR2_BLACKWHITE_OFF; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
71 static int interlaced_mode = DXR2_INTERLACED_ON; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
72 static int pixel_mode = DXR2_PIXEL_CCIR601; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
73 static int iec958_mode = DXR2_IEC958_DECODED; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
74 static int mute_mode = DXR2_AUDIO_MUTE_OFF; |
6181 | 75 static int ignore_cache = 0; |
76 static int update_cache = 0; | |
7970 | 77 static int olw_cor = 0, olh_cor = 0,olx_cor = 0, oly_cor = 0; |
78 static int ol_osd = 0; | |
7981 | 79 static int ck_rmin = 0x40; |
80 static int ck_rmax = 0xFF; | |
81 static int ck_r = 0xFF; | |
82 static int ck_gmin = 0x00; | |
83 static int ck_gmax = 0x20; | |
84 static int ck_g = 0; | |
85 static int ck_bmin = 0x40; | |
86 static int ck_bmax = 0xFF; | |
87 static int ck_b = 0xFF; | |
8063
4c7ef4aeb88b
Overlay cropping options. Patch by Mark <CompGuy284 at attbi dot com> extanded
albeu
parents:
7981
diff
changeset
|
88 static int cr_left = 0, cr_right = 0; |
4c7ef4aeb88b
Overlay cropping options. Patch by Mark <CompGuy284 at attbi dot com> extanded
albeu
parents:
7981
diff
changeset
|
89 static int cr_top = 55, cr_bot = 300; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
90 |
10594
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
8148
diff
changeset
|
91 m_option_t dxr2_opts[] = { |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
92 { "overlay", &use_ol, CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
93 { "nooverlay", &use_ol, CONF_TYPE_FLAG, 0, 1, 0, NULL}, |
6181 | 94 { "overlay-ratio", &ol_ratio, CONF_TYPE_INT, CONF_RANGE, 1, 2500, NULL }, |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
95 { "ucode", &ucode, CONF_TYPE_STRING,0, 0, 0, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
96 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
97 { "norm", &norm, CONF_TYPE_STRING,0, 0, 0, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
98 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
99 { "ar-mode",&ar_mode, CONF_TYPE_INT, CONF_RANGE,0,2,NULL }, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
100 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
101 { "macrovision",&mv_mode,CONF_TYPE_INT,CONF_RANGE,0,3, NULL }, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
102 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
103 { "75ire",&_75ire_mode,CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
104 { "no75ire",&_75ire_mode,CONF_TYPE_FLAG, 0, 1, 0, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
105 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
106 { "bw",&bw_mode,CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
107 { "color",&bw_mode,CONF_TYPE_FLAG, 0, 1, 0, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
108 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
109 { "interlaced",&interlaced_mode,CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
110 { "nointerlaced",&interlaced_mode,CONF_TYPE_FLAG, 0, 1, 0, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
111 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
112 { "square-pixel",&pixel_mode,CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
113 { "ccir601-pixel",&pixel_mode,CONF_TYPE_FLAG, 0, 1, 0, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
114 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
115 { "iec958-encoded",&iec958_mode,CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
116 { "iec958-decoded",&iec958_mode,CONF_TYPE_FLAG, 0, 1, 0, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
117 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
118 { "mute", &mute_mode,CONF_TYPE_FLAG, 0, 1, 0, NULL}, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
119 { "nomute",&mute_mode,CONF_TYPE_FLAG, 0, 0, 1, NULL}, |
6181 | 120 |
121 { "ignore-cache",&ignore_cache,CONF_TYPE_FLAG, 0, 0, 1, NULL}, | |
122 { "update-cache",&update_cache,CONF_TYPE_FLAG, 0, 0, 1, NULL}, | |
7970 | 123 |
124 { "olh-cor", &olh_cor, CONF_TYPE_INT, CONF_RANGE, -20, 20, NULL}, | |
125 { "olw-cor", &olw_cor, CONF_TYPE_INT, CONF_RANGE, -20, 20, NULL}, | |
126 { "olx-cor", &olx_cor, CONF_TYPE_INT, CONF_RANGE, -20, 20, NULL}, | |
127 { "oly-cor", &oly_cor, CONF_TYPE_INT, CONF_RANGE, -20, 20, NULL}, | |
128 | |
129 { "ol-osd", &ol_osd, CONF_TYPE_FLAG, 0, 0, 1, NULL}, | |
130 { "nool-osd", &ol_osd, CONF_TYPE_FLAG, 0, 1, 0, NULL}, | |
7981 | 131 |
132 { "ck-rmin", &ck_rmin, CONF_TYPE_INT, CONF_RANGE, 0, 0xFF, NULL}, | |
133 { "ck-rmax", &ck_rmax, CONF_TYPE_INT, CONF_RANGE, 0, 0xFF, NULL}, | |
134 { "ck-r", &ck_r, CONF_TYPE_INT, CONF_RANGE, 0, 0xFF, NULL}, | |
135 { "ck-gmin", &ck_gmin, CONF_TYPE_INT, CONF_RANGE, 0, 0xFF, NULL}, | |
136 { "ck-gmax", &ck_gmax, CONF_TYPE_INT, CONF_RANGE, 0, 0xFF, NULL}, | |
137 { "ck-g", &ck_g, CONF_TYPE_INT, CONF_RANGE, 0, 0xFF, NULL}, | |
138 { "ck-bmin", &ck_bmin, CONF_TYPE_INT, CONF_RANGE, 0, 0xFF, NULL}, | |
139 { "ck-bmax", &ck_bmax, CONF_TYPE_INT, CONF_RANGE, 0, 0xFF, NULL}, | |
140 { "ck-b", &ck_b, CONF_TYPE_INT, CONF_RANGE, 0, 0xFF, NULL}, | |
8063
4c7ef4aeb88b
Overlay cropping options. Patch by Mark <CompGuy284 at attbi dot com> extanded
albeu
parents:
7981
diff
changeset
|
141 { "cr-left", &cr_left, CONF_TYPE_INT, CONF_RANGE, 0, 500, NULL}, |
4c7ef4aeb88b
Overlay cropping options. Patch by Mark <CompGuy284 at attbi dot com> extanded
albeu
parents:
7981
diff
changeset
|
142 { "cr-right", &cr_right, CONF_TYPE_INT, CONF_RANGE, 0, 500, NULL}, |
4c7ef4aeb88b
Overlay cropping options. Patch by Mark <CompGuy284 at attbi dot com> extanded
albeu
parents:
7981
diff
changeset
|
143 { "cr-top", &cr_top, CONF_TYPE_INT, CONF_RANGE, 0, 500, NULL}, |
4c7ef4aeb88b
Overlay cropping options. Patch by Mark <CompGuy284 at attbi dot com> extanded
albeu
parents:
7981
diff
changeset
|
144 { "cr-bot", &cr_bot, CONF_TYPE_INT, CONF_RANGE, 0, 500, NULL}, |
7981 | 145 |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
146 { NULL,NULL, 0, 0, 0, 0, NULL} |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
147 }; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
148 |
25216 | 149 static const vo_info_t info = { |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
150 "DXR2 video out", |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
151 "dxr2", |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
152 "Alban Bedel <albeu@free.fr> and Tobias Diedrich <ranma@gmx.at>", |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
153 "" |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
154 }; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
155 |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25219
diff
changeset
|
156 const LIBVO_EXTERN (dxr2) |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8115
diff
changeset
|
157 |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
158 static char *ucodesearchpath[] = { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
159 "/usr/local/lib/dxr2/dvd12.ux", |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
160 "/usr/lib/dxr2/dvd12.ux", |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
161 "/usr/src/dvd12.ux", |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
162 NULL, |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
163 }; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
164 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
165 #define BUF_SIZE 2048 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
166 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
167 static unsigned char dxr2buf[BUF_SIZE]; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
168 static unsigned int dxr2bufpos = 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
169 |
25673
d576b679747b
Write functions used by send_mpeg_*_packet may _not_ modify data
reimar
parents:
25220
diff
changeset
|
170 int write_dxr2(const unsigned char *data, int len) |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
171 { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
172 int w = 0; |
19151 | 173 |
174 if (dxr2_fd < 0) | |
175 { | |
176 mp_msg (MSGT_VO, MSGL_ERR, "DXR2 fd is not valid\n"); | |
177 return 0; | |
178 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
179 |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
180 while (len>0) if ((dxr2bufpos+len) <= BUF_SIZE) { |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
19164
diff
changeset
|
181 fast_memcpy(dxr2buf+dxr2bufpos, data, len); |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
182 dxr2bufpos+=len; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
183 len=0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
184 } else { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
185 int copylen=BUF_SIZE-dxr2bufpos; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
186 if(copylen > 0) { |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
19164
diff
changeset
|
187 fast_memcpy(dxr2buf+dxr2bufpos, data, copylen); |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
188 dxr2bufpos += copylen; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
189 data+=copylen; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
190 len-=copylen; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
191 } |
19151 | 192 w += write(dxr2_fd, dxr2buf, BUF_SIZE); |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
193 if(w < 0) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
194 mp_msg(MSGT_VO,MSGL_WARN,"DXR2 : write failed : %s \n",strerror(errno)); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
195 dxr2bufpos = 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
196 break; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
197 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
198 dxr2bufpos -= w; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
199 if(dxr2bufpos) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
200 memmove(dxr2buf,dxr2buf + w,dxr2bufpos); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
201 } |
19151 | 202 |
203 return w; | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
204 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
205 |
29212
eda346733b8c
Add missing 'void' to parameterless function declarations.
diego
parents:
28446
diff
changeset
|
206 static void flush_dxr2(void) |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
207 { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
208 int w; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
209 while (dxr2bufpos) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
210 w = write(dxr2_fd, dxr2buf, dxr2bufpos); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
211 if(w < 0) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
212 mp_msg(MSGT_VO,MSGL_WARN,"DXR2 : write failed %s \n",strerror(errno)); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
213 dxr2bufpos = 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
214 break; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
215 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
216 dxr2bufpos -= w; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
217 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
218 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
219 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
220 #define PACK_MAX_SIZE 2048 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
221 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
222 static unsigned char pack[PACK_MAX_SIZE]; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
223 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
224 static unsigned char mpg_eof[]={ |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
225 0x00, 0x00, 0x01, 0xb9 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
226 }; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
227 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
228 static void dxr2_send_eof(void) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
229 { |
19151 | 230 write_dxr2(mpg_eof, sizeof(mpg_eof)); |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
231 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
232 |
6111
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
233 void dxr2_send_sub_packet(unsigned char* data,int len,int id,unsigned int timestamp) { |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
234 int ptslen=5; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
235 |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
236 if(dxr2_fd < 0) { |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
237 mp_msg(MSGT_VO,MSGL_ERR,"DXR2 fd is not valid\n"); |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
238 return; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
239 } |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
240 |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
241 if (((int) timestamp)<0) |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
242 timestamp=0; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
243 |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
244 mp_msg(MSGT_VO,MSGL_DBG2,"dxr2_send_sub_packet(timestamp=%d)\n", timestamp); |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
245 // startcode: |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
246 pack[0]=pack[1]=0;pack[2]=0x01; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
247 |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
248 // stream id |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
249 pack[3]=0xBD; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
250 |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
251 while(len>=4){ |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
252 int payload_size= PACK_MAX_SIZE-(7+ptslen+3); |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
253 if(payload_size>len) payload_size= len; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
254 |
6111
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
255 pack[4]=(3+ptslen+1+payload_size)>>8; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
256 pack[5]=(3+ptslen+1+payload_size)&255; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
257 |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
258 pack[6]=0x81; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
259 if(ptslen){ |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
260 int x; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
261 pack[7]=0x80; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
262 pack[8]=ptslen; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
263 // presentation time stamp: |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
264 x=(0x02 << 4) | (((timestamp >> 30) & 0x07) << 1) | 1; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
265 pack[9]=x; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
266 x=((((timestamp >> 15) & 0x7fff) << 1) | 1); |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
267 pack[10]=x>>8; pack[11]=x&255; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
268 x=((((timestamp) & 0x7fff) << 1) | 1); |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
269 pack[12]=x>>8; pack[13]=x&255; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
270 } else { |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
271 pack[7]=0x00; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
272 pack[8]=0x00; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
273 } |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
274 pack[ptslen+9] = id; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
275 |
6111
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
276 write_dxr2(pack,7+ptslen+3); |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
277 write_dxr2(data,payload_size); |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
278 len -= payload_size; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
279 data += payload_size; |
6111
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
280 ptslen = 0; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
281 } |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
282 } |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
283 |
6181 | 284 static int dxr2_set_vga_params(dxr2_vgaParams_t* vga,int detect) { |
285 // Init the overlay, don't ask me how it work ;-) | |
286 dxr2_sixArg_t oc; | |
287 dxr2_oneArg_t om; | |
288 dxr2_twoArg_t win; | |
289 dxr2_fourArg_t crop; | |
290 | |
8063
4c7ef4aeb88b
Overlay cropping options. Patch by Mark <CompGuy284 at attbi dot com> extanded
albeu
parents:
7981
diff
changeset
|
291 crop.arg1= cr_left; |
4c7ef4aeb88b
Overlay cropping options. Patch by Mark <CompGuy284 at attbi dot com> extanded
albeu
parents:
7981
diff
changeset
|
292 crop.arg2= cr_right; |
4c7ef4aeb88b
Overlay cropping options. Patch by Mark <CompGuy284 at attbi dot com> extanded
albeu
parents:
7981
diff
changeset
|
293 crop.arg3 = cr_top; |
4c7ef4aeb88b
Overlay cropping options. Patch by Mark <CompGuy284 at attbi dot com> extanded
albeu
parents:
7981
diff
changeset
|
294 crop.arg4 = cr_bot; |
6181 | 295 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_CROPPING, &crop); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
296 |
6181 | 297 oc.arg1 = 0x40; |
298 oc.arg2 = 0xff; | |
299 oc.arg3 = 0x40; | |
300 oc.arg4 = 0xff; | |
301 oc.arg5 = 0x40; | |
302 oc.arg6 = 0xff; | |
303 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_COLOUR, &oc); | |
304 | |
305 om.arg = ol_ratio; | |
306 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_RATIO,&om); | |
307 | |
308 win.arg1 = 100; | |
309 win.arg2 = 3; | |
310 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_POSITION,&win); | |
311 | |
312 win.arg1 = vo_screenwidth; | |
313 win.arg2 = vo_screenheight; | |
314 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_DIMENSION,&win); | |
315 | |
7981 | 316 om.arg = 0; |
6181 | 317 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_IN_DELAY,&om); |
318 | |
319 if(detect) { | |
320 // First we need a white screen | |
321 uint8_t* img = malloc(vo_screenwidth*vo_screenheight*3); | |
322 uint8_t* src[] = { img, NULL, NULL }; | |
7970 | 323 int stride[] = { vo_screenwidth * 3 , 0, 0 }; |
6181 | 324 int cc = vo_config_count; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
325 |
6181 | 326 memset(img,255,vo_screenwidth*vo_screenheight*3); |
327 vo_config_count = sub_config_count; | |
328 if(sub_vo->config(vo_screenwidth,vo_screenheight,vo_screenwidth,vo_screenheight, | |
7253 | 329 VOFLAG_FULLSCREEN ,"DXR2 sub vo",IMGFMT_BGR24) != 0) { |
6181 | 330 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] sub vo config failed => No overlay\n"); |
331 sub_vo->uninit(); | |
332 sub_vo = NULL; | |
333 use_ol = 0; | |
334 vo_config_count = cc; | |
335 return 0; | |
336 } | |
7970 | 337 sub_vo->draw_slice(src,stride,vo_screenwidth,vo_screenheight,0,0); |
6181 | 338 sub_vo->flip_page(); |
339 free(img); | |
340 sub_config_count++; | |
341 vo_config_count = cc; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
342 |
6181 | 343 om.arg = DXR2_OVERLAY_WINDOW_COLOUR_KEY; |
344 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_MODE,&om); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
345 |
6181 | 346 vga->xScreen = vo_screenwidth; |
347 vga->yScreen = vo_screenheight; | |
348 vga->hOffWinKey = 100; | |
349 vga->vOffWinKey = 3; | |
350 ioctl(dxr2_fd, DXR2_IOC_CALCULATE_VGA_PARAMETERS, vga); | |
351 } | |
352 ioctl(dxr2_fd, DXR2_IOC_SET_VGA_PARAMETERS,vga); | |
353 | |
354 return 1; | |
355 } | |
356 | |
357 static int dxr2_save_vga_params(dxr2_vgaParams_t* vga,char* name) { | |
358 struct stat s; | |
359 char* p = get_path("dxr2_cache"); | |
360 int p_len = strlen(p), name_len = strlen(name); | |
361 char cache_path[p_len + name_len + 2]; | |
362 int ret; | |
363 FILE* fd; | |
364 | |
365 if(stat(p,&s) !=0) { | |
366 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] No vga cache dir found (%s)\n",strerror(errno)); | |
367 if(errno == EACCES) { | |
368 free(p); | |
369 return 0; | |
370 } | |
371 // Try to create the dir | |
372 if(mkdir(p,S_IRWXU) != 0) { | |
373 mp_msg(MSGT_VO,MSGL_ERR,"VO: [dxr2] Unable to create vga cache dir %s (%s)\n",p,strerror(errno)); | |
374 free(p); | |
375 return 0; | |
376 } | |
377 } | |
378 sprintf(cache_path,"%s/%s",p,name); | |
379 free(p); | |
380 fd = fopen(cache_path,"w"); | |
381 if(fd == NULL) { | |
382 mp_msg(MSGT_VO,MSGL_ERR,"VO: [dxr2] Unable to open cache file %s for writing (%s)\n",cache_path,strerror(errno)); | |
383 return 0; | |
384 } | |
385 | |
7970 | 386 ret = fprintf(fd,"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", |
6181 | 387 vga->hOffWinKey, |
388 vga->vOffWinKey, | |
389 vga->xScreen, | |
390 vga->yScreen, | |
391 vga->hsyncPol, | |
392 vga->vsyncPol, | |
393 vga->blankStart, | |
394 vga->blankWidth, | |
395 vga->hOffset, | |
396 vga->vOffset, | |
7970 | 397 vga->ratio, |
398 olx_cor, | |
399 oly_cor, | |
400 olw_cor, | |
401 olh_cor); | |
6181 | 402 |
403 fclose(fd); | |
7970 | 404 return ret >= 11 ? 1 : 0; |
6181 | 405 } |
406 | |
407 static int dxr2_load_vga_params(dxr2_vgaParams_t* vga,char* name) { | |
408 char* p = get_path("dxr2_cache"); | |
409 int p_len = strlen(p), name_len = strlen(name); | |
410 char cache_path[p_len + name_len + 2]; | |
411 int ret; | |
8115 | 412 int xc,yc,wc,hc; |
6181 | 413 FILE* fd; |
414 | |
415 sprintf(cache_path,"%s/%s",p,name); | |
416 free(p); | |
417 | |
418 fd = fopen(cache_path,"r"); | |
419 if(fd == NULL) { | |
420 mp_msg(MSGT_VO,MSGL_ERR,"VO: [dxr2] Unable to open cache file %s for reading (%s)\n",cache_path,strerror(errno)); | |
421 return 0; | |
422 } | |
7970 | 423 ret = fscanf(fd, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", |
6181 | 424 &vga->hOffWinKey, |
425 &vga->vOffWinKey, | |
426 &vga->xScreen, | |
427 &vga->yScreen, | |
428 &vga->hsyncPol, | |
429 &vga->vsyncPol, | |
430 &vga->blankStart, | |
431 &vga->blankWidth, | |
432 &vga->hOffset, | |
433 &vga->vOffset, | |
7970 | 434 &vga->ratio, |
8115 | 435 &xc, |
436 &yc, | |
437 &wc, | |
438 &hc); | |
6181 | 439 |
440 fclose(fd); | |
8115 | 441 if(ret > 11 && !olx_cor) olx_cor = xc; |
442 if(ret > 12 && !oly_cor) oly_cor = yc; | |
443 if(ret > 13 && !olw_cor) olw_cor = wc; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
444 if(ret > 14 && !olh_cor) olh_cor = hc; |
7970 | 445 return ret >= 11 ? 1 : 0; |
6181 | 446 } |
447 | |
448 static int dxr2_setup_vga_params(void) { | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8115
diff
changeset
|
449 const vo_info_t* vi = sub_vo->info; |
6181 | 450 dxr2_vgaParams_t vga; |
451 | |
452 int loaded = dxr2_load_vga_params(&vga,(char*)vi->short_name); | |
453 if(!dxr2_set_vga_params(&vga,(update_cache || ignore_cache) ? 1 : !loaded )) | |
454 return 0; | |
455 if(!loaded || update_cache) | |
456 dxr2_save_vga_params(&vga,(char*)vi->short_name); | |
457 return 1; | |
458 } | |
459 | |
460 static void dxr2_set_overlay_window(void) { | |
461 uint8_t* src[] = { sub_img, NULL, NULL }; | |
7970 | 462 int stride[] = { movie_w * 3 , 0, 0 }; |
6181 | 463 dxr2_twoArg_t win; |
464 int redisp = 0; | |
465 int cc = vo_config_count; | |
466 vo_config_count = sub_config_count; | |
7970 | 467 sub_vo->draw_slice(src,stride,movie_w,movie_h,0,0); |
6181 | 468 sub_vo->flip_page(); |
469 vo_config_count = cc; | |
470 | |
7970 | 471 |
472 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] setting overlay with correction x=%d y=%d w=%d h=%d\n",olx_cor,oly_cor, olw_cor,olh_cor); | |
473 | |
474 // Sub vo isn't a windowed one, fill in the needed stuff | |
475 if(!sub_vo_win) { | |
476 if(vo_fs) { | |
477 vo_dwidth = vo_screenwidth; | |
478 vo_dheight = vo_screenheight; | |
479 vo_dx = vo_dy = 0; | |
480 } else { | |
481 vo_dwidth = movie_w; | |
482 vo_dheight = movie_h; | |
483 vo_dx = (vo_screenwidth - vo_dwidth) / 2; | |
484 vo_dy = (vo_screenheight - vo_dheight) / 2; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
485 } |
7970 | 486 } |
487 | |
6181 | 488 if(sub_w != vo_dwidth || sub_h != vo_dheight) { |
489 int new_aspect = ((1<<16)*vo_dwidth + vo_dheight/2)/vo_dheight; | |
490 sub_w = vo_dwidth; | |
491 sub_h = vo_dheight; | |
492 if(new_aspect > aspect) | |
493 sub_w = (sub_h*aspect + (1<<15))>>16; | |
494 else | |
495 sub_h = ((sub_w<<16) + (aspect>>1)) /aspect; | |
7970 | 496 sub_w += olw_cor; |
497 sub_h += olh_cor; | |
6181 | 498 sub_x_off = (vo_dwidth-sub_w) / 2; |
499 sub_y_off = (vo_dheight-sub_h) / 2; | |
500 sub_x = -vo_dx; // Be sure to also replace the overlay | |
501 win.arg1 = sub_w; | |
502 win.arg2 = sub_h; | |
503 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] set win size w=%d h=%d and offset x=%d y=%d \n",win.arg1,win.arg2,sub_x_off,sub_y_off); | |
504 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_DIMENSION, &win); | |
505 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
506 |
6181 | 507 if(vo_dx != sub_x || vo_dy != sub_y) { |
7970 | 508 sub_x = vo_dx + olx_cor + sub_x_off; |
509 sub_y = vo_dy + oly_cor + sub_y_off; | |
510 win.arg1 = (sub_x > 0 ? sub_x : 0); | |
511 win.arg2 = (sub_y > 0 ? sub_y : 0); | |
6181 | 512 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] set pos x=%d y=%d \n",win.arg1,win.arg2); |
513 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_POSITION,&win); | |
514 } | |
515 | |
516 } | |
517 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
11542
diff
changeset
|
518 static int config(uint32_t s_width, uint32_t s_height, uint32_t width, uint32_t height, uint32_t flags, char *title, uint32_t format) |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
519 { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
520 int arg; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
521 dxr2_threeArg_t arg3; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
522 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
523 if(dxr2_fd < 0) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
524 mp_msg(MSGT_VO,MSGL_ERR,"DXR2 fd is not valid\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
525 return VO_ERROR; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
526 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
527 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
528 if(playing) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
529 dxr2_send_eof(); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
530 flush_dxr2(); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
531 ioctl(dxr2_fd, DXR2_IOC_STOP, NULL); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
532 playing = 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
533 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
534 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
535 // Video stream setup |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
536 arg3.arg1 = DXR2_STREAM_VIDEO; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
537 arg3.arg2 = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
538 ioctl(dxr2_fd, DXR2_IOC_SELECT_STREAM, &arg3); |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
539 if (vo_fps > 28) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
540 arg3.arg1 = DXR2_SRC_VIDEO_FREQ_30; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
541 else arg3.arg1 = DXR2_SRC_VIDEO_FREQ_25; |
6181 | 542 arg3.arg2 = s_width; |
543 arg3.arg3 = s_height; | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
544 ioctl(dxr2_fd, DXR2_IOC_SET_SOURCE_VIDEO_FORMAT, &arg3); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
545 arg = DXR2_BITSTREAM_TYPE_MPEG_VOB; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
546 ioctl(dxr2_fd, DXR2_IOC_SET_BITSTREAM_TYPE, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
547 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
548 // Aspect ratio |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
549 if (1.76 <= movie_aspect && movie_aspect <= 1.80) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
550 arg = DXR2_ASPECTRATIO_16_9; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
551 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] source aspect ratio 16:9\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
552 } else { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
553 arg = DXR2_ASPECTRATIO_4_3; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
554 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] source aspect ratio 4:3\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
555 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
556 ioctl(dxr2_fd, DXR2_IOC_SET_SOURCE_ASPECT_RATIO, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
557 if (1.76 <= monitor_aspect && monitor_aspect <=1.80) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
558 arg = DXR2_ASPECTRATIO_16_9; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
559 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] monitor aspect ratio 16:9\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
560 } else { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
561 arg = DXR2_ASPECTRATIO_4_3; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
562 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] monitor aspect ratio 4:3\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
563 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
564 ioctl(dxr2_fd, DXR2_IOC_SET_OUTPUT_ASPECT_RATIO, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
565 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
566 arg = ar_mode; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
567 ioctl(dxr2_fd, DXR2_IOC_SET_ASPECT_RATIO_MODE, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
568 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
569 // TV setup |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
570 arg = mv_mode; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
571 ioctl(dxr2_fd, DXR2_IOC_SET_TV_MACROVISION_MODE, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
572 arg = _75ire_mode; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
573 ioctl(dxr2_fd, DXR2_IOC_SET_TV_75IRE_MODE, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
574 arg = bw_mode; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
575 ioctl(dxr2_fd, DXR2_IOC_SET_TV_BLACKWHITE_MODE, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
576 arg = interlaced_mode; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
577 ioctl(dxr2_fd, DXR2_IOC_SET_TV_INTERLACED_MODE, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
578 arg = pixel_mode; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
579 ioctl(dxr2_fd, DXR2_IOC_SET_TV_PIXEL_MODE, &arg); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
580 |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
581 if (norm) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
582 if (strcmp(norm, "ntsc")==0) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
583 arg = DXR2_OUTPUTFORMAT_NTSC; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
584 else if (strcmp(norm, "pal")==0) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
585 if (vo_fps > 28) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
586 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] you want pal, but we play at 30 fps, selecting pal60 instead\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
587 arg = DXR2_OUTPUTFORMAT_PAL_60; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
588 norm="pal60"; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
589 } else arg = DXR2_OUTPUTFORMAT_PAL_BDGHI; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
590 } else if (strcmp(norm, "pal60")==0) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
591 if (vo_fps > 28) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
592 arg = DXR2_OUTPUTFORMAT_PAL_60; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
593 else { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
594 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] you want pal60, but we play at 25 fps, selecting pal instead\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
595 arg = DXR2_OUTPUTFORMAT_PAL_BDGHI; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
596 norm="pal"; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
597 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
598 } else if (strcmp(norm, "palm")==0) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
599 arg = DXR2_OUTPUTFORMAT_PAL_M; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
600 else if (strcmp(norm, "paln")==0) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
601 arg = DXR2_OUTPUTFORMAT_PAL_N; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
602 else if (strcmp(norm, "palnc")==0) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
603 arg = DXR2_OUTPUTFORMAT_PAL_Nc; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
604 else { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
605 mp_msg(MSGT_VO,MSGL_WARN,"[dxr2] invalid norm %s\n", norm); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
606 mp_msg(MSGT_VO,MSGL_WARN,"Valid values are ntsc,pal,pal60,palm,paln,palnc\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
607 mp_msg(MSGT_VO,MSGL_WARN,"Using ntsc\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
608 norm="ntsc"; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
609 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
610 } else { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
611 if (vo_fps > 28) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
612 arg = DXR2_OUTPUTFORMAT_NTSC; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
613 norm="ntsc"; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
614 } else { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
615 arg = DXR2_OUTPUTFORMAT_PAL_BDGHI; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
616 norm="pal"; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
617 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
618 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
619 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] output norm set to %s\n", norm); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
620 ioctl(dxr2_fd, DXR2_IOC_SET_TV_OUTPUT_FORMAT, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
621 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
622 // Subtitles |
6111
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
623 |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
624 arg = DXR2_SUBPICTURE_ON; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
625 ioctl(dxr2_fd,DXR2_IOC_ENABLE_SUBPICTURE,&arg); |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
626 arg3.arg1 = DXR2_STREAM_SUBPICTURE; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
627 arg3.arg2 = 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
628 ioctl(dxr2_fd, DXR2_IOC_SELECT_STREAM, &arg3); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
629 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
630 // Audio |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
631 arg = iec958_mode; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
632 ioctl(dxr2_fd, DXR2_IOC_IEC958_OUTPUT_MODE, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
633 arg = DXR2_AUDIO_WIDTH_16; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
634 ioctl(dxr2_fd, DXR2_IOC_SET_AUDIO_DATA_WIDTH, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
635 arg = DXR2_AUDIO_FREQ_48; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
636 ioctl(dxr2_fd, DXR2_IOC_SET_AUDIO_SAMPLE_FREQUENCY, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
637 arg3.arg1 = DXR2_STREAM_AUDIO_LPCM; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
638 arg3.arg2 = 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
639 ioctl(dxr2_fd, DXR2_IOC_SELECT_STREAM, &arg3); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
640 arg = 19; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
641 ioctl(dxr2_fd, DXR2_IOC_SET_AUDIO_VOLUME, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
642 arg = mute_mode; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
643 ioctl(dxr2_fd, DXR2_IOC_AUDIO_MUTE, &arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
644 |
7970 | 645 movie_w = width; |
646 movie_h = height; | |
7981 | 647 //vo_fs = flags & VOFLAG_FULLSCREEN ? 1 : 0; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
648 // Overlay |
6181 | 649 while(use_ol) { |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
650 dxr2_twoArg_t win; |
6181 | 651 dxr2_oneArg_t om; |
652 int cc = vo_config_count; | |
653 vo_config_count = sub_config_count; | |
7970 | 654 // Load or detect the overlay stuff |
6181 | 655 if(!dxr2_setup_vga_params()) { |
656 sub_vo->uninit(); | |
657 sub_vo = NULL; | |
658 vo_config_count = cc; | |
659 break; | |
660 } | |
7970 | 661 // Does the sub vo support the x11 stuff |
662 // Fix me : test the other x11 vo's and enable them | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8115
diff
changeset
|
663 if(strcmp(sub_vo->info->short_name,"x11") == 0) |
7970 | 664 sub_vo_win = 1; |
665 else | |
666 sub_vo_win = 0; | |
667 | |
668 // No window and no osd => we don't need any subdriver | |
669 if(!sub_vo_win && !ol_osd) { | |
6181 | 670 sub_vo->uninit(); |
671 sub_vo = NULL; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
672 } |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
673 |
6181 | 674 while(sub_vo) { |
675 dxr2_sixArg_t oc; | |
676 int i,sub_flags = VOFLAG_SWSCALE | (flags & VOFLAG_FULLSCREEN); | |
677 if(sub_vo->config(width,height,width,height,sub_flags, | |
7253 | 678 "MPlayer DXR2 render",IMGFMT_BGR24) != 0) { |
6181 | 679 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] sub vo config failed => No X11 window\n"); |
680 sub_vo->uninit(); | |
681 sub_vo = NULL; | |
682 break; | |
683 } | |
684 sub_config_count++; | |
685 | |
686 // Feel free to try some other other color and report your results | |
7981 | 687 oc.arg1 = ck_rmin; |
688 oc.arg2 = ck_rmax; | |
689 oc.arg3 = ck_gmin; | |
690 oc.arg4 = ck_gmax; | |
691 oc.arg5 = ck_bmin; | |
692 oc.arg6 = ck_bmax; | |
6181 | 693 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_COLOUR, &oc); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
694 |
6181 | 695 om.arg = DXR2_OVERLAY_WINDOW_COLOUR_KEY; |
696 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_MODE,&om); | |
697 sub_img = malloc(width*height*3); | |
698 for(i = 0 ; i < width*height*3 ; i += 3) { | |
7981 | 699 sub_img[i] = ck_b; |
700 sub_img[i+1] = ck_g; | |
701 sub_img[i+2] = ck_r; | |
6181 | 702 } |
703 aspect = ((1<<16)*width + height/2)/height; | |
704 sub_w = sub_h = 0; | |
705 dxr2_set_overlay_window(); | |
706 break; | |
707 } | |
708 vo_config_count = cc; | |
709 if(!sub_vo) { // Fallback on non windowed overlay | |
7981 | 710 vo_fs = flags & VOFLAG_FULLSCREEN ? 1 : 0; |
6181 | 711 om.arg = DXR2_OVERLAY_WINDOW_KEY; |
712 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_MODE,&om); | |
713 win.arg1 = flags & VOFLAG_FULLSCREEN ? vo_screenwidth : width; | |
714 win.arg2 = flags & VOFLAG_FULLSCREEN ? vo_screenheight : height; | |
715 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_DIMENSION, &win); | |
716 win.arg1 = (vo_screenwidth - win.arg1) / 2; | |
717 win.arg2 = (vo_screenheight - win.arg2) / 2; | |
718 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_POSITION,&win); | |
719 } | |
720 break; | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
721 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
722 |
11542 | 723 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
724 |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
725 // start playing |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
726 if(ioctl(dxr2_fd, DXR2_IOC_PLAY, NULL) == 0) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
727 playing = 1; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
728 return 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
729 } else |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
730 return VO_ERROR; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
731 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
732 |
7970 | 733 static void clear_alpha(int x0,int y0, int w,int h) { |
734 uint8_t* src[] = { sub_img , NULL, NULL }; | |
735 int stride[] = { movie_w * 3, 0, 0 }; | |
736 | |
737 sub_vo->draw_slice(src,stride,w,h,x0,y0); | |
738 } | |
739 | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
740 static void draw_osd(void) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
741 { |
7970 | 742 if(sub_vo && ol_osd) { |
743 vo_remove_text(movie_w,movie_h,clear_alpha); | |
744 sub_vo->draw_osd(); | |
745 } | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
746 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
747 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
11542
diff
changeset
|
748 static int draw_frame(uint8_t * src[]) |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
749 { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
750 vo_mpegpes_t *p=(vo_mpegpes_t *)src[0]; |
19151 | 751 |
6111
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
752 if(p->id == 0x1E0) {// Video |
19151 | 753 send_mpeg_ps_packet (p->data, p->size, p->id, |
754 p->timestamp ? p->timestamp : vo_pts, 2, write_dxr2); | |
6111
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
755 } else if(p->id == 0x20) // Subtitles |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
756 dxr2_send_sub_packet(p->data, p->size, p->id, p->timestamp); |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
757 return 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
758 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
759 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
760 static void flip_page (void) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
761 { |
7981 | 762 if(sub_vo && ol_osd && vo_osd_changed_flag) |
7970 | 763 sub_vo->flip_page(); |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
764 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
765 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
11542
diff
changeset
|
766 static int draw_slice( uint8_t *srcimg[], int stride[], int w, int h, int x0, int y0 ) |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
767 { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
768 return 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
769 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
770 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
771 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
11542
diff
changeset
|
772 static int query_format(uint32_t format) |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
773 { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
774 if (format==IMGFMT_MPEGPES) |
6074
10a30eebafaf
Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents:
6070
diff
changeset
|
775 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_TIMER|VFCAP_SPU; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
776 return 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
777 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
778 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
779 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
780 static void uninit(void) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
781 { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
782 mp_msg(MSGT_VO,MSGL_DBG2, "VO: [dxr2] Uninitializing\n" ); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
783 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
784 if (dxr2_fd > 0) { |
6111
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
785 if(playing) { |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
786 dxr2_send_eof(); |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
787 flush_dxr2(); |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
788 playing = 0; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
789 } |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
790 close(dxr2_fd); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
791 dxr2_fd = -1; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
792 } |
6181 | 793 if(sub_img) { |
794 free(sub_img); | |
795 sub_img = NULL; | |
796 } | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
797 if(sub_vo) { |
6181 | 798 int cc = vo_config_count; |
799 vo_config_count = sub_config_count; | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
800 sub_vo->uninit(); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
801 sub_vo = NULL; |
6181 | 802 vo_config_count = cc; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
803 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
804 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
805 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
806 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
807 static void check_events(void) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
808 { |
6181 | 809 // I'd like to have this done in an x11 independent way |
810 // It's because of this that we are limited to vo_x11 for windowed overlay :-( | |
811 #ifdef X11_FULLSCREEN | |
7970 | 812 if(sub_vo && sub_vo_win) { |
6181 | 813 int e=vo_x11_check_events(mDisplay); |
814 if ( !(e&VO_EVENT_RESIZE) && !(e&VO_EVENT_EXPOSE) ) return; | |
815 XSetBackground(mDisplay, vo_gc, 0); | |
816 XClearWindow(mDisplay, vo_window); | |
817 dxr2_set_overlay_window(); | |
818 } | |
819 #endif | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
820 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
821 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
11542
diff
changeset
|
822 static int preinit(const char *arg) { |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
823 int uCodeFD = -1; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
824 int uCodeSize; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
825 dxr2_uCode_t* uCode; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
826 dxr2_fourArg_t crop; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
827 int n=0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
828 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
829 sub_vo = NULL; |
6181 | 830 sub_config_count = 0; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
831 if(use_ol) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
832 if (arg) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
833 for(n = 0 ; video_out_drivers[n] != NULL ; n++) { |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8115
diff
changeset
|
834 const vo_info_t* vi = video_out_drivers[n]->info; |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
835 if(!vi) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
836 continue; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
837 if(strcasecmp(arg,vi->short_name) == 0) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
838 break; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
839 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
840 sub_vo = video_out_drivers[n]; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
841 } else { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
842 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] We need a sub driver to initialize the overlay\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
843 use_ol = 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
844 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
845 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
846 |
6070 | 847 if(!sub_vo) { |
848 if(use_ol) | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
849 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] Sub driver '%s' not found => no overlay\n",arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
850 use_ol = 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
851 } else { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
852 if(sub_vo->preinit(NULL) != 0) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
853 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] Sub vo %s preinit failed => no overlay\n",arg); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
854 sub_vo = NULL; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
855 use_ol = 0; |
7981 | 856 } else { |
857 uint32_t fmt = IMGFMT_BGR24; | |
25962 | 858 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] Sub vo %s initialized\n",arg); |
7981 | 859 if(sub_vo->control(VOCTRL_QUERY_FORMAT,&fmt) <= 0) { |
860 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] Sub vo %s doesn't support BGR24 => no overlay\n",arg); | |
861 sub_vo->uninit(); | |
862 sub_vo = NULL; | |
863 use_ol = 0; | |
864 } | |
865 } | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
866 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
867 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
868 dxr2_fd = open( "/dev/dxr2", O_WRONLY); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
869 if( dxr2_fd < 0 ) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
870 mp_msg(MSGT_VO,MSGL_V, "VO: [dxr2] Error opening /dev/dxr2 for writing!\n" ); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
871 return VO_ERROR; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
872 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
873 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
874 if(ucode) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
875 uCodeFD = open(ucode, O_RDONLY); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
876 else for (n=0; ucodesearchpath[n] != NULL; n++) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
877 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] Looking for microcode in %s... ", |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
878 ucodesearchpath[n]); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
879 if ((uCodeFD = open(ucodesearchpath[n], O_RDONLY))>0) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
880 mp_msg(MSGT_VO,MSGL_V,"ok\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
881 break; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
882 } else { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
883 mp_msg(MSGT_VO,MSGL_V,"failed (%s)\n", strerror(errno)); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
884 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
885 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
886 if (uCodeFD < 0) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
887 mp_msg(MSGT_VO,MSGL_ERR,"VO: [dxr2] Could not open microcode\n"); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
888 return VO_ERROR; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
889 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
890 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
891 uCodeSize = lseek(uCodeFD, 0, SEEK_END); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
892 if ((uCode = malloc(uCodeSize + 4)) == NULL) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
893 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
894 mp_msg(MSGT_VO,MSGL_FATAL,"VO: [dxr2] Could not allocate memory for uCode: %s\n", strerror(errno)); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
895 return VO_ERROR; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
896 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
897 lseek(uCodeFD, 0, SEEK_SET); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
898 if (read(uCodeFD, uCode+4, uCodeSize) != uCodeSize) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
899 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
900 mp_msg(MSGT_VO,MSGL_ERR,"VO: [dxr2] Could not read uCode uCode: %s\n", strerror(errno)); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
901 return VO_ERROR; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
902 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
903 close(uCodeFD); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
904 uCode->uCodeLength = uCodeSize; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
905 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
906 // upload ucode |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
907 ioctl(dxr2_fd, DXR2_IOC_INIT_ZIVADS, uCode); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
908 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
909 // reset card |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
910 ioctl(dxr2_fd, DXR2_IOC_RESET, NULL); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
911 playing = 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
912 |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
913 if(!use_ol) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
914 crop.arg1=0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
915 crop.arg2=0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
916 crop.arg3=0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
917 crop.arg4=0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
918 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_CROPPING, &crop); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
919 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
920 return 0; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
921 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
922 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
11542
diff
changeset
|
923 static int control(uint32_t request, void *data, ...) |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
924 { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
925 switch (request) { |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
926 case VOCTRL_QUERY_FORMAT: |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
927 return query_format(*((uint32_t*)data)); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
928 case VOCTRL_PAUSE: |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
929 ioctl(dxr2_fd,DXR2_IOC_PAUSE, NULL); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
930 return VO_TRUE; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
931 case VOCTRL_RESUME: |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
932 ioctl(dxr2_fd, DXR2_IOC_PLAY, NULL); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
933 return VO_TRUE; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
934 case VOCTRL_RESET: |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
935 flush_dxr2(); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
936 ioctl(dxr2_fd, DXR2_IOC_PLAY, NULL); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
937 return VO_TRUE; |
11542 | 938 case VOCTRL_ONTOP: |
939 vo_x11_ontop(); | |
940 return VO_TRUE; | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
941 case VOCTRL_FULLSCREEN: |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
942 if(!use_ol) |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
943 return VO_NOTIMPL; |
7970 | 944 else if(sub_vo) { |
945 int r = sub_vo->control(VOCTRL_FULLSCREEN,0); | |
946 if(r == VO_TRUE && !sub_vo_win) | |
947 dxr2_set_overlay_window(); | |
948 return r; | |
949 } else { | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
950 dxr2_twoArg_t win; |
6181 | 951 vo_fs = !vo_fs; |
952 win.arg1 = vo_fs ? vo_screenwidth : movie_w; | |
953 win.arg2 = vo_fs ? vo_screenheight : movie_h; | |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
954 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_DIMENSION, &win); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
955 win.arg1 = (vo_screenwidth - win.arg1) / 2; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
956 win.arg2 = (vo_screenheight - win.arg2) / 2; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
957 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_POSITION,&win); |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
958 return VO_TRUE; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
959 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
960 case VOCTRL_SET_SPU_PALETTE: { |
6111
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
961 if(ioctl(dxr2_fd,DXR2_IOC_SET_SUBPICTURE_PALETTE,data) < 0) { |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
962 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] SPU palette loading failed\n"); |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
963 return VO_ERROR; |
582960ab7cc7
Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents:
6074
diff
changeset
|
964 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
965 return VO_TRUE; |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
966 } |
6069
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
967 } |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
968 return VO_NOTIMPL; |
8e88e92fe331
Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff
changeset
|
969 } |