annotate libvo/vo_dxr2.c @ 26091:8732f2107b56

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