Mercurial > mplayer.hg
annotate libvo/vo_dxr3.c @ 34600:19398061c204
Free playlist and URL list items when GUI ends.
author | ib |
---|---|
date | Sat, 11 Feb 2012 20:43:02 +0000 |
parents | 81f71d910333 |
children | 389d43c448b3 |
rev | line source |
---|---|
6748
c0e8034d47e4
Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents:
6647
diff
changeset
|
1 /* |
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
2 * DXR3/H+ video output |
2645 | 3 * |
8924
e0ec616c5985
Added patch from Tamas Kohegyi to fix subpic placement with freetype
mswitch
parents:
8728
diff
changeset
|
4 * Copyright (C) 2002-2003 David Holm <david@realityrift.com> |
2645 | 5 * |
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
6 * This file is part of MPlayer. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
7 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
11 * (at your option) any later version. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
12 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
16 * GNU General Public License for more details. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
17 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
27903
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
2645 | 21 */ |
22 | |
2921 | 23 #include <linux/em8300.h> |
24 #include <sys/ioctl.h> | |
25 #include <sys/stat.h> | |
26 #include <sys/types.h> | |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
27 #include <sys/select.h> |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
28 #include <unistd.h> |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
29 #include <stdio.h> |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
30 #include <stdlib.h> |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
31 #include <string.h> |
2921 | 32 #include <fcntl.h> |
2645 | 33 #include <stdio.h> |
34 #include <time.h> | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
35 #include <math.h> |
2645 | 36 |
37 #include "config.h" | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
38 #include "mp_msg.h" |
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
39 #include "help_mp.h" |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
40 #include "fastmemcpy.h" |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
41 |
2645 | 42 #include "video_out.h" |
43 #include "video_out_internal.h" | |
33301
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
44 #include "libmpcodecs/vf.h" |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
45 #include "aspect.h" |
32470 | 46 #include "sub/spuenc.h" |
32467 | 47 #include "sub/sub.h" |
27343 | 48 #ifdef CONFIG_GUI |
23077 | 49 #include "gui/interface.h" |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
50 #endif |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
51 #ifdef CONFIG_X11 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
52 #include "x11_common.h" |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
53 #endif |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23655
diff
changeset
|
54 #include "libavutil/avstring.h" |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
55 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
56 #define SPU_SUPPORT |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
57 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
58 static const vo_info_t info = |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
59 { |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
60 "DXR3/H+ video out", |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
61 "dxr3", |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
62 "David Holm <dholm@iname.com>", |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
63 "" |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
64 }; |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
65 const LIBVO_EXTERN (dxr3) |
5377 | 66 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
67 /* Resolutions and positions */ |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
68 static int v_width, v_height; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
69 static int s_width, s_height; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
70 static int osd_w, osd_h; |
8724 | 71 static int img_format; |
3329
529a001496c2
Switched from rte which caused alot of problems for some users to libmp1e.
mswitch
parents:
3232
diff
changeset
|
72 |
8088 | 73 /* Configuration values |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
74 * Don't declare these static, they |
8088 | 75 * should be accessible from the gui. |
76 */ | |
77 int dxr3_prebuf = 0; | |
78 int dxr3_newsync = 0; | |
79 int dxr3_overlay = 0; | |
80 int dxr3_device_num = 0; | |
8549 | 81 int dxr3_norm = 0; |
8088 | 82 |
12646 | 83 #define MAX_STR_SIZE 80 /* length for the static strings */ |
84 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
85 /* File descriptors */ |
2921 | 86 static int fd_control = -1; |
87 static int fd_video = -1; | |
88 static int fd_spu = -1; | |
12646 | 89 static char fdv_name[MAX_STR_SIZE]; |
90 static char fds_name[MAX_STR_SIZE]; | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
91 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
92 #ifdef SPU_SUPPORT |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
93 /* on screen display/subpics */ |
8724 | 94 static char *osdpicbuf; |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
95 static int osdpicbuf_w; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
96 static int osdpicbuf_h; |
8724 | 97 static int disposd; |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
98 static encodedata *spued; |
7950 | 99 static encodedata *spubuf; |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
100 #endif |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
101 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
102 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
103 /* Static variable used in ioctl's */ |
8724 | 104 static int ioval; |
105 static int prev_pts; | |
106 static int pts_offset; | |
8722
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
107 static int old_vmode = -1; |
2645 | 108 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
109 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
110 /* Begin overlay.h */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
111 /* |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
112 Simple analog overlay API for DXR3/H+ linux driver. |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
113 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
114 Henrik Johansson |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
115 */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
116 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
117 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
118 /* Pattern drawing callback used by the calibration functions. |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
119 The function is expected to: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
120 Clear the entire screen. |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
121 Fill the screen with color bgcol (0xRRGGBB) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
122 Draw a rectangle at (xpos,ypos) of size (width,height) in fgcol (0xRRGGBB) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
123 */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
124 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
125 typedef int (*pattern_drawer_cb)(int fgcol, int bgcol, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
126 int xpos, int ypos, int width, int height, void *arg); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
127 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
128 struct coeff { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
129 float k,m; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
130 }; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
131 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
132 typedef struct { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
133 int dev; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
134 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
135 int xres, yres,depth; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
136 int xoffset,yoffset,xcorr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
137 int jitter; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
138 int stability; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
139 int keycolor; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
140 struct coeff colcal_upper[3]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
141 struct coeff colcal_lower[3]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
142 float color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
143 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
144 pattern_drawer_cb draw_pattern; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
145 void *dp_arg; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
146 } overlay_t; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
147 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
148 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
149 static overlay_t *overlay_init(int dev); |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
150 static int overlay_release(overlay_t *); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
151 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
152 static int overlay_read_state(overlay_t *o, char *path); |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
153 static int overlay_write_state(overlay_t *o, char *path); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
154 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
155 static int overlay_set_screen(overlay_t *o, int xres, int yres, int depth); |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
156 static int overlay_set_mode(overlay_t *o, int mode); |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
157 static int overlay_set_attribute(overlay_t *o, int attribute, int val); |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
158 static int overlay_set_keycolor(overlay_t *o, int color); |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
159 static int overlay_set_window(overlay_t *o, int xpos,int ypos,int width,int height); |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
160 static int overlay_set_bcs(overlay_t *o, int brightness, int contrast, int saturation); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
161 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
162 static int overlay_autocalibrate(overlay_t *o, pattern_drawer_cb pd, void *arg); |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
163 static void overlay_update_params(overlay_t *o); |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
164 static int overlay_signalmode(overlay_t *o, int mode); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
165 /* End overlay.h */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
166 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
167 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
168 #ifdef CONFIG_X11 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
169 #define KEY_COLOR 0x80a040 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
170 static XWindowAttributes xwin_attribs; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
171 static overlay_t *overlay_data; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
172 #endif |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
173 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
174 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
175 /* Functions for working with the em8300's internal clock */ |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
176 /* End of internal clock functions */ |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
177 |
33305
ddb45e9443ec
Remove the variable arguments from the libvo control() functions.
iive
parents:
33301
diff
changeset
|
178 static int control(uint32_t request, void *data) |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
179 { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
180 switch (request) { |
7009 | 181 case VOCTRL_GUISUPPORT: |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
182 return VO_TRUE; |
7009 | 183 case VOCTRL_GUI_NOWINDOW: |
8088 | 184 if (dxr3_overlay) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
185 return VO_FALSE; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
186 } |
7009 | 187 return VO_TRUE; |
8088 | 188 case VOCTRL_SET_SPU_PALETTE: |
189 if (ioctl(fd_spu, EM8300_IOCTL_SPU_SETPALETTE, data) < 0) { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
190 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_UnableToLoadNewSPUPalette); |
8088 | 191 return VO_ERROR; |
192 } | |
193 return VO_TRUE; | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
194 #ifdef CONFIG_X11 |
11542 | 195 case VOCTRL_ONTOP: |
196 vo_x11_ontop(); | |
197 return VO_TRUE; | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
198 case VOCTRL_FULLSCREEN: |
8088 | 199 if (dxr3_overlay) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
200 vo_x11_fullscreen(); |
16941
aff6d5831e25
Fix compilation, use vo_fs instead of fullscreen variable. Not tested.
reimar
parents:
16171
diff
changeset
|
201 overlay_signalmode(overlay_data, |
aff6d5831e25
Fix compilation, use vo_fs instead of fullscreen variable. Not tested.
reimar
parents:
16171
diff
changeset
|
202 vo_fs ? EM8300_OVERLAY_SIGNAL_ONLY : |
aff6d5831e25
Fix compilation, use vo_fs instead of fullscreen variable. Not tested.
reimar
parents:
16171
diff
changeset
|
203 EM8300_OVERLAY_SIGNAL_WITH_VGA); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
204 return VO_TRUE; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
205 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
206 return VO_FALSE; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
207 #endif |
4754 | 208 case VOCTRL_RESUME: |
8088 | 209 if (dxr3_newsync) { |
210 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval); | |
211 pts_offset = vo_pts - (ioval << 1); | |
212 if (pts_offset < 0) { | |
213 pts_offset = 0; | |
214 } | |
215 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
216 |
8088 | 217 if (dxr3_prebuf) { |
4754 | 218 ioval = EM8300_PLAYMODE_PLAY; |
219 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
220 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToSetPlaymode); |
4754 | 221 } |
222 } | |
223 return VO_TRUE; | |
224 case VOCTRL_PAUSE: | |
8088 | 225 if (dxr3_prebuf) { |
4754 | 226 ioval = EM8300_PLAYMODE_PAUSED; |
227 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
228 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToSetPlaymode); |
4754 | 229 } |
230 } | |
231 return VO_TRUE; | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
232 case VOCTRL_RESET: |
8088 | 233 if (dxr3_prebuf) { |
4605 | 234 close(fd_video); |
235 fd_video = open(fdv_name, O_WRONLY); | |
5499
58864ce0eef7
Fixed bug that would cause the dxr3 to lock if too many subpics were sent at once
mswitch
parents:
5497
diff
changeset
|
236 close(fd_spu); |
58864ce0eef7
Fixed bug that would cause the dxr3 to lock if too many subpics were sent at once
mswitch
parents:
5497
diff
changeset
|
237 fd_spu = open(fds_name, O_WRONLY); |
4609 | 238 fsync(fd_video); |
5499
58864ce0eef7
Fixed bug that would cause the dxr3 to lock if too many subpics were sent at once
mswitch
parents:
5497
diff
changeset
|
239 fsync(fd_spu); |
4605 | 240 } |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
241 return VO_TRUE; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
242 case VOCTRL_QUERY_FORMAT: |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
243 { |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
244 uint32_t flag = 0; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
245 |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
246 if (*((uint32_t*)data) != IMGFMT_MPEGPES) |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
247 return 0; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
248 |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
249 flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_SPU; |
8088 | 250 if (dxr3_prebuf) |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
251 flag |= VFCAP_TIMER; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
252 return flag; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
253 } |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
254 case VOCTRL_SET_EQUALIZER: |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
255 { |
33301
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
256 vf_equalizer_t *eq=data; |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
257 em8300_bcs_t bcs; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
258 |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
259 if (ioctl(fd_control, EM8300_IOCTL_GETBCS, &bcs) < 0) |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
260 return VO_FALSE; |
33301
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
261 if (!strcasecmp(eq->item, "brightness")) |
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
262 bcs.brightness = (eq->value+100)*5; |
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
263 else if (!strcasecmp(eq->item, "contrast")) |
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
264 bcs.contrast = (eq->value+100)*5; |
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
265 else if (!strcasecmp(eq->item, "saturation")) |
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
266 bcs.saturation = (eq->value+100)*5; |
7095
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
267 else return VO_FALSE; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
268 |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
269 if (ioctl(fd_control, EM8300_IOCTL_SETBCS, &bcs) < 0) |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
270 return VO_FALSE; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
271 return VO_TRUE; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
272 } |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
273 case VOCTRL_GET_EQUALIZER: |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
274 { |
33301
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
275 vf_equalizer_t *eq=data; |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
276 em8300_bcs_t bcs; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
277 |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
278 if (ioctl(fd_control, EM8300_IOCTL_GETBCS, &bcs) < 0) |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
279 return VO_FALSE; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
280 |
33301
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
281 if (!strcasecmp(eq->item, "brightness")) |
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
282 eq->value = (bcs.brightness/5)-100; |
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
283 else if (!strcasecmp(eq->item, "contrast")) |
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
284 eq->value = (bcs.contrast/5)-100; |
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
285 else if (!strcasecmp(eq->item, "saturation")) |
899d817e56fc
Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents:
32537
diff
changeset
|
286 eq->value = (bcs.saturation/5)-100; |
7095
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
287 else return VO_FALSE; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
288 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
289 return VO_TRUE; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
290 } |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
291 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
292 return VO_NOTIMPL; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
293 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
294 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
295 void calculate_cvals(unsigned long mask, int *shift, int *prec) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
296 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
297 /* Calculate shift and precision */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
298 (*shift) = 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
299 (*prec) = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
300 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
301 while (!(mask & 0x1)) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
302 (*shift)++; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
303 mask >>= 1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
304 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
305 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
306 while (mask & 0x1) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
307 (*prec)++; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
308 mask >>= 1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
309 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
310 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
311 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
312 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) |
2645 | 313 { |
4754 | 314 int tmp1, tmp2, size; |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
315 em8300_register_t reg; |
6748
c0e8034d47e4
Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents:
6647
diff
changeset
|
316 |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
317 /* Softzoom turned on, downscale */ |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
318 /* This activates the subpicture processor, you can safely disable this and still send */ |
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
319 /* broken subpics to the em8300, if it's enabled and you send broken subpics you will end */ |
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
320 /* up in a lockup */ |
4160 | 321 ioval = EM8300_SPUMODE_ON; |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
322 if (ioctl(fd_control, EM8300_IOCTL_SET_SPUMODE, &ioval) < 0) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
323 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToSetSubpictureMode); |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
324 uninit(); |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
325 return -1; |
3201 | 326 } |
327 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
328 /* Set the playmode to play (just in case another app has set it to something else) */ |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
329 ioval = EM8300_PLAYMODE_PLAY; |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
330 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
331 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToSetPlaymode); |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
332 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
333 |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
334 /* Start em8300 prebuffering and sync engine */ |
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
335 reg.microcode_register = 1; |
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
336 reg.reg = 0; |
8317 | 337 reg.val = MVCOMMAND_SYNC; |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
338 ioctl(fd_control, EM8300_IOCTL_WRITEREG, ®); |
6618 | 339 |
4607
da09673aea00
Removed some stuff from the em8300 driver, had to compensate
mswitch
parents:
4605
diff
changeset
|
340 /* Clean buffer by syncing it */ |
4609 | 341 ioval = EM8300_SUBDEVICE_VIDEO; |
342 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval); | |
343 ioval = EM8300_SUBDEVICE_AUDIO; | |
344 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval); | |
6618 | 345 |
7950 | 346 /* Sync the video device to make sure the buffers are empty |
347 * and set the playback speed to normal. Also reset the | |
348 * em8300 internal clock. | |
349 */ | |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
350 fsync(fd_video); |
7950 | 351 ioval = 0x900; |
352 ioctl(fd_control, EM8300_IOCTL_SCR_SETSPEED, &ioval); | |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
353 |
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
354 /* Store some variables statically that we need later in another scope */ |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
355 img_format = format; |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
356 v_width = width; |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
357 v_height = height; |
2866
4f6190ab52e7
Added a temporary fix to the DXR3 win32 codec playback, win32 codecs might prove to play back an unscaled image!
mswitch
parents:
2770
diff
changeset
|
358 |
5273
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
359 /* Set monitor_aspect to avoid jitter */ |
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
360 monitor_aspect = (float) width / (float) height; |
8722
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
361 |
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
362 if (ioctl(fd_control, EM8300_IOCTL_GET_VIDEOMODE, &old_vmode) < 0) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
363 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToGetTVNorm); |
8722
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
364 old_vmode = -1; |
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
365 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
366 |
8549 | 367 /* adjust TV norm */ |
368 if (dxr3_norm != 0) { | |
369 if (dxr3_norm == 5) { | |
370 ioval = EM8300_VIDEOMODE_NTSC; | |
371 } else if (dxr3_norm == 4) { | |
372 ioval = EM8300_VIDEOMODE_PAL60; | |
373 } else if (dxr3_norm == 3) { | |
374 ioval = EM8300_VIDEOMODE_PAL; | |
375 } else if (dxr3_norm == 2) { | |
376 if (vo_fps > 28) { | |
377 ioval = EM8300_VIDEOMODE_PAL60; | |
378 } else { | |
379 ioval = EM8300_VIDEOMODE_PAL; | |
380 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
381 |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
382 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_AutoSelectedTVNormByFrameRate); |
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
383 ioval == EM8300_VIDEOMODE_PAL60 ? mp_msg(MSGT_VO,MSGL_INFO, "PAL-60") : mp_msg(MSGT_VO,MSGL_INFO, "PAL"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
384 printf(".\n"); |
8722
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
385 } else { |
8549 | 386 if (vo_fps > 28) { |
387 ioval = EM8300_VIDEOMODE_NTSC; | |
388 } else { | |
389 ioval = EM8300_VIDEOMODE_PAL; | |
390 } | |
391 | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
392 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_AutoSelectedTVNormByFrameRate); |
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
393 ioval == EM8300_VIDEOMODE_NTSC ? mp_msg(MSGT_VO,MSGL_INFO, "NTSC") : mp_msg(MSGT_VO,MSGL_INFO, "PAL"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
394 printf(".\n"); |
8549 | 395 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
396 |
8722
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
397 if (old_vmode != ioval) { |
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
398 if (ioctl(fd_control, EM8300_IOCTL_SET_VIDEOMODE, &ioval) < 0) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
399 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToSetTVNorm); |
8722
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
400 } |
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
401 } |
8549 | 402 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
403 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
404 |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
405 /* libavcodec requires a width and height that is x|16 */ |
5281
88df6d5f6ce7
Aspect code reenabled, apparently users didn't like running movies
mswitch
parents:
5275
diff
changeset
|
406 aspect_save_orig(width, height); |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
407 aspect_save_prescale(d_width, d_height); |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
408 ioctl(fd_control, EM8300_IOCTL_GET_VIDEOMODE, &ioval); |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
409 if (ioval == EM8300_VIDEOMODE_NTSC) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
410 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_SettingUpForNTSC); |
5065 | 411 aspect_save_screenres(352, 240); |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
412 } else { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
413 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_SettingUpForPALSECAM); |
5065 | 414 aspect_save_screenres(352, 288); |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
415 } |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
416 aspect(&s_width, &s_height, A_ZOOM); |
5064 | 417 s_width -= s_width % 16; |
5281
88df6d5f6ce7
Aspect code reenabled, apparently users didn't like running movies
mswitch
parents:
5275
diff
changeset
|
418 s_height -= s_height % 16; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
419 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
420 /* Try to figure out whether to use widescreen output or not */ |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
421 /* Anamorphic widescreen modes makes this a pain in the ass */ |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
422 tmp1 = abs(d_height - ((d_width / 4) * 3)); |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
423 tmp2 = abs(d_height - (int) (d_width / 2.35)); |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
424 if (tmp1 < tmp2) { |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
425 ioval = EM8300_ASPECTRATIO_4_3; |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
426 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_SettingAspectRatioTo43); |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
427 } else { |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
428 ioval = EM8300_ASPECTRATIO_16_9; |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
429 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_SettingAspectRatioTo169); |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
430 } |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
431 ioctl(fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval); |
5064 | 432 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
433 #ifdef SPU_SUPPORT |
27393 | 434 #ifdef CONFIG_FREETYPE |
8924
e0ec616c5985
Added patch from Tamas Kohegyi to fix subpic placement with freetype
mswitch
parents:
8728
diff
changeset
|
435 if (ioval == EM8300_ASPECTRATIO_16_9) { |
9458
23b1d5ef281b
Patch from Tamas Kohegyi to fix subpic placement on 16:9
mswitch
parents:
8924
diff
changeset
|
436 s_width *= d_height*1.78/s_height*(d_width*1.0/d_height)/2.35; |
8924
e0ec616c5985
Added patch from Tamas Kohegyi to fix subpic placement with freetype
mswitch
parents:
8728
diff
changeset
|
437 } else { |
e0ec616c5985
Added patch from Tamas Kohegyi to fix subpic placement with freetype
mswitch
parents:
8728
diff
changeset
|
438 s_width *= 0.84; |
e0ec616c5985
Added patch from Tamas Kohegyi to fix subpic placement with freetype
mswitch
parents:
8728
diff
changeset
|
439 } |
9458
23b1d5ef281b
Patch from Tamas Kohegyi to fix subpic placement on 16:9
mswitch
parents:
8924
diff
changeset
|
440 //printf("VO: [dxr3] sw/sh:dw/dh ->%i,%i,%i,%i\n",s_width,s_height,d_width,d_height); |
7151 | 441 #else |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
442 s_width*=2; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
443 s_height*=2; |
7151 | 444 #endif |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
445 |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
446 osdpicbuf = calloc( 1,s_width * s_height); |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
447 if (osdpicbuf == NULL) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
448 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_OutOfMemory); |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
449 return -1; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
450 } |
30560 | 451 spued = malloc(sizeof(encodedata)); |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
452 if (spued == NULL) { |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
453 free( osdpicbuf ); |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
454 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_OutOfMemory); |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
455 return -1; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
456 } |
30560 | 457 spubuf = malloc(sizeof(encodedata)); |
7950 | 458 if (spubuf == NULL) { |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
459 free( osdpicbuf ); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
460 free( spued ); |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
461 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_OutOfMemory); |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
462 return -1; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
463 } |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
464 osd_w = s_width; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
465 osd_h = s_height; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
466 osdpicbuf_w = s_width; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
467 osdpicbuf_h = s_height; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
468 |
7950 | 469 spubuf->count=0; |
470 pixbuf_encode_rle( 0,0,osdpicbuf_w,osdpicbuf_h - 1,osdpicbuf,osdpicbuf_w,spubuf ); | |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
471 |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
472 #endif |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
473 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
474 #ifdef CONFIG_X11 |
8088 | 475 if (dxr3_overlay) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
476 XVisualInfo vinfo; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
477 XSetWindowAttributes xswa; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
478 XSizeHints hint; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
479 unsigned long xswamask; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
480 Colormap cmap; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
481 XColor key_color; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
482 Window junkwindow; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
483 Screen *scr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
484 int depth, red_shift, red_prec, green_shift, green_prec, blue_shift, blue_prec, acq_color; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
485 em8300_overlay_screen_t ovlscr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
486 em8300_attribute_t ovlattr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
487 |
8037 | 488 vo_dx = (vo_screenwidth - d_width) / 2; |
489 vo_dy = (vo_screenheight - d_height) / 2; | |
490 vo_dwidth = d_width; | |
491 vo_dheight = d_height; | |
27343 | 492 #ifdef CONFIG_GUI |
32379
5471c2bb7a2b
Remov gui-specific code, the way teh GUI works was changed so most
reimar
parents:
32365
diff
changeset
|
493 if (use_gui) |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33725
diff
changeset
|
494 gui(GUI_SETUP_VIDEO_WINDOW, 0); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
495 #endif |
32380 | 496 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &xwin_attribs); |
497 depth = xwin_attribs.depth; | |
498 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) { | |
499 depth = 24; | |
500 } | |
501 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); | |
502 vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, | |
503 d_width, d_height, flags, | |
504 CopyFromParent, "Viewing Window", title); | |
505 xswa.background_pixel = KEY_COLOR; | |
506 xswa.border_pixel = 0; | |
507 xswamask = CWBackPixel | CWBorderPixel; | |
508 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
509 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
510 /* Start setting up overlay */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
511 XGetWindowAttributes(mDisplay, mRootWin, &xwin_attribs); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
512 overlay_set_screen(overlay_data, xwin_attribs.width, xwin_attribs.height, xwin_attribs.depth); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
513 overlay_read_state(overlay_data, NULL); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
514 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
515 /* Allocate keycolor */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
516 cmap = vo_x11_create_colormap(&vinfo); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
517 calculate_cvals(vinfo.red_mask, &red_shift, &red_prec); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
518 calculate_cvals(vinfo.green_mask, &green_shift, &green_prec); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
519 calculate_cvals(vinfo.blue_mask, &blue_shift, &blue_prec); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
520 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
521 key_color.red = ((KEY_COLOR >> 16) & 0xff) * 256; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
522 key_color.green = ((KEY_COLOR >> 8) & 0xff) * 256; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
523 key_color.blue = (KEY_COLOR & 0xff) * 256; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
524 key_color.pixel = (((key_color.red >> (16 - red_prec)) << red_shift) + |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
525 ((key_color.green >> (16 - green_prec)) << green_shift) + |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
526 ((key_color.blue >> (16 - blue_prec)) << blue_shift)); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
527 key_color.flags = DoRed | DoGreen | DoBlue; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
528 if (!XAllocColor(mDisplay, cmap, &key_color)) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
529 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_UnableToAllocateKeycolor); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
530 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
531 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
532 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
533 acq_color = ((key_color.red / 256) << 16) | ((key_color.green / 256) << 8) | key_color.blue; |
8037 | 534 if (key_color.pixel != KEY_COLOR) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
535 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToAllocateExactKeycolor, key_color.pixel); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
536 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
537 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
538 /* Set keycolor and activate overlay */ |
8037 | 539 XSetWindowBackground(mDisplay, vo_window, key_color.pixel); |
540 XClearWindow(mDisplay, vo_window); | |
541 overlay_set_keycolor(overlay_data, key_color.pixel); | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
542 overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_OVERLAY); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
543 overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_RECTANGLE); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
544 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
545 #endif |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
546 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
547 return 0; |
2645 | 548 } |
549 | |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
550 static void draw_alpha(int x, int y, int w, int h, unsigned char* src, unsigned char *srca, int srcstride) |
2645 | 551 { |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
552 #ifdef SPU_SUPPORT |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
553 unsigned char *buf = &osdpicbuf[(y * osdpicbuf_w) + x]; |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
554 int by = 0; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
555 register int lx, ly; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
556 register int stride = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
557 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
558 for (ly = 0; ly < h - 1; ly++) |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
559 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
560 for(lx = 0; lx < w; lx++ ) |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
561 if ( ( srca[stride + lx] )&&( src[stride + lx] >= 128 ) ) buf[by + lx] = 3; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
562 by+=osdpicbuf_w; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
563 stride+=srcstride; |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
564 } |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
565 pixbuf_encode_rle(x, y, osdpicbuf_w, osdpicbuf_h - 1, osdpicbuf, osdpicbuf_w, spued); |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
566 #endif |
2645 | 567 } |
568 | |
569 static void draw_osd(void) | |
570 { | |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
571 #ifdef SPU_SUPPORT |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
572 static int cleared = 0; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
573 int changed = 0; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
574 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
575 if ((disposd % 15) == 0) |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
576 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
577 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
578 mp_osd_obj_t* obj = vo_osd_list; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
579 vo_update_osd( osd_w,osd_h ); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
580 while( obj ) |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
581 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
582 if ( obj->flags & OSDFLAG_VISIBLE ) { changed=1; break; } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
583 obj=obj->next; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
584 } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
585 } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
586 if ( changed ) |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
587 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
588 vo_draw_text(osd_w, osd_h, draw_alpha); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
589 memset(osdpicbuf, 0, s_width * s_height); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
590 cleared=0; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
591 } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
592 else |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
593 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
594 if ( !cleared ) |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
595 { |
7950 | 596 spued->count=spubuf->count; |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
23077
diff
changeset
|
597 fast_memcpy( spued->data,spubuf->data,DATASIZE ); |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
598 cleared=1; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
599 } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
600 } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
601 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
602 |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
603 /* could stand some check here to see if the subpic hasn't changed |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
604 * as if it hasn't and we re-send it it will "blink" as the last one |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
605 * is turned off, and the new one (same one) is turned on |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
606 */ |
6748
c0e8034d47e4
Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents:
6647
diff
changeset
|
607 /* Subpics are not stable yet =( |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
608 expect lockups if you enable */ |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
609 write(fd_spu, spued->data, spued->count); |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
610 } |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
611 disposd++; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
612 #endif |
2645 | 613 } |
614 | |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
615 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
616 static int draw_frame(uint8_t * src[]) |
2645 | 617 { |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
618 vo_mpegpes_t *p = (vo_mpegpes_t *) src[0]; |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
619 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
620 #ifdef SPU_SUPPORT |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
621 if (p->id == 0x20) { |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
622 write(fd_spu, p->data, p->size); |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
623 } else |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
624 #endif |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
625 write(fd_video, p->data, p->size); |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
626 return 0; |
2645 | 627 } |
628 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
629 static void flip_page(void) |
2645 | 630 { |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
631 #ifdef CONFIG_X11 |
8088 | 632 if (dxr3_overlay) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
633 int event = vo_x11_check_events(mDisplay); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
634 if (event & VO_EVENT_RESIZE) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
635 Window junkwindow; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
636 XGetWindowAttributes(mDisplay, vo_window, &xwin_attribs); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
637 XTranslateCoordinates(mDisplay, vo_window, mRootWin, -xwin_attribs.border_width, -xwin_attribs.border_width, &xwin_attribs.x, &xwin_attribs.y, &junkwindow); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
638 overlay_set_window(overlay_data, xwin_attribs.x, xwin_attribs.y, xwin_attribs.width, xwin_attribs.height); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
639 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
640 if (event & VO_EVENT_EXPOSE) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
641 Window junkwindow; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
642 XSetWindowBackground(mDisplay, vo_window, KEY_COLOR); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
643 XClearWindow(mDisplay, vo_window); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
644 XGetWindowAttributes(mDisplay, vo_window, &xwin_attribs); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
645 XTranslateCoordinates(mDisplay, vo_window, mRootWin, -xwin_attribs.border_width, -xwin_attribs.border_width, &xwin_attribs.x, &xwin_attribs.y, &junkwindow); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
646 overlay_set_window(overlay_data, xwin_attribs.x, xwin_attribs.y, xwin_attribs.width, xwin_attribs.height); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
647 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
648 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
649 #endif |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
650 |
8088 | 651 if (dxr3_newsync) { |
7950 | 652 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval); |
653 ioval <<= 1; | |
654 if (vo_pts == 0) { | |
655 ioval = 0; | |
656 ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval); | |
657 pts_offset = 0; | |
658 } else if ((vo_pts - pts_offset) < (ioval - 7200) || (vo_pts - pts_offset) > (ioval + 7200)) { | |
659 ioval = (vo_pts + pts_offset) >> 1; | |
660 ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval); | |
661 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval); | |
662 pts_offset = vo_pts - (ioval << 1); | |
663 if (pts_offset < 0) { | |
664 pts_offset = 0; | |
665 } | |
666 } | |
667 ioval = vo_pts + pts_offset; | |
668 ioctl(fd_video, EM8300_IOCTL_SPU_SETPTS, &ioval); | |
669 ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &ioval); | |
670 prev_pts = vo_pts; | |
8088 | 671 } else if (dxr3_prebuf) { |
7950 | 672 ioctl(fd_spu, EM8300_IOCTL_SPU_SETPTS, &vo_pts); |
4755
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
673 ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts); |
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
674 } |
2645 | 675 } |
676 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
677 static int draw_slice(uint8_t *srcimg[], int stride[], int w, int h, int x0, int y0) |
2645 | 678 { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
679 return -1; |
2645 | 680 } |
681 | |
3208 | 682 static void uninit(void) |
2645 | 683 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
684 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_Uninitializing); |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
685 #ifdef CONFIG_X11 |
8088 | 686 if (dxr3_overlay) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
687 overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_OFF); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
688 overlay_release(overlay_data); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
689 |
32380 | 690 vo_x11_uninit(); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
691 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
692 #endif |
8722
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
693 if (old_vmode != -1) { |
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
694 if (ioctl(fd_control, EM8300_IOCTL_SET_VIDEOMODE, &old_vmode) < 0) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
695 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedRestoringTVNorm); |
8722
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
696 } |
86c0d90cd841
Added patch that makes the dxr3 return to the previous tv norm when quiting.
mswitch
parents:
8549
diff
changeset
|
697 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
698 |
32381
2bd1aae2b3c6
Fix validity checks before closing a file descriptor.
reimar
parents:
32380
diff
changeset
|
699 if (fd_video != -1) { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
700 close(fd_video); |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
701 } |
32381
2bd1aae2b3c6
Fix validity checks before closing a file descriptor.
reimar
parents:
32380
diff
changeset
|
702 if (fd_spu != -1) { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
703 close(fd_spu); |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
704 } |
32381
2bd1aae2b3c6
Fix validity checks before closing a file descriptor.
reimar
parents:
32380
diff
changeset
|
705 if (fd_control != -1) { |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
706 close(fd_control); |
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
707 } |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
708 #ifdef SPU_SUPPORT |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
32470
diff
changeset
|
709 free(osdpicbuf); |
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
32470
diff
changeset
|
710 free(spued); |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
711 #endif |
2645 | 712 } |
713 | |
714 static void check_events(void) | |
715 { | |
716 } | |
4352 | 717 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
718 static int preinit(const char *arg) |
4352 | 719 { |
12646 | 720 char devname[MAX_STR_SIZE]; |
4605 | 721 int fdflags = O_WRONLY; |
5097 | 722 |
7950 | 723 /* Parse commandline */ |
724 while (arg) { | |
8088 | 725 if (!strncmp("prebuf", arg, 6) && !dxr3_prebuf) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
726 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_EnablingPrebuffering); |
8088 | 727 dxr3_prebuf = 1; |
728 } else if (!strncmp("sync", arg, 4) && !dxr3_newsync) { | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
729 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_UsingNewSyncEngine); |
8088 | 730 dxr3_newsync = 1; |
731 } else if (!strncmp("overlay", arg, 7) && !dxr3_overlay) { | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
732 #ifdef CONFIG_X11 |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
733 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_UsingOverlay); |
8088 | 734 dxr3_overlay = 1; |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
735 #else |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
736 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_ErrorYouNeedToCompileMplayerWithX11); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
737 #endif |
8549 | 738 } else if (!strncmp("norm=", arg, 5)) { |
739 arg += 5; | |
740 // dxr3_norm is 0 (-> don't change norm) by default | |
741 // but maybe someone changes this in the future | |
742 | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
743 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_WillSetTVNormTo); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
744 |
8549 | 745 if (*arg == '5') { |
746 dxr3_norm = 5; | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
747 mp_msg(MSGT_VO,MSGL_INFO, "NTSC"); |
8549 | 748 } else if (*arg == '4') { |
749 dxr3_norm = 4; | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
750 mp_msg(MSGT_VO,MSGL_INFO, "PAL-60"); |
8549 | 751 } else if (*arg == '3') { |
752 dxr3_norm = 3; | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
753 mp_msg(MSGT_VO,MSGL_INFO, "PAL"); |
8549 | 754 } else if (*arg == '2') { |
755 dxr3_norm = 2; | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
756 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_AutoAdjustToMovieFrameRatePALPAL60); |
8549 | 757 } else if (*arg == '1') { |
758 dxr3_norm = 1; | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
759 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_AutoAdjustToMovieFrameRatePALNTSC); |
8549 | 760 } else if (*arg == '0') { |
761 dxr3_norm = 0; | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
762 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_UseCurrentNorm); |
8549 | 763 } else { |
764 dxr3_norm = 0; | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
765 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_UseUnknownNormSuppliedCurrentNorm); |
8549 | 766 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
767 |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
768 mp_msg(MSGT_VO,MSGL_INFO, ".\n"); |
7950 | 769 } else if (arg[0] == '0' || arg[0] == '1' || arg[0] == '2' || arg[0] == '3') { |
8088 | 770 dxr3_device_num = arg[0]; |
7950 | 771 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
772 |
5377 | 773 arg = strchr(arg, ':'); |
774 if (arg) { | |
775 arg++; | |
776 } | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
777 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
778 |
5225 | 779 |
7950 | 780 /* Open the control interface */ |
8088 | 781 sprintf(devname, "/dev/em8300-%d", dxr3_device_num); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
782 fd_control = open(devname, fdflags); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
783 if (fd_control < 1) { |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
784 /* Fall back to old naming scheme */ |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
785 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingTrying, devname); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
786 sprintf(devname, "/dev/em8300"); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
787 fd_control = open(devname, fdflags); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
788 if (fd_control < 1) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
789 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingAsWell); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
790 return -1; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
791 } |
8088 | 792 } else { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
793 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_Opened, devname); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
794 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
795 |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
796 /* Open the video interface */ |
8088 | 797 sprintf(devname, "/dev/em8300_mv-%d", dxr3_device_num); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
798 fd_video = open(devname, fdflags); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
799 if (fd_video < 0) { |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
800 /* Fall back to old naming scheme */ |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
801 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingTryingMV, devname); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
802 sprintf(devname, "/dev/em8300_mv"); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
803 fd_video = open(devname, fdflags); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
804 if (fd_video < 0) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
805 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingAsWellMV); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
806 uninit(); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
807 return -1; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
808 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
809 } else { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
810 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_Opened, devname); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
811 } |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
812 strcpy(fdv_name, devname); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
813 |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
814 /* Open the subpicture interface */ |
8088 | 815 sprintf(devname, "/dev/em8300_sp-%d", dxr3_device_num); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
816 fd_spu = open(devname, fdflags); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
817 if (fd_spu < 0) { |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
818 /* Fall back to old naming scheme */ |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
819 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingTryingSP, devname); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
820 sprintf(devname, "/dev/em8300_sp"); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
821 fd_spu = open(devname, fdflags); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
822 if (fd_spu < 0) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
823 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingAsWellSP); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
824 uninit(); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
825 return -1; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
826 } |
8088 | 827 } else { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
828 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_Opened, devname); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
829 } |
5499
58864ce0eef7
Fixed bug that would cause the dxr3 to lock if too many subpics were sent at once
mswitch
parents:
5497
diff
changeset
|
830 strcpy(fds_name, devname); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
831 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
832 #ifdef CONFIG_X11 |
8088 | 833 if (dxr3_overlay) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
834 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
835 /* Fucked up hack needed to enable overlay. |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
836 * Will be removed as soon as I figure out |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
837 * how to make it work like it should |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
838 */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
839 Display *dpy; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
840 overlay_t *ov; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
841 XWindowAttributes attribs; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
842 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
843 dpy = XOpenDisplay(NULL); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
844 if (!dpy) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
845 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_UnableToOpenDisplayDuringHackSetup); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
846 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
847 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
848 XGetWindowAttributes(dpy, RootWindow(dpy, DefaultScreen(dpy)), &attribs); |
8037 | 849 ov = overlay_init(fd_control); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
850 overlay_set_screen(ov, attribs.width, attribs.height, PlanesOfScreen(ScreenOfDisplay(dpy, 0))); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
851 overlay_read_state(ov, NULL); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
852 overlay_set_keycolor(ov, KEY_COLOR); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
853 overlay_set_mode(ov, EM8300_OVERLAY_MODE_OVERLAY); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
854 overlay_set_mode(ov, EM8300_OVERLAY_MODE_RECTANGLE); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
855 overlay_release(ov); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
856 XCloseDisplay(dpy); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
857 /* End of fucked up hack */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
858 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
859 /* Initialize overlay and X11 */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
860 overlay_data = overlay_init(fd_control); |
32380 | 861 if (!vo_init()) { |
862 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_UnableToInitX11); | |
863 return -1; | |
864 } | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
865 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
866 #endif |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
867 |
8088 | 868 if (dxr3_newsync) { |
869 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval); | |
870 pts_offset = vo_pts - (ioval << 1); | |
871 if (pts_offset < 0) { | |
872 pts_offset = 0; | |
873 } | |
874 } | |
875 | |
4480 | 876 return 0; |
4352 | 877 } |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
878 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
879 /* Begin overlay.c */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
880 static int update_parameters(overlay_t *o) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
881 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
882 overlay_set_attribute(o, EM9010_ATTRIBUTE_XOFFSET, o->xoffset); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
883 overlay_set_attribute(o, EM9010_ATTRIBUTE_YOFFSET, o->yoffset); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
884 overlay_set_attribute(o, EM9010_ATTRIBUTE_XCORR, o->xcorr); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
885 overlay_set_attribute(o, EM9010_ATTRIBUTE_STABILITY, o->stability); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
886 overlay_set_attribute(o, EM9010_ATTRIBUTE_JITTER, o->jitter); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
887 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
888 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
889 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
890 static int overlay_set_attribute(overlay_t *o, int attribute, int value) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
891 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
892 em8300_attribute_t attr; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
893 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
894 attr.attribute = attribute; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
895 attr.value = value; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
896 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE, &attr)==-1) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
897 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
898 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedSettingOverlayAttribute); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
899 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
900 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
901 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
902 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
903 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
904 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
905 static overlay_t *overlay_init(int dev) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
906 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
907 overlay_t *o; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
908 |
30560 | 909 o = malloc(sizeof(overlay_t)); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
910 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
911 if(!o) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
912 return NULL; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
913 |
15026 | 914 memset(o,0,sizeof(overlay_t)); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
915 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
916 o->dev = dev; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
917 o->xres = 1280; o->yres=1024; o->xcorr=1000; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
918 o->color_interval=10; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
919 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
920 return o; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
921 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
922 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
923 static int overlay_release(overlay_t *o) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
924 { |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
32470
diff
changeset
|
925 free(o); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
926 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
927 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
928 #define TYPE_INT 1 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
929 #define TYPE_XINT 2 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
930 #define TYPE_COEFF 3 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
931 #define TYPE_FLOAT 4 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
932 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
933 struct lut_entry { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
934 char *name; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
935 int type; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
936 void *ptr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
937 }; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
938 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
939 static struct lut_entry *new_lookuptable(overlay_t *o) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
940 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
941 struct lut_entry m[] = { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
942 {"xoffset", TYPE_INT, &o->xoffset}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
943 {"yoffset", TYPE_INT, &o->yoffset}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
944 {"xcorr", TYPE_INT, &o->xcorr}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
945 {"jitter", TYPE_INT, &o->jitter}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
946 {"stability", TYPE_INT, &o->stability}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
947 {"keycolor", TYPE_XINT, &o->keycolor}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
948 {"colcal_upper", TYPE_COEFF, &o->colcal_upper[0]}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
949 {"colcal_lower", TYPE_COEFF, &o->colcal_lower[0]}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
950 {"color_interval", TYPE_FLOAT, &o->color_interval}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
951 {0,0,0} |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
952 },*p; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
953 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
954 p = malloc(sizeof(m)); |
23458
973e53dc7df5
Do not use fast_memcpy for small size copy, esp. when the size is constant
reimar
parents:
23457
diff
changeset
|
955 memcpy(p,m,sizeof(m)); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
956 return p; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
957 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
958 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
959 static int lookup_parameter(overlay_t *o, struct lut_entry *lut, char *name, void **ptr, int *type) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
960 int i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
961 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
962 for(i=0; lut[i].name; i++) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
963 if(!strcmp(name,lut[i].name)) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
964 *ptr = lut[i].ptr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
965 *type = lut[i].type; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
966 return 1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
967 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
968 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
969 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
970 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
971 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
972 static int overlay_read_state(overlay_t *o, char *p) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
973 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
974 char *a,*tok; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
975 char path[128],fname[128],tmp[128],line[256]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
976 FILE *fp; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
977 struct lut_entry *lut; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
978 void *ptr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
979 int type; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
980 int j; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
981 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
982 if(!p) { |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23655
diff
changeset
|
983 av_strlcpy(fname, getenv("HOME"), sizeof( fname )); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
984 av_strlcat(fname,"/.overlay", sizeof( fname )); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
985 } else |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23655
diff
changeset
|
986 av_strlcpy(fname, p, sizeof( fname )); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
987 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
988 sprintf(tmp,"/res_%dx%dx%d",o->xres,o->yres,o->depth); |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23655
diff
changeset
|
989 av_strlcat(fname, tmp, sizeof( fname )); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
990 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
991 if(!(fp=fopen(fname,"r"))) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
992 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
993 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
994 lut = new_lookuptable(o); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
995 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
996 while(!feof(fp)) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
997 if(!fgets(line,256,fp)) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
998 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
999 tok=strtok(line," "); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1000 if(lookup_parameter(o,lut,tok,&ptr,&type)) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1001 tok=strtok(NULL," "); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1002 switch(type) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1003 case TYPE_INT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1004 sscanf(tok,"%d",(int *)ptr); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1005 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1006 case TYPE_XINT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1007 sscanf(tok,"%x",(int *)ptr); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1008 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1009 case TYPE_FLOAT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1010 sscanf(tok,"%f",(float *)ptr); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1011 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1012 case TYPE_COEFF: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1013 for(j=0;j<3;j++) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1014 sscanf(tok,"%f",&((struct coeff *)ptr)[j].k); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1015 tok=strtok(NULL," "); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1016 sscanf(tok,"%f",&((struct coeff *)ptr)[j].m); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1017 tok=strtok(NULL," "); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1018 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1019 break; |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1020 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1021 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1022 } |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1023 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1024 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1025 update_parameters(o); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1026 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1027 free(lut); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1028 fclose(fp); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1029 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1030 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1031 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1032 static void overlay_update_params(overlay_t *o) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1033 update_parameters(o); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1034 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1035 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1036 static int overlay_write_state(overlay_t *o, char *p) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1037 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1038 char *a; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1039 char path[128],fname[128],tmp[128]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1040 FILE *fp; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1041 char line[256],*tok; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1042 struct lut_entry *lut; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1043 int i,j; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1044 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1045 if(!p) { |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23655
diff
changeset
|
1046 av_strlcpy(fname, getenv("HOME"), sizeof( fname )); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1047 av_strlcat(fname,"/.overlay", sizeof( fname )); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1048 } else |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23655
diff
changeset
|
1049 av_strlcpy(fname, p, sizeof( fname )); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1050 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1051 if(access(fname, W_OK|X_OK|R_OK)) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1052 if(mkdir(fname,0766)) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1053 return -1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1054 } |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1055 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1056 sprintf(tmp,"/res_%dx%dx%d",o->xres,o->yres,o->depth); |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23655
diff
changeset
|
1057 av_strlcat(fname, tmp, sizeof( fname )); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1058 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1059 if(!(fp=fopen(fname,"w"))) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1060 return -1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1061 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1062 lut = new_lookuptable(o); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1063 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1064 for(i=0; lut[i].name; i++) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1065 fprintf(fp,"%s ",lut[i].name); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1066 switch(lut[i].type) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1067 case TYPE_INT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1068 fprintf(fp,"%d\n",*(int *)lut[i].ptr); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1069 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1070 case TYPE_XINT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1071 fprintf(fp,"%06x\n",*(int *)lut[i].ptr); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1072 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1073 case TYPE_FLOAT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1074 fprintf(fp,"%f\n",*(float *)lut[i].ptr); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1075 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1076 case TYPE_COEFF: |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1077 for(j=0;j<3;j++) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1078 fprintf(fp,"%f %f ",((struct coeff *)lut[i].ptr)[j].k, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1079 ((struct coeff *)lut[i].ptr)[j].m); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1080 fprintf(fp,"\n"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1081 break; |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1082 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1083 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1084 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1085 fclose(fp); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1086 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1087 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1088 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1089 static int overlay_set_screen(overlay_t *o, int xres, int yres, int depth) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1090 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1091 em8300_overlay_screen_t scr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1092 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1093 o->xres = xres; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1094 o->yres = yres; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1095 o->depth = depth; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1096 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1097 scr.xsize = xres; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1098 scr.ysize = yres; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1099 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1100 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETSCREEN, &scr)==-1) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1101 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1102 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedSettingOverlayScreen); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1103 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1104 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1105 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1106 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1107 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1108 static int overlay_set_mode(overlay_t *o, int mode) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1109 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1110 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETMODE, &mode)==-1) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1111 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedEnablingOverlay); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1112 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1113 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1114 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1115 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1116 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1117 static int overlay_set_window(overlay_t *o, int xpos,int ypos,int width,int height) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1118 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1119 em8300_overlay_window_t win; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1120 win.xpos = xpos; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1121 win.ypos = ypos; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1122 win.width = width; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1123 win.height = height; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1124 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1125 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETWINDOW, &win)==-1) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1126 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1127 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedResizingOverlayWindow); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1128 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1129 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1130 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1131 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1132 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1133 static int overlay_set_bcs(overlay_t *o, int brightness, int contrast, int saturation) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1134 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1135 em8300_bcs_t bcs; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1136 bcs.brightness = brightness; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1137 bcs.contrast = contrast; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1138 bcs.saturation = saturation; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1139 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1140 if (ioctl(o->dev, EM8300_IOCTL_GETBCS, &bcs)==-1) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1141 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1142 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedSettingOverlayBcs); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1143 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1144 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1145 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1146 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1147 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1148 static int col_interp(float x, struct coeff c) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1149 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1150 float y; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1151 y = x*c.k + c.m; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1152 if(y > 255) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1153 y = 255; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1154 if(y < 0) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1155 y = 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1156 return rint(y); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1157 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1158 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1159 static int overlay_set_keycolor(overlay_t *o, int color) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1160 int r = (color & 0xff0000) >> 16; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1161 int g = (color & 0x00ff00) >> 8; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1162 int b = (color & 0x0000ff); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1163 float ru,gu,bu; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1164 float rl,gl,bl; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1165 int upper,lower; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1166 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1167 ru = r+o->color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1168 gu = g+o->color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1169 bu = b+o->color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1170 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1171 rl = r-o->color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1172 gl = g-o->color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1173 bl = b-o->color_interval; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29087
diff
changeset
|
1174 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1175 upper = (col_interp(ru, o->colcal_upper[0]) << 16) | |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1176 (col_interp(gu, o->colcal_upper[1]) << 8) | |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1177 (col_interp(bu, o->colcal_upper[2])); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1178 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1179 lower = (col_interp(rl, o->colcal_lower[0]) << 16) | |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1180 (col_interp(gl, o->colcal_lower[1]) << 8) | |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1181 (col_interp(bl, o->colcal_lower[2])); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1182 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1183 //printf("0x%06x 0x%06x\n",upper,lower); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1184 overlay_set_attribute(o,EM9010_ATTRIBUTE_KEYCOLOR_UPPER,upper); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1185 overlay_set_attribute(o,EM9010_ATTRIBUTE_KEYCOLOR_LOWER,lower); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1186 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1187 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1188 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1189 static void least_sq_fit(int *x, int *y, int n, float *k, float *m) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1190 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1191 float sx=0,sy=0,sxx=0,sxy=0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1192 float delta,b; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1193 int i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1194 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1195 for(i=0; i < n; i++) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1196 sx=sx+x[i]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1197 sy=sy+y[i]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1198 sxx=sxx+x[i]*x[i]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1199 sxy=sxy+x[i]*y[i]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1200 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1201 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1202 delta=sxx*n-sx*sx; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1203 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1204 *m=(sxx*sy-sx*sxy)/delta; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1205 *k=(sxy*n-sx*sy)/delta; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1206 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1207 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1208 static int overlay_autocalibrate(overlay_t *o, pattern_drawer_cb pd, void *arg) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1209 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1210 em8300_overlay_calibrate_t cal; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1211 em8300_overlay_window_t win; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1212 int x[256],r[256],g[256],b[256],n; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1213 float k,m; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1214 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1215 int i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1216 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1217 o->draw_pattern=pd; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1218 o->dp_arg = arg; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1219 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1220 overlay_set_mode(o, EM8300_OVERLAY_MODE_OVERLAY); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1221 overlay_set_screen(o, o->xres, o->yres, o->depth); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1222 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1223 /* Calibrate Y-offset */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1224 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1225 o->draw_pattern(0x0000ff, 0, 0, 0, 355, 1, o->dp_arg); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1226 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1227 cal.cal_mode = EM8300_OVERLAY_CALMODE_YOFFSET; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1228 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal)) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1229 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1230 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedGettingOverlayYOffsetValues); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1231 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1232 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1233 o->yoffset = cal.result; |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1234 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_YOffset,cal.result); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1235 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1236 /* Calibrate X-offset */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1237 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1238 o->draw_pattern(0x0000ff, 0, 0, 0, 2, 288, o->dp_arg); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1239 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1240 cal.cal_mode = EM8300_OVERLAY_CALMODE_XOFFSET; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1241 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal)) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1242 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1243 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedGettingOverlayXOffsetValues); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1244 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1245 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1246 o->xoffset = cal.result; |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1247 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_XOffset,cal.result); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1248 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1249 /* Calibrate X scale correction */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1250 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1251 o->draw_pattern(0x0000ff, 0, 355, 0, 2, 288, o->dp_arg); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1252 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1253 cal.cal_mode = EM8300_OVERLAY_CALMODE_XCORRECTION; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1254 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal)) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1255 { |
18247 | 1256 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedGettingOverlayXScaleCorrection); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1257 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1258 } |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1259 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_XCorrection,cal.result); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1260 o->xcorr = cal.result; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1261 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1262 win.xpos = 10; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1263 win.ypos = 10; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1264 win.width = o->xres-20; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1265 win.height = o->yres-20; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1266 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETWINDOW, &win)==-1) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1267 mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_FailedResizingOverlayWindow); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1268 exit(1); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1269 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1270 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1271 /* Calibrate key color upper limit */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1272 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1273 for(i=128,n=0; i <= 0xff; i+=4) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1274 o->draw_pattern(i | (i << 8) | (i << 16), 0, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1275 (o->xres-200)/2,0,200,o->yres,o->dp_arg); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1276 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1277 cal.arg = i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1278 cal.arg2 = 1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1279 cal.cal_mode = EM8300_OVERLAY_CALMODE_COLOR; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1280 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1281 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal)) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1282 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1283 return -1 ; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1284 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1285 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1286 x[n] = i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1287 r[n] = (cal.result>>16)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1288 g[n] = (cal.result>>8)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1289 b[n] = (cal.result)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1290 n++; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1291 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1292 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1293 least_sq_fit(x,r,n,&o->colcal_upper[0].k,&o->colcal_upper[0].m); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1294 least_sq_fit(x,g,n,&o->colcal_upper[1].k,&o->colcal_upper[1].m); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1295 least_sq_fit(x,b,n,&o->colcal_upper[2].k,&o->colcal_upper[2].m); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1296 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1297 /* Calibrate key color lower limit */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1298 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1299 for(i=128,n=0; i <= 0xff; i+=4) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1300 o->draw_pattern(i | (i << 8) | (i << 16), 0xffffff, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1301 (o->xres-200)/2,0,200,o->yres, o->dp_arg); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1302 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1303 cal.arg = i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1304 cal.arg2 = 2; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1305 cal.cal_mode = EM8300_OVERLAY_CALMODE_COLOR; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1306 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1307 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal)) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1308 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1309 return -1 ; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1310 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1311 x[n] = i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1312 r[n] = (cal.result>>16)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1313 g[n] = (cal.result>>8)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1314 b[n] = (cal.result)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1315 n++; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1316 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1317 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1318 least_sq_fit(x,r,n,&o->colcal_lower[0].k,&o->colcal_lower[0].m); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1319 least_sq_fit(x,g,n,&o->colcal_lower[1].k,&o->colcal_lower[1].m); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1320 least_sq_fit(x,b,n,&o->colcal_lower[2].k,&o->colcal_lower[2].m); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1321 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1322 overlay_set_mode(o, EM8300_OVERLAY_MODE_OFF); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1323 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1324 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1325 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1326 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1327 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1328 static int overlay_signalmode(overlay_t *o, int mode) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1329 if(ioctl(o->dev, EM8300_IOCTL_OVERLAY_SIGNALMODE, &mode) ==-1) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
17366
diff
changeset
|
1330 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedSetSignalMix); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1331 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1332 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1333 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1334 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1335 /* End overlay.c */ |