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