annotate libvo/vo_dxr2.c @ 6346:f9b044b3aca1

rv20 added
author arpi
date Sun, 09 Jun 2002 01:09:09 +0000
parents dc29d4236bdc
children 3e62e9cd1816
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"
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
19 #include "cfgparser.h"
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
20
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
21 #ifdef X11_FULLSCREEN
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
22 #include "x11_common.h"
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
23 #endif
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
24
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
25 #include <dxr2ioctl.h>
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
26
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
27 LIBVO_EXTERN (dxr2)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
28
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
29 extern char *get_path(char *filename);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
30
6069
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 static int last_freq_id = -1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
39
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
40 // vo device used to blank the screen for the overlay init
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
41 static vo_functions_t* sub_vo = NULL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
42
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
43 static uint8_t* sub_img = NULL;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
44 static int sub_x,sub_y,sub_w,sub_h;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
45 static int sub_x_off,sub_y_off;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
46 static int sub_config_count;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
47 static int aspect;
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;
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
63
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
64 static config_t dxr2_opts[] = {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
65 { "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
66 { "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
67 { "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
68 { "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
69
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
70 { "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
71
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
72 { "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
73
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
74 { "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
75
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
76 { "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
77 { "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
78
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
79 { "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
80 { "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
81
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
82 { "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
83 { "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
84
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
85 { "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
86 { "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
87
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
88 { "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
89 { "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
90
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
91 { "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
92 { "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
93
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
94 { "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
95 { "update-cache",&update_cache,CONF_TYPE_FLAG, 0, 0, 1, NULL},
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
96 { 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
97 };
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
98
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
99 static config_t dxr2_opt[] = {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
100 { "dxr2", &dxr2_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
101 { 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
102 };
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 void vo_dxr2_register_options(m_config_t* cfg) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
105 m_config_register_options(cfg,dxr2_opt);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
106 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
107
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
108 static vo_info_t vo_info = {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
109 "DXR2 video out",
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
110 "dxr2",
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
111 "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
112 ""
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
113 };
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
114
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
115 static char *ucodesearchpath[] = {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
116 "/usr/local/lib/dxr2/dvd12.ux",
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
117 "/usr/lib/dxr2/dvd12.ux",
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
118 "/usr/src/dvd12.ux",
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
119 NULL,
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
120 };
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
121
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
122 #define BUF_SIZE 2048
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
123
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
124 static unsigned char dxr2buf[BUF_SIZE];
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
125 static unsigned int dxr2bufpos = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
126
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
127 static void write_dxr2(void *data, int len)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
128 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
129 int w = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
130 while (len>0) if ((dxr2bufpos+len) <= BUF_SIZE) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
131 memcpy(dxr2buf+dxr2bufpos, data, len);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
132 dxr2bufpos+=len;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
133 len=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
134 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
135 int copylen=BUF_SIZE-dxr2bufpos;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
136 if(copylen > 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
137 memcpy(dxr2buf+dxr2bufpos, data, copylen);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
138 dxr2bufpos += copylen;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
139 data+=copylen;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
140 len-=copylen;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
141 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
142 w = write(dxr2_fd, dxr2buf, BUF_SIZE);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
143 if(w < 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
144 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
145 dxr2bufpos = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
146 break;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
147 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
148 dxr2bufpos -= w;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
149 if(dxr2bufpos)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
150 memmove(dxr2buf,dxr2buf + w,dxr2bufpos);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
151 }
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
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
154 static void flush_dxr2()
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
155 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
156 int w;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
157 while (dxr2bufpos) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
158 w = write(dxr2_fd, dxr2buf, dxr2bufpos);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
159 if(w < 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
160 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
161 dxr2bufpos = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
162 break;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
163 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
164 dxr2bufpos -= w;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
165 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
166 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
167
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
168 #define PACK_MAX_SIZE 2048
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
169
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
170 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
171
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
172 static unsigned char mpg_header[]={
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
173 0x00, 0x00, 0x01, 0xba, 0x44, 0x00, 0x04, 0x00,
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
174 0x04, 0x01, 0x01, 0x86, 0xa3, 0xf8
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
175 };
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
176
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
177 static unsigned char mpg_eof[]={
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
178 0x00, 0x00, 0x01, 0xb9
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
179 };
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
180
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
181 static void dxr2_send_header(void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
182 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
183 write_dxr2(&mpg_header, sizeof(mpg_header));
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
184 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
185
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
186 static void dxr2_send_eof(void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
187 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
188 write_dxr2(&mpg_eof, sizeof(mpg_eof));
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
189 }
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 void dxr2_send_packet(unsigned char* data,int len,int id,int timestamp)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
192 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
193 int ptslen=5;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
194
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
195 if(dxr2_fd < 0) {
6074
10a30eebafaf Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents: 6070
diff changeset
196 mp_msg(MSGT_VO,MSGL_ERR,"DXR2 fd is not valid\n");
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
197 return;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
198 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
199
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
200 mp_msg(MSGT_VO,MSGL_DBG2,"DXR2 packet : 0x%x => %d \n",id,timestamp);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
201 dxr2_send_header();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
202
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
203 // startcode:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
204 pack[0]=pack[1]=0;pack[2]=0x01;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
205 // stream id
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
206 pack[3]=id;
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 while(len>0){
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
209 int payload_size=len; // data + PTS
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
210 if(9+ptslen+payload_size>PACK_MAX_SIZE) payload_size=PACK_MAX_SIZE-(6+ptslen);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
211
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
212 // construct PES header: (code from ffmpeg's libav)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
213 // packetsize:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
214 pack[4]=(3+ptslen+payload_size)>>8;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
215 pack[5]=(3+ptslen+payload_size)&255;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
216
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
217 pack[6]=0x81;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
218 if(ptslen){
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
219 int x;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
220 pack[7]=0x80;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
221 pack[8]=ptslen;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
222 // presentation time stamp:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
223 x=(0x02 << 4) | (((timestamp >> 30) & 0x07) << 1) | 1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
224 pack[9]=x;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
225 x=((((timestamp >> 15) & 0x7fff) << 1) | 1);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
226 pack[10]=x>>8; pack[11]=x&255;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
227 x=((((timestamp) & 0x7fff) << 1) | 1);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
228 pack[12]=x>>8; pack[13]=x&255;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
229 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
230 pack[7]=0x00;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
231 pack[8]=0x00;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
232 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
233
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
234 write_dxr2(pack, 9+ptslen);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
235 write_dxr2(data, payload_size);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
236
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
237 len-=payload_size; data+=payload_size;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
238 ptslen=0; // store PTS only once, at first packet!
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
239 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
240 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
241
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
242 void dxr2_send_lpcm_packet(unsigned char* data,int len,int id,unsigned int timestamp,int freq_id)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
243 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
244 int arg;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
245 int ptslen=5;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
246
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
247 if(dxr2_fd < 0) {
6074
10a30eebafaf Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents: 6070
diff changeset
248 mp_msg(MSGT_VO,MSGL_ERR,"DXR2 fd is not valid\n");
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
249 return;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
250 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
251
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
252 if(last_freq_id != freq_id) {
6074
10a30eebafaf Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents: 6070
diff changeset
253 ioctl(dxr2_fd, DXR2_IOC_SET_AUDIO_SAMPLE_FREQUENCY, &freq_id);
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
254 last_freq_id = freq_id;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
255 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
256
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
257 if (((int) timestamp)<0)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
258 timestamp=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
259
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
260 mp_msg(MSGT_VO,MSGL_DBG2,"dxr2_send_lpcm_packet(timestamp=%d)\n", timestamp);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
261 // startcode:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
262 pack[0]=pack[1]=0;pack[2]=0x01;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
263
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
264 // stream id
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
265 pack[3]=0xBD;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
266
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
267 while(len>=4){
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
268 int payload_size;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
269
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
270 payload_size=PACK_MAX_SIZE-6-3-ptslen-7; // max possible data len
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
271 if(payload_size>len) payload_size=len;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
272 payload_size&=(~3); // align!
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
273
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
274 // packetsize:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
275 pack[4]=(payload_size+3+ptslen+7)>>8;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
276 pack[5]=(payload_size+3+ptslen+7)&255;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
277
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
278 // stuffing:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
279 pack[6]=0x81;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
280 // pack[7]=0x00; //0x80
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
281
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
282 // hdrlen:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
283 pack[8]=ptslen;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
284
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
285 if(ptslen){
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
286 int x;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
287 pack[7]=0x80;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
288 // presentation time stamp:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
289 x=(0x02 << 4) | (((timestamp >> 30) & 0x07) << 1) | 1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
290 pack[9]=x;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
291 x=((((timestamp >> 15) & 0x7fff) << 1) | 1);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
292 pack[10]=x>>8; pack[11]=x&255;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
293 x=((((timestamp) & 0x7fff) << 1) | 1);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
294 pack[12]=x>>8; pack[13]=x&255;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
295 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
296 pack[7]=0x00;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
297 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
298
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
299 // ============ LPCM header: (7 bytes) =================
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
300 // Info by mocm@convergence.de
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
301
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
302 // ID:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
303 pack[ptslen+9]=id;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
304
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
305 // number of frames:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
306 pack[ptslen+10]=0x07;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
307
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
308 // first acces unit pointer, i.e. start of audio frame:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
309 pack[ptslen+11]=0x00;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
310 pack[ptslen+12]=0x04;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
311
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
312 // audio emphasis on-off 1 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
313 // audio mute on-off 1 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
314 // reserved 1 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
315 // audio frame number 5 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
316 pack[ptslen+13]=0x0C;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
317
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
318 // quantization word length 2 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
319 // audio sampling frequency (48khz = 0, 96khz = 1) 2 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
320 // reserved 1 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
321 // number of audio channels - 1 (e.g. stereo = 1) 3 bit
6074
10a30eebafaf Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents: 6070
diff changeset
322 pack[ptslen+14]=1;
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
323
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
324 // dynamic range control (0x80 if off)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
325 pack[ptslen+15]=0x80;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
326
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
327 write_dxr2(pack, 6+3+ptslen+7);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
328 write_dxr2(data, payload_size);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
329
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
330 len-=payload_size; data+=payload_size;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
331 timestamp+=90000/4*payload_size/48000;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
332 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
333 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
334
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
335 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
336 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
337
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
338 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
339 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
340 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
341 }
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
342
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
343 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
344 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
345
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
346 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
347 // 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
348 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
349
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
350 // 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
351 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
352
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
353 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
354 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
355 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
356
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
357 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
358 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
359
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
360 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
361 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
362 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
363 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
364 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
365 // 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
366 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
367 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
368 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
369 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
370 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
371 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
372 } 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
373 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
374 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
375 }
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
376 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
377
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
378 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
379 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
380 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
381 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
382 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
383 }
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
384 }
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
385
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
386 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
387 // Init the overlay, don't ask me how it work ;-)
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
388 dxr2_sixArg_t oc;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
389 dxr2_oneArg_t om;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
390 dxr2_twoArg_t win;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
391 dxr2_fourArg_t crop;
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 crop.arg1=0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
394 crop.arg2=0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
395 crop.arg3=55;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
396 crop.arg4=300;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
397 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_CROPPING, &crop);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
398
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
399 oc.arg1 = 0x40;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
400 oc.arg2 = 0xff;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
401 oc.arg3 = 0x40;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
402 oc.arg4 = 0xff;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
403 oc.arg5 = 0x40;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
404 oc.arg6 = 0xff;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
405 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_COLOUR, &oc);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
406
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
407 om.arg = ol_ratio;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
408 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_RATIO,&om);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
409
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
410 win.arg1 = 100;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
411 win.arg2 = 3;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
412 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_POSITION,&win);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
413
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
414 win.arg1 = vo_screenwidth;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
415 win.arg2 = vo_screenheight;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
416 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_DIMENSION,&win);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
417
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
418 om.arg = 3;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
419 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_IN_DELAY,&om);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
420
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
421 if(detect) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
422 // First we need a white screen
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
423 uint8_t* img = malloc(vo_screenwidth*vo_screenheight*3);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
424 uint8_t* src[] = { img, NULL, NULL };
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
425 int cc = vo_config_count;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
426
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
427 memset(img,255,vo_screenwidth*vo_screenheight*3);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
428 vo_config_count = sub_config_count;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
429 if(sub_vo->config(vo_screenwidth,vo_screenheight,vo_screenwidth,vo_screenheight,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
430 VOFLAG_FULLSCREEN ,"DXR2 sub vo",IMGFMT_BGR24,NULL) != 0) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
431 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
432 sub_vo->uninit();
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
433 sub_vo = NULL;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
434 use_ol = 0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
435 vo_config_count = cc;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
436 return 0;
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 sub_vo->draw_frame(src);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
439 sub_vo->flip_page();
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
440 free(img);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
441 sub_config_count++;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
442 vo_config_count = cc;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
443
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
444 om.arg = DXR2_OVERLAY_WINDOW_COLOUR_KEY;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
445 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_MODE,&om);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
446
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
447 vga->xScreen = vo_screenwidth;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
448 vga->yScreen = vo_screenheight;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
449 vga->hOffWinKey = 100;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
450 vga->vOffWinKey = 3;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
451 ioctl(dxr2_fd, DXR2_IOC_CALCULATE_VGA_PARAMETERS, vga);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
452 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
453 ioctl(dxr2_fd, DXR2_IOC_SET_VGA_PARAMETERS,vga);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
454
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
455 return 1;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
456 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
457
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
458 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
459 struct stat s;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
460 char* p = get_path("dxr2_cache");
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
461 int p_len = strlen(p), name_len = strlen(name);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
462 char cache_path[p_len + name_len + 2];
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
463 int ret;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
464 FILE* fd;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
465
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
466 if(stat(p,&s) !=0) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
467 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
468 if(errno == EACCES) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
469 free(p);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
470 return 0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
471 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
472 // Try to create the dir
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
473 if(mkdir(p,S_IRWXU) != 0) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
474 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
475 free(p);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
476 return 0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
477 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
478 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
479 sprintf(cache_path,"%s/%s",p,name);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
480 free(p);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
481 fd = fopen(cache_path,"w");
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
482 if(fd == NULL) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
483 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
484 return 0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
485 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
486
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
487 ret = fprintf(fd,"%d %d %d %d %d %d %d %d %d %d %d\n",
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
488 vga->hOffWinKey,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
489 vga->vOffWinKey,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
490 vga->xScreen,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
491 vga->yScreen,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
492 vga->hsyncPol,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
493 vga->vsyncPol,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
494 vga->blankStart,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
495 vga->blankWidth,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
496 vga->hOffset,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
497 vga->vOffset,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
498 vga->ratio);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
499
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
500 fclose(fd);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
501 return ret == 11 ? 1 : 0;
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
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
504 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
505 char* p = get_path("dxr2_cache");
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
506 int p_len = strlen(p), name_len = strlen(name);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
507 char cache_path[p_len + name_len + 2];
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
508 int ret;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
509 FILE* fd;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
510
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
511 sprintf(cache_path,"%s/%s",p,name);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
512 free(p);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
513
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
514 fd = fopen(cache_path,"r");
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
515 if(fd == NULL) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
516 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
517 return 0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
518 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
519 ret = fscanf(fd, "%d %d %d %d %d %d %d %d %d %d %d\n",
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
520 &vga->hOffWinKey,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
521 &vga->vOffWinKey,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
522 &vga->xScreen,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
523 &vga->yScreen,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
524 &vga->hsyncPol,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
525 &vga->vsyncPol,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
526 &vga->blankStart,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
527 &vga->blankWidth,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
528 &vga->hOffset,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
529 &vga->vOffset,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
530 &vga->ratio);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
531
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
532 fclose(fd);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
533 return ret == 11 ? 1 : 0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
534 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
535
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
536 static int dxr2_setup_vga_params(void) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
537 const vo_info_t* vi = sub_vo->get_info();
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
538 dxr2_vgaParams_t vga;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
539
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
540 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
541 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
542 return 0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
543 if(!loaded || update_cache)
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
544 dxr2_save_vga_params(&vga,(char*)vi->short_name);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
545 return 1;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
546 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
547
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
548 static void dxr2_set_overlay_window(void) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
549 uint8_t* src[] = { sub_img, NULL, NULL };
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
550 dxr2_twoArg_t win;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
551 int redisp = 0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
552 int cc = vo_config_count;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
553 vo_config_count = sub_config_count;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
554 sub_vo->draw_frame(src);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
555 sub_vo->flip_page();
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
556 vo_config_count = cc;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
557
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
558 if(sub_w != vo_dwidth || sub_h != vo_dheight) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
559 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
560 sub_w = vo_dwidth;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
561 sub_h = vo_dheight;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
562 if(new_aspect > aspect)
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
563 sub_w = (sub_h*aspect + (1<<15))>>16;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
564 else
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
565 sub_h = ((sub_w<<16) + (aspect>>1)) /aspect;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
566 sub_x_off = (vo_dwidth-sub_w) / 2;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
567 sub_y_off = (vo_dheight-sub_h) / 2;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
568 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
569 win.arg1 = sub_w;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
570 win.arg2 = sub_h;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
571 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
572 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_DIMENSION, &win);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
573 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
574
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
575 if(vo_dx != sub_x || vo_dy != sub_y) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
576 sub_x = vo_dx;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
577 sub_y = vo_dy;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
578 win.arg1 = (sub_x > 0 ? sub_x : 0) + sub_x_off;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
579 win.arg2 = (sub_y > 0 ? sub_y : 0) + sub_y_off;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
580 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
581 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_POSITION,&win);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
582 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
583
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
584 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
585
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
586 static uint32_t config(uint32_t s_width, uint32_t s_height, uint32_t width, uint32_t height, uint32_t flags, char *title, uint32_t format, const vo_tune_info_t *info)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
587 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
588 int arg;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
589 dxr2_threeArg_t arg3;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
590
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
591 if(dxr2_fd < 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
592 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
593 return VO_ERROR;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
594 }
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 if(playing) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
597 dxr2_send_eof();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
598 flush_dxr2();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
599 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
600 playing = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
601 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
602
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
603 last_freq_id = -1;
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 // Video stream setup
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
606 arg3.arg1 = DXR2_STREAM_VIDEO;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
607 arg3.arg2 = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
608 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
609 if (vo_fps > 28)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
610 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
611 else arg3.arg1 = DXR2_SRC_VIDEO_FREQ_25;
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
612 arg3.arg2 = s_width;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
613 arg3.arg3 = s_height;
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
614 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
615 arg = DXR2_BITSTREAM_TYPE_MPEG_VOB;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
616 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
617
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
618 // Aspect ratio
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
619 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
620 arg = DXR2_ASPECTRATIO_16_9;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
621 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
622 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
623 arg = DXR2_ASPECTRATIO_4_3;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
624 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
625 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
626 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
627 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
628 arg = DXR2_ASPECTRATIO_16_9;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
629 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
630 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
631 arg = DXR2_ASPECTRATIO_4_3;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
632 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
633 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
634 ioctl(dxr2_fd, DXR2_IOC_SET_OUTPUT_ASPECT_RATIO, &arg);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
635
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
636 arg = ar_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
637 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
638
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
639 // TV setup
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
640 arg = mv_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
641 ioctl(dxr2_fd, DXR2_IOC_SET_TV_MACROVISION_MODE, &arg);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
642 arg = _75ire_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
643 ioctl(dxr2_fd, DXR2_IOC_SET_TV_75IRE_MODE, &arg);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
644 arg = bw_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
645 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
646 arg = interlaced_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
647 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
648 arg = pixel_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
649 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
650
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
651 if (norm) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
652 if (strcmp(norm, "ntsc")==0)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
653 arg = DXR2_OUTPUTFORMAT_NTSC;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
654 else if (strcmp(norm, "pal")==0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
655 if (vo_fps > 28) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
656 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
657 arg = DXR2_OUTPUTFORMAT_PAL_60;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
658 norm="pal60";
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
659 } else arg = DXR2_OUTPUTFORMAT_PAL_BDGHI;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
660 } else if (strcmp(norm, "pal60")==0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
661 if (vo_fps > 28)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
662 arg = DXR2_OUTPUTFORMAT_PAL_60;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
663 else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
664 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
665 arg = DXR2_OUTPUTFORMAT_PAL_BDGHI;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
666 norm="pal";
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
667 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
668 } else if (strcmp(norm, "palm")==0)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
669 arg = DXR2_OUTPUTFORMAT_PAL_M;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
670 else if (strcmp(norm, "paln")==0)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
671 arg = DXR2_OUTPUTFORMAT_PAL_N;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
672 else if (strcmp(norm, "palnc")==0)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
673 arg = DXR2_OUTPUTFORMAT_PAL_Nc;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
674 else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
675 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
676 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
677 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
678 norm="ntsc";
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
679 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
680 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
681 if (vo_fps > 28) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
682 arg = DXR2_OUTPUTFORMAT_NTSC;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
683 norm="ntsc";
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
684 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
685 arg = DXR2_OUTPUTFORMAT_PAL_BDGHI;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
686 norm="pal";
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
687 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
688 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
689 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
690 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
691
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
692 // 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
693
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
694 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
695 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
696 arg3.arg1 = DXR2_STREAM_SUBPICTURE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
697 arg3.arg2 = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
698 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
699
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
700 // Audio
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
701 arg = iec958_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
702 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
703 arg = DXR2_AUDIO_WIDTH_16;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
704 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
705 arg = DXR2_AUDIO_FREQ_48;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
706 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
707 arg3.arg1 = DXR2_STREAM_AUDIO_LPCM;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
708 arg3.arg2 = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
709 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
710 arg = 19;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
711 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
712 arg = mute_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
713 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
714
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
715 // Overlay
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
716 while(use_ol) {
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
717 dxr2_twoArg_t win;
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
718 dxr2_oneArg_t om;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
719 int cc = vo_config_count;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
720 vo_config_count = sub_config_count;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
721 if(!dxr2_setup_vga_params()) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
722 sub_vo->uninit();
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
723 sub_vo = NULL;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
724 vo_config_count = cc;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
725 break;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
726 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
727 if(strcmp(sub_vo->get_info()->short_name,"x11") != 0) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
728 sub_vo->uninit();
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
729 vo_config_count = cc;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
730 sub_vo = NULL;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
731 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
732
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
733 while(sub_vo) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
734 dxr2_sixArg_t oc;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
735 int i,sub_flags = VOFLAG_SWSCALE | (flags & VOFLAG_FULLSCREEN);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
736 if(sub_vo->config(width,height,width,height,sub_flags,
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
737 "MPlayer DXR2 render",IMGFMT_BGR24,NULL) != 0) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
738 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
739 sub_vo->uninit();
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
740 sub_vo = NULL;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
741 break;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
742 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
743 sub_config_count++;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
744
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
745 // Feel free to try some other other color and report your results
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
746 oc.arg1 = 0x40;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
747 oc.arg2 = 0xff;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
748 oc.arg3 = 0x00;
6220
dc29d4236bdc Raise the colorkey tolerence
albeu
parents: 6181
diff changeset
749 oc.arg4 = 0x20;
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
750 oc.arg5 = 0x40;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
751 oc.arg6 = 0xff;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
752 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_COLOUR, &oc);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
753
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
754 om.arg = DXR2_OVERLAY_WINDOW_COLOUR_KEY;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
755 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_MODE,&om);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
756 sub_img = malloc(width*height*3);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
757 for(i = 0 ; i < width*height*3 ; i += 3) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
758 sub_img[i] = 255;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
759 sub_img[i+1] = 0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
760 sub_img[i+2] = 255;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
761 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
762 aspect = ((1<<16)*width + height/2)/height;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
763 sub_w = sub_h = 0;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
764 dxr2_set_overlay_window();
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
765 break;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
766 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
767 vo_config_count = cc;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
768 if(!sub_vo) { // Fallback on non windowed overlay
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
769 om.arg = DXR2_OVERLAY_WINDOW_KEY;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
770 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_MODE,&om);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
771 win.arg1 = flags & VOFLAG_FULLSCREEN ? vo_screenwidth : width;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
772 win.arg2 = flags & VOFLAG_FULLSCREEN ? vo_screenheight : height;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
773 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_DIMENSION, &win);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
774 win.arg1 = (vo_screenwidth - win.arg1) / 2;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
775 win.arg2 = (vo_screenheight - win.arg2) / 2;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
776 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_POSITION,&win);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
777 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
778 break;
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
779 }
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
780 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
781 movie_w = width;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
782 movie_h = height;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
783
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
784 // start playing
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
785 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
786 playing = 1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
787 return 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
788 } else
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
789 return VO_ERROR;
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 static const vo_info_t* get_info(void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
793 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
794 return &vo_info;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
795 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
796
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
797 static void draw_osd(void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
798 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
799 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
800
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
801 static uint32_t draw_frame(uint8_t * src[])
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
802 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
803 vo_mpegpes_t *p=(vo_mpegpes_t *)src[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
804 if(p->id == 0x1E0) {// Video
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
805 dxr2_send_packet(p->data, p->size, p->id, p->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
806 } 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
807 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
808 return 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
809 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
810
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
811 static void flip_page (void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
812 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
813 }
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 static uint32_t draw_slice( uint8_t *srcimg[], int stride[], int w, int h, int x0, int y0 )
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
816 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
817 return 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
818 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
819
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
820
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
821 static uint32_t query_format(uint32_t format)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
822 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
823 if (format==IMGFMT_MPEGPES)
6074
10a30eebafaf Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents: 6070
diff changeset
824 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
825 return 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
826 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
827
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
828
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
829 static void query_vaa(vo_vaa_t *vaa) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
830 memset(vaa,0,sizeof(vo_vaa_t));
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
831 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
832
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
833 static void uninit(void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
834 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
835 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
836
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
837 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
838 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
839 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
840 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
841 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
842 }
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
843 close(dxr2_fd);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
844 dxr2_fd = -1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
845 }
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
846 if(sub_img) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
847 free(sub_img);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
848 sub_img = NULL;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
849 }
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
850 if(sub_vo) {
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
851 int cc = vo_config_count;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
852 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
853 sub_vo->uninit();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
854 sub_vo = NULL;
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
855 vo_config_count = cc;
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
856 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
857 }
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 static void check_events(void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
861 {
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
862 // 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
863 // 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
864 #ifdef X11_FULLSCREEN
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
865 if(sub_vo) {
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
866 int e=vo_x11_check_events(mDisplay);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
867 if ( !(e&VO_EVENT_RESIZE) && !(e&VO_EVENT_EXPOSE) ) return;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
868 XSetBackground(mDisplay, vo_gc, 0);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
869 XClearWindow(mDisplay, vo_window);
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
870 dxr2_set_overlay_window();
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
871 }
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
872 #endif
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
873 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
874
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
875 static uint32_t preinit(const char *arg) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
876 int uCodeFD = -1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
877 int uCodeSize;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
878 dxr2_uCode_t* uCode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
879 dxr2_fourArg_t crop;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
880 int n=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
881
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
882 sub_vo = NULL;
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
883 sub_config_count = 0;
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
884 if(use_ol) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
885 if (arg) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
886 for(n = 0 ; video_out_drivers[n] != NULL ; n++) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
887 const vo_info_t* vi = video_out_drivers[n]->get_info();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
888 if(!vi)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
889 continue;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
890 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
891 break;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
892 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
893 sub_vo = video_out_drivers[n];
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
894 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
895 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
896 use_ol = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
897 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
898 }
6070
bad23f7960f1 10L Crash if no subdriver given and overlay enabled
albeu
parents: 6069
diff changeset
899
bad23f7960f1 10L Crash if no subdriver given and overlay enabled
albeu
parents: 6069
diff changeset
900 if(!sub_vo) {
bad23f7960f1 10L Crash if no subdriver given and overlay enabled
albeu
parents: 6069
diff changeset
901 if(use_ol)
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
902 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
903 use_ol = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
904 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
905 if(sub_vo->preinit(NULL) != 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
906 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
907 sub_vo = NULL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
908 use_ol = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
909 } else
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
910 mp_msg(MSGT_VO,MSGL_V,"VO: [dxr2] Sub vo %s inited\n",arg);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
911 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
912
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
913 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
914 if( dxr2_fd < 0 ) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
915 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
916 return VO_ERROR;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
917 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
918
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
919 if(ucode)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
920 uCodeFD = open(ucode, O_RDONLY);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
921 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
922 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
923 ucodesearchpath[n]);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
924 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
925 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
926 break;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
927 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
928 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
929 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
930 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
931 if (uCodeFD < 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
932 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
933 return VO_ERROR;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
934 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
935
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
936 uCodeSize = lseek(uCodeFD, 0, SEEK_END);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
937 if ((uCode = malloc(uCodeSize + 4)) == NULL) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
938
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
939 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
940 return VO_ERROR;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
941 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
942 lseek(uCodeFD, 0, SEEK_SET);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
943 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
944
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
945 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
946 return VO_ERROR;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
947 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
948 close(uCodeFD);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
949 uCode->uCodeLength = uCodeSize;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
950
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
951 // upload ucode
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
952 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
953
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
954 // reset card
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
955 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
956 playing = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
957
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
958 if(!use_ol) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
959 crop.arg1=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
960 crop.arg2=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
961 crop.arg3=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
962 crop.arg4=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
963 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
964 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
965 return 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
966 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
967
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
968 static uint32_t control(uint32_t request, void *data, ...)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
969 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
970 switch (request) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
971 case VOCTRL_QUERY_FORMAT:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
972 return query_format(*((uint32_t*)data));
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
973 case VOCTRL_PAUSE:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
974 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
975 return VO_TRUE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
976 case VOCTRL_RESUME:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
977 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
978 return VO_TRUE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
979 case VOCTRL_RESET:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
980 flush_dxr2();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
981 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
982 return VO_TRUE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
983 case VOCTRL_FULLSCREEN:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
984 if(!use_ol)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
985 return VO_NOTIMPL;
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
986 else if(sub_vo)
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
987 return sub_vo->control(VOCTRL_FULLSCREEN,0);
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
988 else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
989 dxr2_twoArg_t win;
6181
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
990 vo_fs = !vo_fs;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
991 win.arg1 = vo_fs ? vo_screenwidth : movie_w;
b2938a374993 Overlay in a window (only with x11 subdriver)
albeu
parents: 6111
diff changeset
992 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
993 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
994 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
995 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
996 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
997 return VO_TRUE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
998 }
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
999 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
1000 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
1001 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
1002 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
1003 }
582960ab7cc7 Workaround the bug in x11 vo's (if it's one) wich let a window in the way
albeu
parents: 6074
diff changeset
1004 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
1005 }
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
1006 case VOCTRL_QUERY_VAA:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
1007 query_vaa((vo_vaa_t*)data);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
1008 return VO_TRUE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
1009 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
1010 return VO_NOTIMPL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
1011 }