Mercurial > mplayer.hg
annotate libvo/vo_dxr3.c @ 8123:9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
based on patch by Dominik Mierzejewski <dominik@rangers.eu.org>
author | arpi |
---|---|
date | Wed, 06 Nov 2002 23:54:29 +0000 |
parents | f880c1de0e9b |
children | 5b39e79af5fe |
rev | line source |
---|---|
6748
c0e8034d47e4
Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents:
6647
diff
changeset
|
1 /* |
2645 | 2 * vo_dxr3.c - DXR3/H+ video out |
3 * | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
4 * Copyright (C) 2002 David Holm <dholm@iname.com> |
2645 | 5 * |
6 */ | |
7 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
8 /* ChangeLog added 2002-01-10 |
8088 | 9 * 2002-01-03: |
10 * Cleaned up syncing code and renamed setup variables so | |
11 * they can be accessed from the GUI. | |
12 * | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
13 * 2002-01-02: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
14 * Added native overlay support, activate with :overlay |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
15 * you have to run dxr3view to modify settings (or manually |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
16 * edit the files in ~/.overlay. |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
17 * |
7950 | 18 * 2002-10-29: |
19 * Added new sync-engine, activate with :sync option. | |
20 * Greatly improved commandline parser. | |
21 * Replaced :noprebuf with :prebuf and made noprebuf the default. | |
22 * | |
7945
32939f2b3d2e
Fixed stupid bug relating to multiple cards on athlons
mswitch
parents:
7932
diff
changeset
|
23 * 2002-10-28: |
32939f2b3d2e
Fixed stupid bug relating to multiple cards on athlons
mswitch
parents:
7932
diff
changeset
|
24 * Fixed multicard bug on athlons |
32939f2b3d2e
Fixed stupid bug relating to multiple cards on athlons
mswitch
parents:
7932
diff
changeset
|
25 * |
6748
c0e8034d47e4
Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents:
6647
diff
changeset
|
26 * 2002-07-18: |
c0e8034d47e4
Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents:
6647
diff
changeset
|
27 * Disabled spuenc support, this is still not stable enough =( |
c0e8034d47e4
Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents:
6647
diff
changeset
|
28 * |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
29 * 2002-07-05: |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
30 * Removed lavc and fame encoder to be compatible with new libvo style. |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
31 * Added graphic equalizer support. |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
32 * |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
33 * 2002-04-15: |
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
34 * The spuenc code isn't 100% stable yet, therefore I'm disabling |
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
35 * it due to the upcoming stable release. |
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
36 * |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
37 * 2002-04-03: |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
38 * Carl George added spuenc support |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
39 * |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
40 * 2002-03-26: |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
41 * XorA added an option parser and support for selecting encoder |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
42 * codec. We thank him again. |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
43 * |
5330 | 44 * 2002-03-25: |
45 * A couple of bugfixes by XorA | |
46 * | |
5273
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
47 * 2002-03-23: |
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
48 * Thanks to Marcel Hild <hild@b4mad.net> the jitter-bug experienced |
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
49 * with some videos have been fixed, many thanks goes to him. |
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
50 * |
5134
83b3dc5132a5
Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents:
5132
diff
changeset
|
51 * 2002-03-16: |
83b3dc5132a5
Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents:
5132
diff
changeset
|
52 * Fixed problems with fame, it gives a better picture than avcodec, |
83b3dc5132a5
Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents:
5132
diff
changeset
|
53 * but is slightly slower. Most notably the wobbling effect is gone |
83b3dc5132a5
Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents:
5132
diff
changeset
|
54 * with fame. |
83b3dc5132a5
Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents:
5132
diff
changeset
|
55 * |
5064 | 56 * 2002-03-13: |
57 * Preliminary fame support added (it breaks after seeking, why?) | |
58 * | |
4755
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
59 * 2002-02-18: |
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
60 * Fixed sync problems when pausing video (while using prebuffering) |
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
61 * |
4723
93e959f0a6e4
Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents:
4685
diff
changeset
|
62 * 2002-02-16: |
93e959f0a6e4
Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents:
4685
diff
changeset
|
63 * Fixed bug which would case invalid output when using :noprebuf |
93e959f0a6e4
Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents:
4685
diff
changeset
|
64 * Removed equalization code, it caused problems on slow systems |
93e959f0a6e4
Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents:
4685
diff
changeset
|
65 * |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
66 * 2002-02-13: |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
67 * Using the swscaler instead of the old hand coded shit. (Checkout man mplayer and search for sws ;). |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
68 * Using aspect function to setup a proper mpeg1, no more hassling with odd resolutions or GOP-sizes, |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
69 * this would only create jitter on some vids! |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
70 * The swscaler sometimes exits with sig8 on mpegs, I don't know why yet (just use -vc mpegpes in this |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
71 * case, and report to me if you have any avi's etc which does this...) |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
72 * |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
73 * 2002-02-09: |
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
74 * Thanks to the new control() method I have finally been able to enable the em8300 prebuffering. |
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
75 * This should speed up playback on all systems, the vout cpu usage should rocket since I will be hogging |
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
76 * the pci bus. Not to worry though, since frames are prebuffered it should be able to take a few blows |
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
77 * if you start doing other stuff simultaneously. |
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
78 * |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
79 * 2002-02-03: |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
80 * Removal of libmp1e, libavcodec has finally become faster (and it's code is helluva lot cleaner) |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
81 * |
4480 | 82 * 2002-02-02: |
83 * Cleaned out some old code which might have slowed down writes | |
84 * | |
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
|
85 * 2002-01-17: |
4219 | 86 * Testrelease of new sync engine (using previously undocumented feature of em8300). |
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
|
87 * |
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
|
88 * 2002-01-15: |
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
|
89 * Preliminary subpic support with -vc mpegpes and dvd's |
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
|
90 * Device interfaces tries the new naming scheme by default (even though most users probably still use the old one) |
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
|
91 * |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
92 * 2002-01-10: |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
93 * I rehauled the entire codebase. I have now changed to |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
94 * Kernighan & Ritchie codingstyle, please mail me if you |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
95 * find any inconcistencies. |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
96 */ |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
97 |
2921 | 98 #include <linux/em8300.h> |
99 #include <sys/ioctl.h> | |
100 #include <sys/stat.h> | |
101 #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
|
102 #include <sys/select.h> |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
103 #include <unistd.h> |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
104 #include <stdio.h> |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
105 #include <stdlib.h> |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
106 #include <string.h> |
2921 | 107 #include <fcntl.h> |
2645 | 108 #include <stdio.h> |
109 #include <time.h> | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
110 #include <math.h> |
2645 | 111 |
112 #include "config.h" | |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
8092
diff
changeset
|
113 #ifdef HAVE_MALLOC_H |
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
8092
diff
changeset
|
114 #include <malloc.h> |
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
8092
diff
changeset
|
115 #endif |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
116 #include "fastmemcpy.h" |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
117 |
2645 | 118 #include "video_out.h" |
119 #include "video_out_internal.h" | |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
120 #include "aspect.h" |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
121 #include "spuenc.h" |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
122 #include "sub.h" |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
123 #ifdef HAVE_NEW_GUI |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
124 #include "../Gui/interface.h" |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
125 #endif |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
126 #ifdef HAVE_X11 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
127 #include "x11_common.h" |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
128 #endif |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
129 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
130 #define SPU_SUPPORT |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
131 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
132 static vo_info_t vo_info = |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
133 { |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
134 "DXR3/H+ video out", |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
135 "dxr3", |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
136 "David Holm <dholm@iname.com>", |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
137 "" |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
138 }; |
2645 | 139 LIBVO_EXTERN (dxr3) |
5377 | 140 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
141 /* Resolutions and positions */ |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
142 static int v_width, v_height; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
143 static int s_width, s_height; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
144 static int osd_w, osd_h; |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
145 static int fullscreen = 0; |
2770 | 146 static int img_format = 0; |
3329
529a001496c2
Switched from rte which caused alot of problems for some users to libmp1e.
mswitch
parents:
3232
diff
changeset
|
147 |
8088 | 148 /* Configuration values |
149 * Don't declare these static, they | |
150 * should be accessible from the gui. | |
151 */ | |
152 int dxr3_prebuf = 0; | |
153 int dxr3_newsync = 0; | |
154 int dxr3_overlay = 0; | |
155 int dxr3_device_num = 0; | |
156 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
157 /* File descriptors */ |
2921 | 158 static int fd_control = -1; |
159 static int fd_video = -1; | |
160 static int fd_spu = -1; | |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
161 static char fdv_name[80]; |
5499
58864ce0eef7
Fixed bug that would cause the dxr3 to lock if too many subpics were sent at once
mswitch
parents:
5497
diff
changeset
|
162 static char fds_name[80]; |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
163 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
164 #ifdef SPU_SUPPORT |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
165 /* on screen display/subpics */ |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
166 static char *osdpicbuf = NULL; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
167 static int osdpicbuf_w; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
168 static int osdpicbuf_h; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
169 static int disposd = 0; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
170 static encodedata *spued; |
7950 | 171 static encodedata *spubuf; |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
172 #endif |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
173 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
174 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
175 /* Static variable used in ioctl's */ |
2921 | 176 static int ioval = 0; |
7950 | 177 static int prev_pts = 0; |
178 static int pts_offset = 0; | |
2645 | 179 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
180 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
181 /* Begin overlay.h */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
182 /* |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
183 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
|
184 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
185 Henrik Johansson |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
186 */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
187 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
188 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
189 /* 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
|
190 The function is expected to: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
191 Clear the entire screen. |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
192 Fill the screen with color bgcol (0xRRGGBB) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
193 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
|
194 */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
195 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
196 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
|
197 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
|
198 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
199 struct coeff { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
200 float k,m; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
201 }; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
202 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
203 typedef struct { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
204 int dev; |
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 int xres, yres,depth; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
207 int xoffset,yoffset,xcorr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
208 int jitter; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
209 int stability; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
210 int keycolor; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
211 struct coeff colcal_upper[3]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
212 struct coeff colcal_lower[3]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
213 float color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
214 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
215 pattern_drawer_cb draw_pattern; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
216 void *dp_arg; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
217 } overlay_t; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
218 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
219 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
220 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
|
221 static int overlay_release(overlay_t *); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
222 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
223 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
|
224 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
|
225 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
226 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
|
227 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
|
228 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
|
229 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
|
230 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
|
231 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
|
232 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
233 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
|
234 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
|
235 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
|
236 /* End overlay.h */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
237 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
238 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
239 #ifdef HAVE_X11 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
240 #define KEY_COLOR 0x80a040 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
241 static XWindowAttributes xwin_attribs; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
242 static overlay_t *overlay_data; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
243 #endif |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
244 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
245 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
246 /* 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
|
247 /* End of internal clock functions */ |
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
248 |
7932 | 249 static uint32_t control(uint32_t request, void *data, ...) |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
250 { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
251 switch (request) { |
7009 | 252 case VOCTRL_GUISUPPORT: |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
253 return VO_TRUE; |
7009 | 254 case VOCTRL_GUI_NOWINDOW: |
8088 | 255 if (dxr3_overlay) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
256 return VO_FALSE; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
257 } |
7009 | 258 return VO_TRUE; |
8088 | 259 case VOCTRL_SET_SPU_PALETTE: |
260 if (ioctl(fd_spu, EM8300_IOCTL_SPU_SETPALETTE, data) < 0) { | |
261 printf("VO: [dxr3] Unable to load new SPU palette!\n"); | |
262 return VO_ERROR; | |
263 } | |
264 return VO_TRUE; | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
265 #ifdef HAVE_X11 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
266 case VOCTRL_FULLSCREEN: |
8088 | 267 if (dxr3_overlay) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
268 vo_x11_fullscreen(); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
269 if (fullscreen) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
270 overlay_signalmode(overlay_data, EM8300_OVERLAY_SIGNAL_WITH_VGA); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
271 fullscreen = 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
272 } else { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
273 overlay_signalmode(overlay_data, EM8300_OVERLAY_SIGNAL_ONLY); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
274 fullscreen = 1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
275 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
276 return VO_TRUE; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
277 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
278 return VO_FALSE; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
279 #endif |
4754 | 280 case VOCTRL_RESUME: |
8088 | 281 if (dxr3_newsync) { |
282 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval); | |
283 pts_offset = vo_pts - (ioval << 1); | |
284 if (pts_offset < 0) { | |
285 pts_offset = 0; | |
286 } | |
287 } | |
288 | |
289 if (dxr3_prebuf) { | |
4754 | 290 ioval = EM8300_PLAYMODE_PLAY; |
291 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) { | |
292 printf("VO: [dxr3] Unable to set playmode!\n"); | |
293 } | |
294 } | |
295 return VO_TRUE; | |
296 case VOCTRL_PAUSE: | |
8088 | 297 if (dxr3_prebuf) { |
4754 | 298 ioval = EM8300_PLAYMODE_PAUSED; |
299 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) { | |
300 printf("VO: [dxr3] Unable to set playmode!\n"); | |
301 } | |
302 } | |
303 return VO_TRUE; | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
304 case VOCTRL_RESET: |
8088 | 305 if (dxr3_prebuf) { |
4605 | 306 close(fd_video); |
307 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
|
308 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
|
309 fd_spu = open(fds_name, O_WRONLY); |
4609 | 310 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
|
311 fsync(fd_spu); |
4605 | 312 } |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
313 return VO_TRUE; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
314 case VOCTRL_QUERY_FORMAT: |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
315 { |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
316 uint32_t flag = 0; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
317 |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
318 if (*((uint32_t*)data) != IMGFMT_MPEGPES) |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
319 return 0; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
320 |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
321 flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_SPU; |
8088 | 322 if (dxr3_prebuf) |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
323 flag |= VFCAP_TIMER; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
324 return flag; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
325 } |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
326 case VOCTRL_SET_EQUALIZER: |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
327 { |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
328 va_list ap; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
329 int value; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
330 em8300_bcs_t bcs; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
331 |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
332 va_start(ap, data); |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
333 value = va_arg(ap, int); |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
334 va_end(ap); |
6748
c0e8034d47e4
Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents:
6647
diff
changeset
|
335 |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
336 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
|
337 return VO_FALSE; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
338 if (!strcasecmp(data, "brightness")) |
7095
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
339 bcs.brightness = (value+100)*5; |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
340 else if (!strcasecmp(data, "contrast")) |
7095
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
341 bcs.contrast = (value+100)*5; |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
342 else if (!strcasecmp(data, "saturation")) |
7095
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
343 bcs.saturation = (value+100)*5; |
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
344 else return VO_FALSE; |
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
345 |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
346 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
|
347 return VO_FALSE; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
348 return VO_TRUE; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
349 } |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
350 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
|
351 { |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
352 va_list ap; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
353 int *value; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
354 em8300_bcs_t bcs; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
355 |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
356 va_start(ap, data); |
6843 | 357 value = va_arg(ap, int*); |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
358 va_end(ap); |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
359 |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
360 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
|
361 return VO_FALSE; |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
362 |
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
363 if (!strcasecmp(data, "brightness")) |
7095
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
364 *value = (bcs.brightness/5)-100; |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
365 else if (!strcasecmp(data, "contrast")) |
7095
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
366 *value = (bcs.contrast/5)-100; |
6787
f6a349add30d
eq synced to new way, not tested, but the old one isn't working yet
alex
parents:
6748
diff
changeset
|
367 else if (!strcasecmp(data, "saturation")) |
7095
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
368 *value = (bcs.saturation/5)-100; |
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
369 else return VO_FALSE; |
fad0147bd3aa
- add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents:
7067
diff
changeset
|
370 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
371 return VO_TRUE; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
372 } |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
373 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
374 return VO_NOTIMPL; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
375 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
376 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
377 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
|
378 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
379 /* Calculate shift and precision */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
380 (*shift) = 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
381 (*prec) = 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
382 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
383 while (!(mask & 0x1)) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
384 (*shift)++; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
385 mask >>= 1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
386 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
387 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
388 while (mask & 0x1) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
389 (*prec)++; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
390 mask >>= 1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
391 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
392 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
393 |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
7095
diff
changeset
|
394 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) |
2645 | 395 { |
4754 | 396 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
|
397 em8300_register_t reg; |
5273
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
398 extern float monitor_aspect; |
6748
c0e8034d47e4
Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents:
6647
diff
changeset
|
399 |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
400 /* 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
|
401 /* 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
|
402 /* 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
|
403 /* up in a lockup */ |
4160 | 404 ioval = EM8300_SPUMODE_ON; |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
405 if (ioctl(fd_control, EM8300_IOCTL_SET_SPUMODE, &ioval) < 0) { |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
406 printf("VO: [dxr3] Unable to set subpicture mode!\n"); |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
407 uninit(); |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
408 return -1; |
3201 | 409 } |
410 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
411 /* 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
|
412 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
|
413 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
414 printf("VO: [dxr3] Unable to set playmode!\n"); |
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
|
415 } |
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
|
416 |
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
|
417 /* Start em8300 prebuffering and sync engine */ |
6618 | 418 #ifdef 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
|
419 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
|
420 reg.reg = 0; |
8088 | 421 reg.val = MVCOMMAND_START; |
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
|
422 ioctl(fd_control, EM8300_IOCTL_WRITEREG, ®); |
6618 | 423 #endif |
424 | |
425 #ifdef EM8300_IOCTL_FLUSH | |
4607
da09673aea00
Removed some stuff from the em8300 driver, had to compensate
mswitch
parents:
4605
diff
changeset
|
426 /* Clean buffer by syncing it */ |
4609 | 427 ioval = EM8300_SUBDEVICE_VIDEO; |
428 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval); | |
429 ioval = EM8300_SUBDEVICE_AUDIO; | |
430 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval); | |
6618 | 431 #endif |
432 | |
7950 | 433 /* Sync the video device to make sure the buffers are empty |
434 * and set the playback speed to normal. Also reset the | |
435 * em8300 internal clock. | |
436 */ | |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
437 fsync(fd_video); |
7950 | 438 ioval = 0x900; |
439 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
|
440 |
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
|
441 /* 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
|
442 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
|
443 v_width = width; |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
444 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
|
445 |
5273
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
446 /* 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
|
447 monitor_aspect = (float) width / (float) height; |
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
448 |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
449 /* 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
|
450 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
|
451 aspect_save_prescale(d_width, d_height); |
6618 | 452 #ifdef EM8300_IOCTL_GET_VIDEOMODE |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
453 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
|
454 if (ioval == EM8300_VIDEOMODE_NTSC) { |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
455 printf("VO: [dxr3] Setting up for NTSC.\n"); |
5065 | 456 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
|
457 } else { |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
458 printf("VO: [dxr3] Setting up for PAL/SECAM.\n"); |
5065 | 459 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
|
460 } |
6618 | 461 #endif |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
462 aspect(&s_width, &s_height, A_ZOOM); |
5064 | 463 s_width -= s_width % 16; |
5281
88df6d5f6ce7
Aspect code reenabled, apparently users didn't like running movies
mswitch
parents:
5275
diff
changeset
|
464 s_height -= s_height % 16; |
5064 | 465 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
466 /* 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
|
467 /* 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
|
468 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
|
469 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
|
470 if (tmp1 < tmp2) { |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
471 ioval = EM8300_ASPECTRATIO_4_3; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
472 printf("VO: [dxr3] Setting aspect ratio to 4:3\n"); |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
473 } else { |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
474 ioval = EM8300_ASPECTRATIO_16_9; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
475 printf("VO: [dxr3] Setting aspect ratio to 16:9\n"); |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
476 } |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
477 ioctl(fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval); |
5064 | 478 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
479 #ifdef SPU_SUPPORT |
7151 | 480 #ifdef HAVE_FREETYPE |
481 s_width*=1.5; | |
482 #else | |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
483 s_width*=2; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
484 s_height*=2; |
7151 | 485 #endif |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
486 |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
487 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
|
488 if (osdpicbuf == NULL) { |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
489 printf("vo_dxr3: out of mem\n"); |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
490 return -1; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
491 } |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
492 spued = (encodedata *) malloc(sizeof(encodedata)); |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
493 if (spued == NULL) { |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
494 free( osdpicbuf ); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
495 printf("vo_dxr3:out of mem\n"); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
496 return -1; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
497 } |
7950 | 498 spubuf = (encodedata *) malloc(sizeof(encodedata)); |
499 if (spubuf == NULL) { | |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
500 free( osdpicbuf ); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
501 free( spued ); |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
502 printf("vo_dxr3:out of mem\n"); |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
503 return -1; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
504 } |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
505 osd_w = s_width; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
506 osd_h = s_height; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
507 osdpicbuf_w = s_width; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
508 osdpicbuf_h = s_height; |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
509 |
7950 | 510 spubuf->count=0; |
511 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
|
512 |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
513 #endif |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
514 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
515 #ifdef HAVE_X11 |
8088 | 516 if (dxr3_overlay) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
517 XVisualInfo vinfo; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
518 XSetWindowAttributes xswa; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
519 XSizeHints hint; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
520 unsigned long xswamask; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
521 Colormap cmap; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
522 XColor key_color; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
523 Window junkwindow; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
524 Screen *scr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
525 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
|
526 em8300_overlay_screen_t ovlscr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
527 em8300_attribute_t ovlattr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
528 |
8037 | 529 vo_dx = (vo_screenwidth - d_width) / 2; |
530 vo_dy = (vo_screenheight - d_height) / 2; | |
531 vo_dwidth = d_width; | |
532 vo_dheight = d_height; | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
533 #ifdef HAVE_NEW_GUI |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
534 if (use_gui) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
535 guiGetEvent(guiSetShVideo, 0); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
536 XSetWindowBackground(mDisplay, vo_window, KEY_COLOR); |
8037 | 537 XClearWindow(mDisplay, vo_window); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
538 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &xwin_attribs); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
539 depth = xwin_attribs.depth; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
540 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
541 depth = 24; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
542 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
543 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
544 } else |
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 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
547 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &xwin_attribs); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
548 depth = xwin_attribs.depth; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
549 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
550 depth = 24; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
551 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
552 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
553 xswa.background_pixel = KEY_COLOR; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
554 xswa.border_pixel = 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
555 xswamask = CWBackPixel | CWBorderPixel; |
8037 | 556 hint.y = vo_dy; |
557 hint.x = vo_dx; | |
558 hint.base_width = hint.width = vo_dwidth; | |
559 hint.base_height = hint.height = vo_dheight; | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
560 hint.flags = PPosition | PSize; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
561 vo_window = XCreateWindow(mDisplay, mRootWin, hint.x, hint.y, hint.width, hint.height, 0, depth, CopyFromParent, vinfo.visual, xswamask, &xswa); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
562 vo_x11_classhint(mDisplay, vo_window, "Viewing Window"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
563 vo_hidecursor(mDisplay, vo_window); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
564 vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PropertyChangeMask); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
565 XSetStandardProperties(mDisplay, vo_window, "DXR3 Overlay", "DXR3 Overlay", None, NULL, 0, &hint); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
566 XSetWMNormalHints(mDisplay, vo_window, &hint); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
567 XMapWindow(mDisplay, vo_window); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
568 XFlush(mDisplay); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
569 XSync(mDisplay, False); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
570 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
571 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
572 /* Start setting up overlay */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
573 XGetWindowAttributes(mDisplay, mRootWin, &xwin_attribs); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
574 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
|
575 overlay_read_state(overlay_data, NULL); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
576 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
577 /* Allocate keycolor */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
578 cmap = vo_x11_create_colormap(&vinfo); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
579 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
|
580 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
|
581 calculate_cvals(vinfo.blue_mask, &blue_shift, &blue_prec); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
582 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
583 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
|
584 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
|
585 key_color.blue = (KEY_COLOR & 0xff) * 256; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
586 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
|
587 ((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
|
588 ((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
|
589 key_color.flags = DoRed | DoGreen | DoBlue; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
590 if (!XAllocColor(mDisplay, cmap, &key_color)) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
591 printf("VO: [dxr3] Unable to allocate keycolor!\n"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
592 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
593 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
594 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
595 acq_color = ((key_color.red / 256) << 16) | ((key_color.green / 256) << 8) | key_color.blue; |
8037 | 596 if (key_color.pixel != KEY_COLOR) { |
597 printf("VO: [dxr3] Unable to allocate exact keycolor, using closest match (%0x)\n", key_color.pixel); | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
598 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
599 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
600 /* Set keycolor and activate overlay */ |
8037 | 601 XSetWindowBackground(mDisplay, vo_window, key_color.pixel); |
602 XClearWindow(mDisplay, vo_window); | |
603 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
|
604 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
|
605 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
|
606 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
607 #endif |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
608 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
609 return 0; |
2645 | 610 } |
611 | |
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
|
612 static const vo_info_t* get_info(void) |
2645 | 613 { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
614 return &vo_info; |
2645 | 615 } |
616 | |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
617 static void draw_alpha(int x, int y, int w, int h, unsigned char* src, unsigned char *srca, int srcstride) |
2645 | 618 { |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
619 #ifdef SPU_SUPPORT |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
620 unsigned char *buf = &osdpicbuf[(y * osdpicbuf_w) + x]; |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
621 int by = 0; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
622 register int lx, ly; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
623 register int stride = 0; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
624 |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
625 for (ly = 0; ly < h - 1; ly++) |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
626 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
627 for(lx = 0; lx < w; lx++ ) |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
628 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
|
629 by+=osdpicbuf_w; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
630 stride+=srcstride; |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
631 } |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
632 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
|
633 #endif |
2645 | 634 } |
635 | |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
636 extern int vo_osd_changed_flag; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
637 extern mp_osd_obj_t* vo_osd_list; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
638 |
2645 | 639 static void draw_osd(void) |
640 { | |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
641 #ifdef SPU_SUPPORT |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
642 static int cleared = 0; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
643 int changed = 0; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
644 |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
645 if ((disposd % 15) == 0) |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
646 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
647 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
648 mp_osd_obj_t* obj = vo_osd_list; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
649 vo_update_osd( osd_w,osd_h ); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
650 while( obj ) |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
651 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
652 if ( obj->flags & OSDFLAG_VISIBLE ) { changed=1; break; } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
653 obj=obj->next; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
654 } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
655 } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
656 if ( changed ) |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
657 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
658 vo_draw_text(osd_w, osd_h, draw_alpha); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
659 memset(osdpicbuf, 0, s_width * s_height); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
660 cleared=0; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
661 } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
662 else |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
663 { |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
664 if ( !cleared ) |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
665 { |
7950 | 666 spued->count=spubuf->count; |
667 memcpy( spued->data,spubuf->data,DATASIZE ); | |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
668 cleared=1; |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
669 } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
670 } |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
671 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
672 |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
673 /* 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
|
674 * 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
|
675 * 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
|
676 */ |
6748
c0e8034d47e4
Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents:
6647
diff
changeset
|
677 /* Subpics are not stable yet =( |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
678 expect lockups if you enable */ |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
679 #if 1 |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
680 write(fd_spu, spued->data, spued->count); |
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7009
diff
changeset
|
681 #endif |
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
|
682 } |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
683 disposd++; |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
684 #endif |
2645 | 685 } |
686 | |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
687 |
2645 | 688 static uint32_t draw_frame(uint8_t * src[]) |
689 { | |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
690 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
|
691 |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
692 #ifdef SPU_SUPPORT |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
693 if (p->id == 0x20) { |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
694 write(fd_spu, p->data, p->size); |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
695 } else |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
696 #endif |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
697 write(fd_video, p->data, p->size); |
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
698 return 0; |
2645 | 699 } |
700 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
701 static void flip_page(void) |
2645 | 702 { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
703 #ifdef HAVE_X11 |
8088 | 704 if (dxr3_overlay) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
705 int event = vo_x11_check_events(mDisplay); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
706 if (event & VO_EVENT_RESIZE) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
707 Window junkwindow; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
708 XGetWindowAttributes(mDisplay, vo_window, &xwin_attribs); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
709 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
|
710 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
|
711 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
712 if (event & VO_EVENT_EXPOSE) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
713 Window junkwindow; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
714 XSetWindowBackground(mDisplay, vo_window, KEY_COLOR); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
715 XClearWindow(mDisplay, vo_window); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
716 XGetWindowAttributes(mDisplay, vo_window, &xwin_attribs); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
717 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
|
718 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
|
719 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
720 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
721 #endif |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
722 |
8088 | 723 if (dxr3_newsync) { |
7950 | 724 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval); |
725 ioval <<= 1; | |
726 if (vo_pts == 0) { | |
727 ioval = 0; | |
728 ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval); | |
729 pts_offset = 0; | |
730 } else if ((vo_pts - pts_offset) < (ioval - 7200) || (vo_pts - pts_offset) > (ioval + 7200)) { | |
731 ioval = (vo_pts + pts_offset) >> 1; | |
732 ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval); | |
733 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval); | |
734 pts_offset = vo_pts - (ioval << 1); | |
735 if (pts_offset < 0) { | |
736 pts_offset = 0; | |
737 } | |
738 } | |
739 ioval = vo_pts + pts_offset; | |
740 ioctl(fd_video, EM8300_IOCTL_SPU_SETPTS, &ioval); | |
741 ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &ioval); | |
742 prev_pts = vo_pts; | |
8088 | 743 } else if (dxr3_prebuf) { |
7950 | 744 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
|
745 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
|
746 } |
2645 | 747 } |
748 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
749 static uint32_t draw_slice(uint8_t *srcimg[], int stride[], int w, int h, int x0, int y0) |
2645 | 750 { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
751 return -1; |
2645 | 752 } |
753 | |
3208 | 754 static void uninit(void) |
2645 | 755 { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
756 printf("VO: [dxr3] Uninitializing\n"); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
757 #ifdef HAVE_X11 |
8088 | 758 if (dxr3_overlay) { |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
759 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
|
760 overlay_release(overlay_data); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
761 |
8042 | 762 #ifdef HAVE_NEW_GUI |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
763 if (!use_gui) { |
8042 | 764 #endif |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
765 vo_x11_uninit(); |
8088 | 766 |
8042 | 767 #ifdef HAVE_NEW_GUI |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
768 } |
8042 | 769 #endif |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
770 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
771 #endif |
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
|
772 if (fd_video) { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
773 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
|
774 } |
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
|
775 if (fd_spu) { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
776 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
|
777 } |
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
|
778 if (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
|
779 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
|
780 } |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
781 #ifdef SPU_SUPPORT |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
782 if(osdpicbuf) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
783 free(osdpicbuf); |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
784 } |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
785 if(spued) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
786 free(spued); |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
787 } |
6647
c66284733f3d
removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents:
6618
diff
changeset
|
788 #endif |
2645 | 789 } |
790 | |
791 static void check_events(void) | |
792 { | |
793 } | |
4352 | 794 |
795 static uint32_t preinit(const char *arg) | |
796 { | |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
797 char devname[80]; |
4605 | 798 int fdflags = O_WRONLY; |
5097 | 799 |
7950 | 800 /* Parse commandline */ |
801 while (arg) { | |
8088 | 802 if (!strncmp("prebuf", arg, 6) && !dxr3_prebuf) { |
7950 | 803 printf("VO: [dxr3] Enabling prebuffering.\n"); |
8088 | 804 dxr3_prebuf = 1; |
805 fdflags |= O_NONBLOCK; | |
806 } else if (!strncmp("sync", arg, 4) && !dxr3_newsync) { | |
7950 | 807 printf("VO: [dxr3] Using new sync engine.\n"); |
8088 | 808 dxr3_newsync = 1; |
809 } else if (!strncmp("overlay", arg, 7) && !dxr3_overlay) { | |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
810 #ifdef HAVE_X11 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
811 printf("VO: [dxr3] Using overlay.\n"); |
8088 | 812 dxr3_overlay = 1; |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
813 #else |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
814 printf("VO: [dxr3] Error: You need to compile mplayer with x11 libraries and headers installed to use overlay.\n"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
815 #endif |
7950 | 816 } else if (arg[0] == '0' || arg[0] == '1' || arg[0] == '2' || arg[0] == '3') { |
8088 | 817 dxr3_device_num = arg[0]; |
7950 | 818 } |
819 | |
5377 | 820 arg = strchr(arg, ':'); |
821 if (arg) { | |
822 arg++; | |
823 } | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
824 } |
7950 | 825 |
5225 | 826 |
7950 | 827 /* Open the control interface */ |
8088 | 828 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
|
829 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
|
830 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
|
831 /* Fall back to old naming scheme */ |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
832 printf("VO: [dxr3] Error opening %s for writing, trying /dev/em8300 instead\n", devname); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
833 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
|
834 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
|
835 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
|
836 printf("VO: [dxr3] Error opening /dev/em8300 for writing as well!\nBailing\n"); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
837 return -1; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
838 } |
8088 | 839 } else { |
840 printf("VO: [dxr3] Opened %s\n", devname); | |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
841 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
842 |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
843 /* Open the video interface */ |
8088 | 844 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
|
845 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
|
846 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
|
847 /* Fall back to old naming scheme */ |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
848 printf("VO: [dxr3] Error opening %s for writing, trying /dev/em8300_mv instead\n", devname); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
849 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
|
850 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
|
851 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
|
852 printf("VO: [dxr3] Error opening /dev/em8300_mv for writing as well!\nBailing\n"); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
853 uninit(); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
854 return -1; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
855 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
856 } else { |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
857 printf("VO: [dxr3] Opened %s\n", devname); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
858 } |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
859 strcpy(fdv_name, devname); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
860 |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
861 /* Open the subpicture interface */ |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
862 fdflags |= O_NONBLOCK; |
8088 | 863 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
|
864 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
|
865 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
|
866 /* Fall back to old naming scheme */ |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
867 printf("VO: [dxr3] Error opening %s for writing, trying /dev/em8300_sp instead\n", devname); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
868 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
|
869 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
|
870 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
|
871 printf("VO: [dxr3] Error opening /dev/em8300_sp for writing as well!\nBailing\n"); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
872 uninit(); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
873 return -1; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
874 } |
8088 | 875 } else { |
876 printf("VO: [dxr3] Opened %s\n", devname); | |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
877 } |
5499
58864ce0eef7
Fixed bug that would cause the dxr3 to lock if too many subpics were sent at once
mswitch
parents:
5497
diff
changeset
|
878 strcpy(fds_name, devname); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
879 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
880 #ifdef HAVE_X11 |
8088 | 881 if (dxr3_overlay) { |
7950 | 882 |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
883 /* Fucked up hack needed to enable overlay. |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
884 * 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
|
885 * 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
|
886 */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
887 Display *dpy; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
888 overlay_t *ov; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
889 XWindowAttributes attribs; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
890 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
891 dpy = XOpenDisplay(NULL); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
892 if (!dpy) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
893 printf("VO: [dxr3] Unable to open display during overlay hack setup!\n"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
894 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
895 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
896 XGetWindowAttributes(dpy, RootWindow(dpy, DefaultScreen(dpy)), &attribs); |
8037 | 897 ov = overlay_init(fd_control); |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
898 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
|
899 overlay_read_state(ov, NULL); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
900 overlay_set_keycolor(ov, KEY_COLOR); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
901 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
|
902 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
|
903 overlay_release(ov); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
904 XCloseDisplay(dpy); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
905 /* End of fucked up hack */ |
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 /* Initialize overlay and X11 */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
908 overlay_data = overlay_init(fd_control); |
8042 | 909 #ifdef HAVE_NEW_GUI |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
910 if (!use_gui) { |
8042 | 911 #endif |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
912 if (!vo_init()) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
913 printf("VO: [dxr3] Unable to init x11!\n"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
914 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
915 } |
8042 | 916 #ifdef HAVE_NEW_GUI |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
917 } |
8042 | 918 #endif |
8031
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 #endif |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
921 |
8088 | 922 if (dxr3_newsync) { |
923 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval); | |
924 pts_offset = vo_pts - (ioval << 1); | |
925 if (pts_offset < 0) { | |
926 pts_offset = 0; | |
927 } | |
928 } | |
929 | |
4480 | 930 return 0; |
4352 | 931 } |
8031
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 /* Begin overlay.c */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
934 static int update_parameters(overlay_t *o) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
935 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
936 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
|
937 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
|
938 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
|
939 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
|
940 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
|
941 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
942 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
943 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
944 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
|
945 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
946 em8300_attribute_t attr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
947 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
948 attr.attribute = attribute; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
949 attr.value = value; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
950 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
|
951 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
952 perror("Failed set attribute"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
953 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
954 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
955 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
956 return 0; |
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 overlay_t *overlay_init(int dev) |
8031
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
960 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
961 overlay_t *o; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
962 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
963 o = (overlay_t *) malloc(sizeof(overlay_t)); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
964 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
965 if(!o) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
966 return NULL; |
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 memset(o,sizeof(overlay_t),0); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
969 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
970 o->dev = dev; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
971 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
|
972 o->color_interval=10; |
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 return o; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
975 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
976 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
977 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
|
978 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
979 if(o) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
980 free(o); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
981 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
982 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
983 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
984 #define TYPE_INT 1 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
985 #define TYPE_XINT 2 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
986 #define TYPE_COEFF 3 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
987 #define TYPE_FLOAT 4 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
988 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
989 struct lut_entry { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
990 char *name; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
991 int type; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
992 void *ptr; |
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 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
995 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
|
996 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
997 struct lut_entry m[] = { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
998 {"xoffset", TYPE_INT, &o->xoffset}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
999 {"yoffset", TYPE_INT, &o->yoffset}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1000 {"xcorr", TYPE_INT, &o->xcorr}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1001 {"jitter", TYPE_INT, &o->jitter}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1002 {"stability", TYPE_INT, &o->stability}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1003 {"keycolor", TYPE_XINT, &o->keycolor}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1004 {"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
|
1005 {"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
|
1006 {"color_interval", TYPE_FLOAT, &o->color_interval}, |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1007 {0,0,0} |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1008 },*p; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1009 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1010 p = malloc(sizeof(m)); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1011 memcpy(p,m,sizeof(m)); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1012 return p; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1013 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1014 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1015 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
|
1016 int i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1017 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1018 for(i=0; lut[i].name; i++) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1019 if(!strcmp(name,lut[i].name)) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1020 *ptr = lut[i].ptr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1021 *type = lut[i].type; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1022 return 1; |
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 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1026 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1027 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1028 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
|
1029 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1030 char *a,*tok; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1031 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
|
1032 FILE *fp; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1033 struct lut_entry *lut; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1034 void *ptr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1035 int type; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1036 int j; |
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 if(!p) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1039 strcpy(fname,getenv("HOME")); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1040 strcat(fname,"/.overlay"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1041 } else |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1042 strcpy(fname,p); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1043 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1044 sprintf(tmp,"/res_%dx%dx%d",o->xres,o->yres,o->depth); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1045 strcat(fname,tmp); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1046 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1047 if(!(fp=fopen(fname,"r"))) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1048 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1049 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1050 lut = new_lookuptable(o); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1051 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1052 while(!feof(fp)) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1053 if(!fgets(line,256,fp)) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1054 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1055 tok=strtok(line," "); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1056 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
|
1057 tok=strtok(NULL," "); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1058 switch(type) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1059 case TYPE_INT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1060 sscanf(tok,"%d",(int *)ptr); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1061 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1062 case TYPE_XINT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1063 sscanf(tok,"%x",(int *)ptr); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1064 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1065 case TYPE_FLOAT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1066 sscanf(tok,"%f",(float *)ptr); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1067 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1068 case TYPE_COEFF: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1069 for(j=0;j<3;j++) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1070 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
|
1071 tok=strtok(NULL," "); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1072 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
|
1073 tok=strtok(NULL," "); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1074 } |
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 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1077 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1078 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1079 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1080 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1081 update_parameters(o); |
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 free(lut); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1084 fclose(fp); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1085 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1086 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1087 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1088 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
|
1089 update_parameters(o); |
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 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1092 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
|
1093 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1094 char *a; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1095 char path[128],fname[128],tmp[128]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1096 FILE *fp; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1097 char line[256],*tok; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1098 struct lut_entry *lut; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1099 int i,j; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1100 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1101 if(!p) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1102 strcpy(fname,getenv("HOME")); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1103 strcat(fname,"/.overlay"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1104 } else |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1105 strcpy(fname,p); |
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 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
|
1108 if(mkdir(fname,0766)) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1109 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1110 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1111 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1112 sprintf(tmp,"/res_%dx%dx%d",o->xres,o->yres,o->depth); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1113 strcat(fname,tmp); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1114 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1115 if(!(fp=fopen(fname,"w"))) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1116 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1117 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1118 lut = new_lookuptable(o); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1119 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1120 for(i=0; lut[i].name; i++) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1121 fprintf(fp,"%s ",lut[i].name); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1122 switch(lut[i].type) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1123 case TYPE_INT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1124 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
|
1125 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1126 case TYPE_XINT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1127 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
|
1128 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1129 case TYPE_FLOAT: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1130 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
|
1131 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1132 case TYPE_COEFF: |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1133 for(j=0;j<3;j++) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1134 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
|
1135 ((struct coeff *)lut[i].ptr)[j].m); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1136 fprintf(fp,"\n"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1137 break; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1138 } |
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 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1141 fclose(fp); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1142 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1143 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1144 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1145 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
|
1146 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1147 em8300_overlay_screen_t scr; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1148 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1149 o->xres = xres; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1150 o->yres = yres; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1151 o->depth = depth; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1152 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1153 scr.xsize = xres; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1154 scr.ysize = yres; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1155 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1156 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
|
1157 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1158 perror("Failed set screen...exiting"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1159 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1160 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1161 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1162 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1163 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1164 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
|
1165 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1166 if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETMODE, &mode)==-1) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1167 perror("Failed enabling overlay..exiting"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1168 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1169 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1170 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1171 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1172 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1173 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
|
1174 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1175 em8300_overlay_window_t win; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1176 win.xpos = xpos; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1177 win.ypos = ypos; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1178 win.width = width; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1179 win.height = height; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1180 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1181 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
|
1182 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1183 perror("Failed resizing window"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1184 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1185 } |
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 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1189 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
|
1190 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1191 em8300_bcs_t bcs; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1192 bcs.brightness = brightness; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1193 bcs.contrast = contrast; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1194 bcs.saturation = saturation; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1195 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1196 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
|
1197 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1198 perror("Failed setting bcs"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1199 return -1; |
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 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1202 } |
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 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
|
1205 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1206 float y; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1207 y = x*c.k + c.m; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1208 if(y > 255) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1209 y = 255; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1210 if(y < 0) |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1211 y = 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1212 return rint(y); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1213 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1214 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1215 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
|
1216 int r = (color & 0xff0000) >> 16; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1217 int g = (color & 0x00ff00) >> 8; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1218 int b = (color & 0x0000ff); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1219 float ru,gu,bu; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1220 float rl,gl,bl; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1221 int upper,lower; |
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 ru = r+o->color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1224 gu = g+o->color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1225 bu = b+o->color_interval; |
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 rl = r-o->color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1228 gl = g-o->color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1229 bl = b-o->color_interval; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1230 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1231 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
|
1232 (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
|
1233 (col_interp(bu, o->colcal_upper[2])); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1234 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1235 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
|
1236 (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
|
1237 (col_interp(bl, o->colcal_lower[2])); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1238 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1239 //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
|
1240 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
|
1241 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
|
1242 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1243 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1244 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1245 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
|
1246 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1247 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
|
1248 float delta,b; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1249 int i; |
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 for(i=0; i < n; i++) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1252 sx=sx+x[i]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1253 sy=sy+y[i]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1254 sxx=sxx+x[i]*x[i]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1255 sxy=sxy+x[i]*y[i]; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1256 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1257 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1258 delta=sxx*n-sx*sx; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1259 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1260 *m=(sxx*sy-sx*sxy)/delta; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1261 *k=(sxy*n-sx*sy)/delta; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1262 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1263 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1264 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
|
1265 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1266 em8300_overlay_calibrate_t cal; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1267 em8300_overlay_window_t win; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1268 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
|
1269 float k,m; |
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 int i; |
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 o->draw_pattern=pd; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1274 o->dp_arg = arg; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1275 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1276 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
|
1277 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
|
1278 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1279 /* Calibrate Y-offset */ |
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 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
|
1282 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1283 cal.cal_mode = EM8300_OVERLAY_CALMODE_YOFFSET; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1284 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
|
1285 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1286 perror("Failed getting Yoffset values...exiting"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1287 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1288 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1289 o->yoffset = cal.result; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1290 printf("Yoffset: %d\n",cal.result); |
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 /* Calibrate X-offset */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1293 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1294 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
|
1295 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1296 cal.cal_mode = EM8300_OVERLAY_CALMODE_XOFFSET; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1297 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
|
1298 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1299 perror("Failed getting Xoffset values...exiting"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1300 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1301 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1302 o->xoffset = cal.result; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1303 printf("Xoffset: %d\n",cal.result); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1304 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1305 /* Calibrate X scale correction */ |
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 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
|
1308 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1309 cal.cal_mode = EM8300_OVERLAY_CALMODE_XCORRECTION; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1310 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
|
1311 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1312 perror("Failed getting Xoffset values...exiting"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1313 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1314 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1315 printf("Xcorrection: %d\n",cal.result); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1316 o->xcorr = cal.result; |
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 win.xpos = 10; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1319 win.ypos = 10; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1320 win.width = o->xres-20; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1321 win.height = o->yres-20; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1322 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
|
1323 perror("Failed resizing window"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1324 exit(1); |
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 /* Calibrate key color upper limit */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1328 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1329 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
|
1330 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
|
1331 (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
|
1332 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1333 cal.arg = i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1334 cal.arg2 = 1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1335 cal.cal_mode = EM8300_OVERLAY_CALMODE_COLOR; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1336 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1337 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
|
1338 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1339 return -1 ; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1340 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1341 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1342 x[n] = i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1343 r[n] = (cal.result>>16)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1344 g[n] = (cal.result>>8)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1345 b[n] = (cal.result)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1346 n++; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1347 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1348 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1349 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
|
1350 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
|
1351 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
|
1352 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1353 /* Calibrate key color lower limit */ |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1354 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1355 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
|
1356 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
|
1357 (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
|
1358 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1359 cal.arg = i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1360 cal.arg2 = 2; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1361 cal.cal_mode = EM8300_OVERLAY_CALMODE_COLOR; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1362 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1363 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
|
1364 { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1365 return -1 ; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1366 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1367 x[n] = i; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1368 r[n] = (cal.result>>16)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1369 g[n] = (cal.result>>8)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1370 b[n] = (cal.result)&0xff; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1371 n++; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1372 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1373 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1374 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
|
1375 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
|
1376 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
|
1377 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1378 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
|
1379 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1380 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1381 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1382 |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1383 |
8092
f880c1de0e9b
Made new overlay functions static so they won't interfere with the rest
mswitch
parents:
8091
diff
changeset
|
1384 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
|
1385 if(ioctl(o->dev, EM8300_IOCTL_OVERLAY_SIGNALMODE, &mode) ==-1) { |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1386 perror("Failed set signal mix"); |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1387 return -1; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1388 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1389 return 0; |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1390 } |
ad62a544964c
Huge update, added native overlay support (no more need for dxr3view).
mswitch
parents:
7989
diff
changeset
|
1391 /* End overlay.c */ |