annotate libvo/vo_dxr2.c @ 6086:ad794ccafc55

devfs fallback support?
author arpi
date Mon, 13 May 2002 22:10:11 +0000
parents 10a30eebafaf
children 582960ab7cc7
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
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
21 #include <dxr2ioctl.h>
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
22
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
23 LIBVO_EXTERN (dxr2)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
24
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
25 extern float monitor_aspect;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
26 extern float movie_aspect;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
27
6074
10a30eebafaf Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents: 6070
diff changeset
28 int dxr2_fd = -1;
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
29
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
30 static int movie_w,movie_h;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
31 static int fs = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
32 static int playing = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
33 static int last_freq_id = -1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
34
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
35 // 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
36 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
37
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
38
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
39 static int use_ol = 1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
40 static char *norm = NULL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
41 static char *ucode = NULL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
42 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
43 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
44 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
45 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
46 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
47 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
48 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
49 static int mute_mode = DXR2_AUDIO_MUTE_OFF;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
50
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
51 static config_t dxr2_opts[] = {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
52 { "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
53 { "nooverlay", &use_ol, 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
54 { "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
55
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
56 { "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
57
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
58 { "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
59
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
60 { "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
61
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
62 { "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
63 { "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
64
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
65 { "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
66 { "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
67
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
68 { "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
69 { "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
70
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
71 { "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
72 { "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
73
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
74 { "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
75 { "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
76
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
77 { "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
78 { "nomute",&mute_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
79 { 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
80 };
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 static config_t dxr2_opt[] = {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
83 { "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
84 { 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
85 };
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
86
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
87 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
88 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
89 }
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 static vo_info_t vo_info = {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
92 "DXR2 video out",
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
93 "dxr2",
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
94 "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
95 ""
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
96 };
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
97
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
98 static char *ucodesearchpath[] = {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
99 "/usr/local/lib/dxr2/dvd12.ux",
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
100 "/usr/lib/dxr2/dvd12.ux",
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
101 "/usr/src/dvd12.ux",
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
102 NULL,
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
103 };
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
104
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
105 #define BUF_SIZE 2048
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 static unsigned char dxr2buf[BUF_SIZE];
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
108 static unsigned int dxr2bufpos = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
109
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
110 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
111 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
112 int w = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
113 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
114 memcpy(dxr2buf+dxr2bufpos, data, len);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
115 dxr2bufpos+=len;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
116 len=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
117 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
118 int copylen=BUF_SIZE-dxr2bufpos;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
119 if(copylen > 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
120 memcpy(dxr2buf+dxr2bufpos, data, copylen);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
121 dxr2bufpos += copylen;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
122 data+=copylen;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
123 len-=copylen;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
124 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
125 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
126 if(w < 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
127 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
128 dxr2bufpos = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
129 break;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
130 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
131 dxr2bufpos -= w;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
132 if(dxr2bufpos)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
133 memmove(dxr2buf,dxr2buf + w,dxr2bufpos);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
134 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
135 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
136
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
137 static void flush_dxr2()
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
138 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
139 int w;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
140 while (dxr2bufpos) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
141 w = write(dxr2_fd, dxr2buf, dxr2bufpos);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
142 if(w < 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
143 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
144 dxr2bufpos = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
145 break;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
146 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
147 dxr2bufpos -= w;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
148 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
149 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
150
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
151 #define PACK_MAX_SIZE 2048
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
152
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
153 static unsigned char pack[PACK_MAX_SIZE];
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
154
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
155 static unsigned char mpg_header[]={
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
156 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
157 0x04, 0x01, 0x01, 0x86, 0xa3, 0xf8
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
158 };
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
159
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
160 static unsigned char mpg_eof[]={
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
161 0x00, 0x00, 0x01, 0xb9
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
162 };
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 static void dxr2_send_header(void)
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 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
167 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
168
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
169 static void dxr2_send_eof(void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
170 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
171 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
172 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
173
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
174 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
175 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
176 int ptslen=5;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
177
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
178 if(dxr2_fd < 0) {
6074
10a30eebafaf Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents: 6070
diff changeset
179 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
180 return;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
181 }
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 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
184 dxr2_send_header();
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 // startcode:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
187 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
188 // stream id
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
189 pack[3]=id;
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 while(len>0){
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
192 int payload_size=len; // data + PTS
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
193 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
194
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
195 // 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
196 // packetsize:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
197 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
198 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
199
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
200 pack[6]=0x81;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
201 if(ptslen){
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
202 int x;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
203 pack[7]=0x80;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
204 pack[8]=ptslen;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
205 // presentation time stamp:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
206 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
207 pack[9]=x;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
208 x=((((timestamp >> 15) & 0x7fff) << 1) | 1);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
209 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
210 x=((((timestamp) & 0x7fff) << 1) | 1);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
211 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
212 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
213 pack[7]=0x00;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
214 pack[8]=0x00;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
215 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
216
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
217 write_dxr2(pack, 9+ptslen);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
218 write_dxr2(data, payload_size);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
219
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
220 len-=payload_size; data+=payload_size;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
221 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
222 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
223 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
224
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
225 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
226 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
227 int arg;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
228 int ptslen=5;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
229
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
230 if(dxr2_fd < 0) {
6074
10a30eebafaf Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents: 6070
diff changeset
231 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
232 return;
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
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
235 if(last_freq_id != freq_id) {
6074
10a30eebafaf Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents: 6070
diff changeset
236 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
237 last_freq_id = freq_id;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
238 }
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 if (((int) timestamp)<0)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
241 timestamp=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
242
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
243 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
244 // startcode:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
245 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
246
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
247 // stream id
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
248 pack[3]=0xBD;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
249
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
250 while(len>=4){
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
251 int payload_size;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
252
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
253 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
254 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
255 payload_size&=(~3); // align!
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 // packetsize:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
258 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
259 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
260
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
261 // stuffing:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
262 pack[6]=0x81;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
263 // pack[7]=0x00; //0x80
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
264
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
265 // hdrlen:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
266 pack[8]=ptslen;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
267
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
268 if(ptslen){
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
269 int x;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
270 pack[7]=0x80;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
271 // presentation time stamp:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
272 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
273 pack[9]=x;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
274 x=((((timestamp >> 15) & 0x7fff) << 1) | 1);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
275 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
276 x=((((timestamp) & 0x7fff) << 1) | 1);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
277 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
278 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
279 pack[7]=0x00;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
280 }
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 // ============ LPCM header: (7 bytes) =================
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
283 // Info by mocm@convergence.de
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 // ID:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
286 pack[ptslen+9]=id;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
287
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
288 // number of frames:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
289 pack[ptslen+10]=0x07;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
290
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
291 // 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
292 pack[ptslen+11]=0x00;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
293 pack[ptslen+12]=0x04;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
294
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
295 // audio emphasis on-off 1 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
296 // audio mute on-off 1 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
297 // reserved 1 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
298 // audio frame number 5 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
299 pack[ptslen+13]=0x0C;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
300
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
301 // quantization word length 2 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
302 // 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
303 // reserved 1 bit
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
304 // 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
305 pack[ptslen+14]=1;
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
306
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
307 // dynamic range control (0x80 if off)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
308 pack[ptslen+15]=0x80;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
309
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
310 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
311 write_dxr2(data, payload_size);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
312
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
313 len-=payload_size; data+=payload_size;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
314 timestamp+=90000/4*payload_size/48000;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
315 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
316 }
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 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
319 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
320 int arg;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
321 dxr2_threeArg_t arg3;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
322
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
323 if(dxr2_fd < 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
324 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
325 return VO_ERROR;
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
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
328 if(playing) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
329 dxr2_send_eof();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
330 flush_dxr2();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
331 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
332 playing = 0;
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
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
335 last_freq_id = -1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
336
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
337 // Video stream setup
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
338 arg3.arg1 = DXR2_STREAM_VIDEO;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
339 arg3.arg2 = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
340 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
341 if (vo_fps > 28)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
342 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
343 else arg3.arg1 = DXR2_SRC_VIDEO_FREQ_25;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
344 arg3.arg2 = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
345 arg3.arg3 = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
346 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
347 arg = DXR2_BITSTREAM_TYPE_MPEG_VOB;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
348 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
349
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
350 // Aspect ratio
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
351 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
352 arg = DXR2_ASPECTRATIO_16_9;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
353 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
354 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
355 arg = DXR2_ASPECTRATIO_4_3;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
356 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
357 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
358 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
359 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
360 arg = DXR2_ASPECTRATIO_16_9;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
361 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
362 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
363 arg = DXR2_ASPECTRATIO_4_3;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
364 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
365 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
366 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
367
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
368 arg = ar_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
369 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
370
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
371 // TV setup
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
372 arg = mv_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
373 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
374 arg = _75ire_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
375 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
376 arg = bw_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
377 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
378 arg = interlaced_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
379 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
380 arg = pixel_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
381 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
382
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
383 if (norm) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
384 if (strcmp(norm, "ntsc")==0)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
385 arg = DXR2_OUTPUTFORMAT_NTSC;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
386 else if (strcmp(norm, "pal")==0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
387 if (vo_fps > 28) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
388 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
389 arg = DXR2_OUTPUTFORMAT_PAL_60;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
390 norm="pal60";
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
391 } else arg = DXR2_OUTPUTFORMAT_PAL_BDGHI;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
392 } else if (strcmp(norm, "pal60")==0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
393 if (vo_fps > 28)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
394 arg = DXR2_OUTPUTFORMAT_PAL_60;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
395 else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
396 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
397 arg = DXR2_OUTPUTFORMAT_PAL_BDGHI;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
398 norm="pal";
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
399 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
400 } else if (strcmp(norm, "palm")==0)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
401 arg = DXR2_OUTPUTFORMAT_PAL_M;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
402 else if (strcmp(norm, "paln")==0)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
403 arg = DXR2_OUTPUTFORMAT_PAL_N;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
404 else if (strcmp(norm, "palnc")==0)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
405 arg = DXR2_OUTPUTFORMAT_PAL_Nc;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
406 else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
407 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
408 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
409 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
410 norm="ntsc";
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
411 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
412 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
413 if (vo_fps > 28) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
414 arg = DXR2_OUTPUTFORMAT_NTSC;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
415 norm="ntsc";
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
416 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
417 arg = DXR2_OUTPUTFORMAT_PAL_BDGHI;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
418 norm="pal";
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
419 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
420 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
421 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
422 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
423
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
424 // Subtitles
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
425 arg3.arg1 = DXR2_STREAM_SUBPICTURE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
426 arg3.arg2 = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
427 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
428
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
429 // Audio
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
430 arg = iec958_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
431 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
432 arg = DXR2_AUDIO_WIDTH_16;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
433 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
434 arg = DXR2_AUDIO_FREQ_48;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
435 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
436 arg3.arg1 = DXR2_STREAM_AUDIO_LPCM;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
437 arg3.arg2 = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
438 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
439 arg = 19;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
440 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
441 arg = mute_mode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
442 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
443
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
444 // Overlay
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
445 if(use_ol) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
446 dxr2_twoArg_t win;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
447 win.arg1 = flags & VOFLAG_FULLSCREEN ? vo_screenwidth : width;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
448 win.arg2 = flags & VOFLAG_FULLSCREEN ? vo_screenheight : height;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
449 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
450 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
451 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
452 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
453 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
454 fs = flags & VOFLAG_FULLSCREEN ? 1 : 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
455 movie_w = width;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
456 movie_h = height;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
457
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
458 // start playing
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
459 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
460 playing = 1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
461 return 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
462 } else
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
463 return VO_ERROR;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
464 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
465
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
466 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
467 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
468 return &vo_info;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
469 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
470
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
471 static void draw_osd(void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
472 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
473 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
474
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
475 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
476 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
477 vo_mpegpes_t *p=(vo_mpegpes_t *)src[0];
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
478 dxr2_send_packet(p->data, p->size, p->id, p->timestamp);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
479
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
480 return 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
481 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
482
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
483 static void flip_page (void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
484 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
485 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
486
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
487 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
488 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
489 return 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
490 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
491
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
492
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
493 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
494 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
495 if (format==IMGFMT_MPEGPES)
6074
10a30eebafaf Applied patch from Tobias Diedrich <ranma@gmx.at>, added volume setting
albeu
parents: 6070
diff changeset
496 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
497 return 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
498 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
499
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
500
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
501 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
502 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
503 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
504
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
505 static void uninit(void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
506 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
507 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
508
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
509 dxr2_send_eof();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
510 flush_dxr2();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
511 if (dxr2_fd > 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
512 close(dxr2_fd);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
513 dxr2_fd = -1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
514 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
515 if(sub_vo) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
516 sub_vo->uninit();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
517 sub_vo = NULL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
518 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
519 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
520
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
521
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
522 static void check_events(void)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
523 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
524 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
525
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
526 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
527 int uCodeFD = -1;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
528 int uCodeSize;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
529 dxr2_uCode_t* uCode;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
530 dxr2_fourArg_t crop;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
531 int n=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
532
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
533 sub_vo = NULL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
534 if(use_ol) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
535 if (arg) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
536 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
537 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
538 if(!vi)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
539 continue;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
540 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
541 break;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
542 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
543 sub_vo = video_out_drivers[n];
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
544 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
545 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
546 use_ol = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
547 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
548 }
6070
bad23f7960f1 10L Crash if no subdriver given and overlay enabled
albeu
parents: 6069
diff changeset
549
bad23f7960f1 10L Crash if no subdriver given and overlay enabled
albeu
parents: 6069
diff changeset
550 if(!sub_vo) {
bad23f7960f1 10L Crash if no subdriver given and overlay enabled
albeu
parents: 6069
diff changeset
551 if(use_ol)
6069
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
552 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
553 use_ol = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
554 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
555 if(sub_vo->preinit(NULL) != 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
556 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
557 sub_vo = NULL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
558 use_ol = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
559 } else
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
560 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
561 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
562
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
563 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
564 if( dxr2_fd < 0 ) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
565 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
566 return VO_ERROR;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
567 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
568
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
569 if(ucode)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
570 uCodeFD = open(ucode, O_RDONLY);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
571 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
572 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
573 ucodesearchpath[n]);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
574 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
575 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
576 break;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
577 } else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
578 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
579 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
580 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
581 if (uCodeFD < 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
582 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
583 return VO_ERROR;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
584 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
585
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
586 uCodeSize = lseek(uCodeFD, 0, SEEK_END);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
587 if ((uCode = malloc(uCodeSize + 4)) == NULL) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
588
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
589 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
590 return VO_ERROR;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
591 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
592 lseek(uCodeFD, 0, SEEK_SET);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
593 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
594
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
595 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
596 return VO_ERROR;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
597 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
598 close(uCodeFD);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
599 uCode->uCodeLength = uCodeSize;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
600
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
601 // upload ucode
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
602 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
603
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
604 // reset card
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
605 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
606 playing = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
607
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
608 if(!use_ol) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
609 crop.arg1=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
610 crop.arg2=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
611 crop.arg3=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
612 crop.arg4=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
613 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
614 } else while(1) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
615 // Init the overlay, don't ask me how it work ;-)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
616 dxr2_sixArg_t oc;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
617 dxr2_oneArg_t om;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
618 dxr2_vgaParams_t vga;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
619 dxr2_twoArg_t win;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
620
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
621 // First we need a white screen
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
622 uint8_t* img = malloc(vo_screenwidth*vo_screenheight*3);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
623 uint8_t* src[] = { img, NULL, NULL };
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
624
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
625 memset(img,255,vo_screenwidth*vo_screenheight*3);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
626
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
627 if(sub_vo->config(vo_screenwidth,vo_screenheight,vo_screenwidth,vo_screenheight,
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
628 VOFLAG_FULLSCREEN ,"DXR2 sub vo",IMGFMT_BGR24,NULL) != 0) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
629 mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] sub vo config failed => No overlay\n");
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
630 sub_vo->uninit();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
631 sub_vo = NULL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
632 use_ol = 0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
633 break;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
634 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
635 sub_vo->draw_frame(src);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
636 sub_vo->flip_page();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
637 free(img);
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 crop.arg1=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
640 crop.arg2=0;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
641 crop.arg3=55;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
642 crop.arg4=300;
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_OVERLAY_CROPPING, &crop);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
644
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
645 oc.arg1 = 0x40;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
646 oc.arg2 = 0xff;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
647 oc.arg3 = 0x40;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
648 oc.arg4 = 0xff;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
649 oc.arg5 = 0x40;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
650 oc.arg6 = 0xff;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
651 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_COLOUR, &oc);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
652
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
653 om.arg = 1000;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
654 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_RATIO,&om);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
655
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
656 win.arg1 = 100;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
657 win.arg2 = 3;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
658 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
659
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
660 win.arg1 = vo_screenwidth;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
661 win.arg2 = vo_screenheight;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
662 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
663
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
664 om.arg = 3;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
665 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_IN_DELAY,&om);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
666
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
667 om.arg = DXR2_OVERLAY_WINDOW_COLOUR_KEY;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
668 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_MODE,&om);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
669
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
670 vga.xScreen = vo_screenwidth;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
671 vga.yScreen = vo_screenheight;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
672 vga.hOffWinKey = 100;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
673 vga.vOffWinKey = 3;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
674 ioctl(dxr2_fd, DXR2_IOC_CALCULATE_VGA_PARAMETERS, &vga);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
675 ioctl(dxr2_fd, DXR2_IOC_SET_VGA_PARAMETERS, &vga);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
676
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
677 // Remove the white screen
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
678 sub_vo->check_events(); // at least x11 need this to remove his window
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
679 sub_vo->uninit();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
680 sub_vo = NULL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
681
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
682 om.arg = DXR2_OVERLAY_WINDOW_KEY;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
683 ioctl(dxr2_fd, DXR2_IOC_SET_OVERLAY_MODE,&om);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
684
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
685 break;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
686 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
687 return 0;
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
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
690 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
691 {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
692 switch (request) {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
693 case VOCTRL_QUERY_FORMAT:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
694 return query_format(*((uint32_t*)data));
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
695 case VOCTRL_PAUSE:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
696 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
697 return VO_TRUE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
698 case VOCTRL_RESUME:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
699 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
700 return VO_TRUE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
701 case VOCTRL_RESET:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
702 flush_dxr2();
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
703 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
704 return VO_TRUE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
705 case VOCTRL_FULLSCREEN:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
706 if(!use_ol)
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
707 return VO_NOTIMPL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
708 else {
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
709 dxr2_twoArg_t win;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
710 fs = !fs;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
711 win.arg1 = fs ? vo_screenwidth : movie_w;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
712 win.arg2 = fs ? vo_screenheight : movie_h;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
713 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
714 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
715 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
716 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
717 return VO_TRUE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
718 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
719 case VOCTRL_QUERY_VAA:
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
720 query_vaa((vo_vaa_t*)data);
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
721 return VO_TRUE;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
722 }
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
723 return VO_NOTIMPL;
8e88e92fe331 Initial support for dxr2. Based on patch from Tobias Diedrich <ranma@gmx.at>.
albeu
parents:
diff changeset
724 }