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