annotate libvo/vo_dxr3.c @ 8016:892c73ce9ba3

I ported mplayer to the GNU system (also known as GNU/Hurd), it was just a matter of adding it to the makefiles and other misc fix. Patch by Robert Millan <zeratul2@wanadoo.es>
author arpi
date Fri, 01 Nov 2002 00:05:56 +0000
parents 31d6c10b8887
children ad62a544964c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6748
c0e8034d47e4 Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents: 6647
diff changeset
1 /*
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
2 * vo_dxr3.c - DXR3/H+ video out
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
3 *
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
4 * Copyright (C) 2002 David Holm <dholm@iname.com>
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
5 *
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
6 */
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
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
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
9 * 2002-10-29:
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
10 * Added new sync-engine, activate with :sync option.
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
11 * Greatly improved commandline parser.
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
12 * Replaced :noprebuf with :prebuf and made noprebuf the default.
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
13 *
7945
32939f2b3d2e Fixed stupid bug relating to multiple cards on athlons
mswitch
parents: 7932
diff changeset
14 * 2002-10-28:
32939f2b3d2e Fixed stupid bug relating to multiple cards on athlons
mswitch
parents: 7932
diff changeset
15 * Fixed multicard bug on athlons
32939f2b3d2e Fixed stupid bug relating to multiple cards on athlons
mswitch
parents: 7932
diff changeset
16 *
6748
c0e8034d47e4 Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents: 6647
diff changeset
17 * 2002-07-18:
c0e8034d47e4 Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents: 6647
diff changeset
18 * 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
19 *
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
20 * 2002-07-05:
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
21 * 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
22 * Added graphic equalizer support.
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
23 *
5647
5a2d49aa72c2 Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents: 5547
diff changeset
24 * 2002-04-15:
5a2d49aa72c2 Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents: 5547
diff changeset
25 * 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
26 * 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
27 *
5490
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
28 * 2002-04-03:
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
29 * Carl George added spuenc support
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
30 *
5361
3e81a50e33ff XorA added the option of switching between fame/avcodec without
mswitch
parents: 5330
diff changeset
31 * 2002-03-26:
3e81a50e33ff XorA added the option of switching between fame/avcodec without
mswitch
parents: 5330
diff changeset
32 * 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
33 * codec. We thank him again.
3e81a50e33ff XorA added the option of switching between fame/avcodec without
mswitch
parents: 5330
diff changeset
34 *
5330
5766e8098794 Bugfix by XorA
mswitch
parents: 5310
diff changeset
35 * 2002-03-25:
5766e8098794 Bugfix by XorA
mswitch
parents: 5310
diff changeset
36 * A couple of bugfixes by XorA
5766e8098794 Bugfix by XorA
mswitch
parents: 5310
diff changeset
37 *
5273
8af542acc1b6 Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents: 5225
diff changeset
38 * 2002-03-23:
8af542acc1b6 Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents: 5225
diff changeset
39 * 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
40 * 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
41 *
5134
83b3dc5132a5 Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents: 5132
diff changeset
42 * 2002-03-16:
83b3dc5132a5 Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents: 5132
diff changeset
43 * 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
44 * 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
45 * with fame.
83b3dc5132a5 Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents: 5132
diff changeset
46 *
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
47 * 2002-03-13:
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
48 * Preliminary fame support added (it breaks after seeking, why?)
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
49 *
4755
67c33b0fb847 Accidentally mixed experimental code with stable one during last commit,
mswitch
parents: 4754
diff changeset
50 * 2002-02-18:
67c33b0fb847 Accidentally mixed experimental code with stable one during last commit,
mswitch
parents: 4754
diff changeset
51 * 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
52 *
4723
93e959f0a6e4 Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents: 4685
diff changeset
53 * 2002-02-16:
93e959f0a6e4 Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents: 4685
diff changeset
54 * 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
55 * 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
56 *
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
57 * 2002-02-13:
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
58 * 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
59 * 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
60 * 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
61 * 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
62 * 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
63 *
4602
e4a96fe4f3d2 Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents: 4596
diff changeset
64 * 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
65 * 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
66 * 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
67 * 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
68 * 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
69 *
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
70 * 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
71 * 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
72 *
4480
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
73 * 2002-02-02:
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
74 * Cleaned out some old code which might have slowed down writes
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
75 *
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
76 * 2002-01-17:
4219
70888f501b4a Fixed seeking
mswitch
parents: 4218
diff changeset
77 * 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
78 *
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
79 * 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
80 * 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
81 * 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
82 *
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
83 * 2002-01-10:
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
84 * 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
85 * 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
86 * find any inconcistencies.
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
87 */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
88
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
89 #include <linux/em8300.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
90 #include <sys/ioctl.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
91 #include <sys/stat.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
92 #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
93 #include <sys/select.h>
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
94 #include <unistd.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
95 #include <stdio.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
96 #include <stdlib.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
97 #include <string.h>
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
98 #include <fcntl.h>
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
99 #include <stdio.h>
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
100 #include <time.h>
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
101
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
102 #include "config.h"
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
103 #include "fastmemcpy.h"
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
104
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
105 #include "video_out.h"
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
106 #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
107 #include "aspect.h"
5490
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
108 #include "spuenc.h"
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
109 #include "sub.h"
5361
3e81a50e33ff XorA added the option of switching between fame/avcodec without
mswitch
parents: 5330
diff changeset
110
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
111 #define SPU_SUPPORT
5361
3e81a50e33ff XorA added the option of switching between fame/avcodec without
mswitch
parents: 5330
diff changeset
112
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
113 static vo_info_t vo_info =
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
114 {
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
115 "DXR3/H+ video out",
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
116 "dxr3",
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
117 "David Holm <dholm@iname.com>",
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
118 ""
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
119 };
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
120 LIBVO_EXTERN (dxr3)
5377
f7402401318c lego++ bug fixed by XorA
mswitch
parents: 5361
diff changeset
121
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
122 /* Resolutions and positions */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
123 static int v_width, v_height;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
124 static int s_width, s_height;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
125 static int osd_w, osd_h;
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
126 static int prebuf = 0;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
127 static int newsync = 0;
2770
b9732eaa82d9 DXR3 beta2 patch by David Holm.
atmos4
parents: 2732
diff changeset
128 static int img_format = 0;
3329
529a001496c2 Switched from rte which caused alot of problems for some users to libmp1e.
mswitch
parents: 3232
diff changeset
129
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
130 /* File descriptors */
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
131 static int fd_control = -1;
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
132 static int fd_video = -1;
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
133 static int fd_spu = -1;
4602
e4a96fe4f3d2 Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents: 4596
diff changeset
134 static char fdv_name[80];
5499
58864ce0eef7 Fixed bug that would cause the dxr3 to lock if too many subpics were sent at once
mswitch
parents: 5497
diff changeset
135 static char fds_name[80];
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
136
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
137 #ifdef SPU_SUPPORT
5490
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
138 /* on screen display/subpics */
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
139 static char *osdpicbuf = NULL;
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
140 static int osdpicbuf_w;
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
141 static int osdpicbuf_h;
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
142 static int disposd = 0;
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
143 static encodedata *spued;
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
144 static encodedata *spubuf;
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
145 #endif
5490
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
146
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
147 /* Static variable used in ioctl's */
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
148 static int ioval = 0;
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
149 static int prev_pts = 0;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
150 static int pts_offset = 0;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
151
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
152 static int get_video_eq(vidix_video_eq_t *info);
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
153 static int set_video_eq(vidix_video_eq_t *info);
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
154
7932
arpi
parents: 7151
diff changeset
155 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
156 {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
157 switch (request) {
7009
98bed9e12087 - add dxr3 gui support (dialogbox, etc.)
pontscho
parents: 6843
diff changeset
158 case VOCTRL_GUISUPPORT:
98bed9e12087 - add dxr3 gui support (dialogbox, etc.)
pontscho
parents: 6843
diff changeset
159 case VOCTRL_GUI_NOWINDOW:
98bed9e12087 - add dxr3 gui support (dialogbox, etc.)
pontscho
parents: 6843
diff changeset
160 return VO_TRUE;
4754
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
161 case VOCTRL_RESUME:
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
162 if (prebuf) {
4754
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
163 ioval = EM8300_PLAYMODE_PLAY;
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
164 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
165 printf("VO: [dxr3] Unable to set playmode!\n");
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
166 }
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
167 }
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
168 return VO_TRUE;
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
169 case VOCTRL_PAUSE:
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
170 if (prebuf) {
4754
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
171 ioval = EM8300_PLAYMODE_PAUSED;
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
172 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
173 printf("VO: [dxr3] Unable to set playmode!\n");
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
174 }
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
175 }
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
176 return VO_TRUE;
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
177 case VOCTRL_RESET:
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
178 if (prebuf || sync) {
4605
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
179 close(fd_video);
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
180 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
181 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
182 fd_spu = open(fds_name, O_WRONLY);
4609
272b0a173417 Fixed a bug where seeking would lock mplayer
mswitch
parents: 4607
diff changeset
183 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
184 fsync(fd_spu);
4605
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
185 }
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
186 return VO_TRUE;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
187 case VOCTRL_QUERY_FORMAT:
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
188 {
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
189 uint32_t flag = 0;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
190
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
191 if (*((uint32_t*)data) != IMGFMT_MPEGPES)
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
192 return 0;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
193
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
194 flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_SPU;
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
195 if (prebuf)
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
196 flag |= VFCAP_TIMER;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
197 return flag;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
198 }
6787
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
199 case VOCTRL_SET_EQUALIZER:
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
200 {
6787
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
201 va_list ap;
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
202 int value;
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
203 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
204
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
205 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
206 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
207 va_end(ap);
6748
c0e8034d47e4 Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents: 6647
diff changeset
208
6787
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
209 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
210 return VO_FALSE;
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
211 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
212 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
213 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
214 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
215 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
216 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
217 else return VO_FALSE;
fad0147bd3aa - add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents: 7067
diff changeset
218
6787
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
219 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
220 return VO_FALSE;
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
221 return VO_TRUE;
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
222 }
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
223 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
224 {
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
225 va_list ap;
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
226 int *value;
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
227 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
228
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
229 va_start(ap, data);
6843
arpi
parents: 6787
diff changeset
230 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
231 va_end(ap);
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
232
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
233 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
234 return VO_FALSE;
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
235
f6a349add30d eq synced to new way, not tested, but the old one isn't working yet
alex
parents: 6748
diff changeset
236 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
237 *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
238 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
239 *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
240 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
241 *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
242 else return VO_FALSE;
fad0147bd3aa - add dxr3 equ patch from "Szombathelyi [iso-8859-2] Gy«Órgy" <gyurco@freemail.hu>
pontscho
parents: 7067
diff changeset
243
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
244 return VO_TRUE;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
245 }
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
246 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
247 return VO_NOTIMPL;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
248 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
249
7124
eca7dbad0166 finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents: 7095
diff changeset
250 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
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
251 {
4754
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
252 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
253 em8300_register_t reg;
5273
8af542acc1b6 Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents: 5225
diff changeset
254 extern float monitor_aspect;
6748
c0e8034d47e4 Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents: 6647
diff changeset
255
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
256 /* 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
257 /* 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
258 /* 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
259 /* up in a lockup */
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
260 ioval = EM8300_SPUMODE_ON;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
261 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
262 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
263 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
264 return -1;
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
265 }
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
266
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
267 /* 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
268 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
269 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
270 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
271 }
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
272
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
273 /* Start em8300 prebuffering and sync engine */
6618
d6c07ebda746 fix compile bug with driver 0.9+
pontscho
parents: 6212
diff changeset
274 #ifdef MVCOMMAND_SYNC
4218
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
275 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
276 reg.reg = 0;
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
277 reg.val = MVCOMMAND_SYNC;
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
278 ioctl(fd_control, EM8300_IOCTL_WRITEREG, &reg);
6618
d6c07ebda746 fix compile bug with driver 0.9+
pontscho
parents: 6212
diff changeset
279 #endif
d6c07ebda746 fix compile bug with driver 0.9+
pontscho
parents: 6212
diff changeset
280
d6c07ebda746 fix compile bug with driver 0.9+
pontscho
parents: 6212
diff changeset
281 #ifdef EM8300_IOCTL_FLUSH
4607
da09673aea00 Removed some stuff from the em8300 driver, had to compensate
mswitch
parents: 4605
diff changeset
282 /* Clean buffer by syncing it */
4609
272b0a173417 Fixed a bug where seeking would lock mplayer
mswitch
parents: 4607
diff changeset
283 ioval = EM8300_SUBDEVICE_VIDEO;
272b0a173417 Fixed a bug where seeking would lock mplayer
mswitch
parents: 4607
diff changeset
284 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval);
272b0a173417 Fixed a bug where seeking would lock mplayer
mswitch
parents: 4607
diff changeset
285 ioval = EM8300_SUBDEVICE_AUDIO;
272b0a173417 Fixed a bug where seeking would lock mplayer
mswitch
parents: 4607
diff changeset
286 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval);
6618
d6c07ebda746 fix compile bug with driver 0.9+
pontscho
parents: 6212
diff changeset
287 #endif
d6c07ebda746 fix compile bug with driver 0.9+
pontscho
parents: 6212
diff changeset
288
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
289 /* Sync the video device to make sure the buffers are empty
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
290 * and set the playback speed to normal. Also reset the
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
291 * em8300 internal clock.
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
292 */
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
293 fsync(fd_video);
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
294 ioval = 0x900;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
295 ioctl(fd_control, EM8300_IOCTL_SCR_SETSPEED, &ioval);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
296 ioval = 0;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
297 ioctl(fd_control, EM8300_IOCTL_SCR_SET, &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
298
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
299 /* 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
300 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
301 v_width = width;
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
302 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
303
5273
8af542acc1b6 Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents: 5225
diff changeset
304 /* 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
305 monitor_aspect = (float) width / (float) height;
8af542acc1b6 Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents: 5225
diff changeset
306
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
307 /* 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
308 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
309 aspect_save_prescale(d_width, d_height);
6618
d6c07ebda746 fix compile bug with driver 0.9+
pontscho
parents: 6212
diff changeset
310 #ifdef EM8300_IOCTL_GET_VIDEOMODE
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
311 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
312 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
313 printf("VO: [dxr3] Setting up for NTSC.\n");
5065
0d0694219daf This will slow down wobbling (just a bit)
mswitch
parents: 5064
diff changeset
314 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
315 } else {
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
316 printf("VO: [dxr3] Setting up for PAL/SECAM.\n");
5065
0d0694219daf This will slow down wobbling (just a bit)
mswitch
parents: 5064
diff changeset
317 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
318 }
6618
d6c07ebda746 fix compile bug with driver 0.9+
pontscho
parents: 6212
diff changeset
319 #endif
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
320 aspect(&s_width, &s_height, A_ZOOM);
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
321 s_width -= s_width % 16;
5281
88df6d5f6ce7 Aspect code reenabled, apparently users didn't like running movies
mswitch
parents: 5275
diff changeset
322 s_height -= s_height % 16;
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
323
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
324 /* 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
325 /* 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
326 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
327 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
328 if (tmp1 < tmp2) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
329 ioval = EM8300_ASPECTRATIO_4_3;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
330 printf("VO: [dxr3] Setting aspect ratio to 4:3\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
331 } else {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
332 ioval = EM8300_ASPECTRATIO_16_9;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
333 printf("VO: [dxr3] Setting aspect ratio to 16:9\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
334 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
335 ioctl(fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval);
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
336
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
337 #ifdef SPU_SUPPORT
7151
9e17b153b785 - fix window handling with dxr3
pontscho
parents: 7124
diff changeset
338 #ifdef HAVE_FREETYPE
9e17b153b785 - fix window handling with dxr3
pontscho
parents: 7124
diff changeset
339 s_width*=1.5;
9e17b153b785 - fix window handling with dxr3
pontscho
parents: 7124
diff changeset
340 #else
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
341 s_width*=2;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
342 s_height*=2;
7151
9e17b153b785 - fix window handling with dxr3
pontscho
parents: 7124
diff changeset
343 #endif
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
344
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
345 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
346 if (osdpicbuf == NULL) {
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
347 printf("vo_dxr3: out of mem\n");
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
348 return -1;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
349 }
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
350 spued = (encodedata *) malloc(sizeof(encodedata));
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
351 if (spued == NULL) {
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
352 free( osdpicbuf );
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
353 printf("vo_dxr3:out of mem\n");
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
354 return -1;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
355 }
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
356 spubuf = (encodedata *) malloc(sizeof(encodedata));
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
357 if (spubuf == NULL) {
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
358 free( osdpicbuf );
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
359 free( spued );
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
360 printf("vo_dxr3:out of mem\n");
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
361 return -1;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
362 }
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
363 osd_w = s_width;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
364 osd_h = s_height;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
365 osdpicbuf_w = s_width;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
366 osdpicbuf_h = s_height;
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
367
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
368 spubuf->count=0;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
369 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
370
5361
3e81a50e33ff XorA added the option of switching between fame/avcodec without
mswitch
parents: 5330
diff changeset
371 #endif
3e81a50e33ff XorA added the option of switching between fame/avcodec without
mswitch
parents: 5330
diff changeset
372
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
373 return 0;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
374 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
375
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
376 static const vo_info_t* get_info(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
377 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
378 return &vo_info;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
379 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
380
4602
e4a96fe4f3d2 Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents: 4596
diff changeset
381 static void draw_alpha(int x, int y, int w, int h, unsigned char* src, unsigned char *srca, int srcstride)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
382 {
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
383 #ifdef SPU_SUPPORT
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
384 unsigned char *buf = &osdpicbuf[(y * osdpicbuf_w) + x];
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
385 int by = 0;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
386 register int lx, ly;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
387 register int stride = 0;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
388
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
389 for (ly = 0; ly < h - 1; ly++)
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
390 {
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
391 for(lx = 0; lx < w; lx++ )
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
392 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
393 by+=osdpicbuf_w;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
394 stride+=srcstride;
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
395 }
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
396 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
397 #endif
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
398 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
399
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
400 extern int vo_osd_changed_flag;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
401 extern mp_osd_obj_t* vo_osd_list;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
402
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
403 static void draw_osd(void)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
404 {
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
405 #ifdef SPU_SUPPORT
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
406 static int cleared = 0;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
407 int changed = 0;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
408
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
409 if ((disposd % 15) == 0)
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
410 {
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
411 {
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
412 mp_osd_obj_t* obj = vo_osd_list;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
413 vo_update_osd( osd_w,osd_h );
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
414 while( obj )
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
415 {
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
416 if ( obj->flags & OSDFLAG_VISIBLE ) { changed=1; break; }
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
417 obj=obj->next;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
418 }
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
419 }
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
420 if ( changed )
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
421 {
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
422 vo_draw_text(osd_w, osd_h, draw_alpha);
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
423 memset(osdpicbuf, 0, s_width * s_height);
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
424 cleared=0;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
425 }
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
426 else
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
427 {
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
428 if ( !cleared )
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
429 {
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
430 spued->count=spubuf->count;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
431 memcpy( spued->data,spubuf->data,DATASIZE );
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
432 cleared=1;
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
433 }
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
434 }
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
435
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
436
5490
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
437 /* 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
438 * 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
439 * 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
440 */
6748
c0e8034d47e4 Disabled spuenc, it still doesn't work well with the em8300
mswitch
parents: 6647
diff changeset
441 /* Subpics are not stable yet =(
7067
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
442 expect lockups if you enable */
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
443 #if 1
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
444 write(fd_spu, spued->data, spued->count);
b395b1240954 fix dxr3 subtitle handling and add some optimizations
pontscho
parents: 7009
diff changeset
445 #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
446 }
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
447 disposd++;
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
448 #endif
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
449 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
450
5490
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
451
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
452 static uint32_t draw_frame(uint8_t * src[])
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
453 {
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
454 vo_mpegpes_t *p = (vo_mpegpes_t *) src[0];
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
455
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
456 #ifdef SPU_SUPPORT
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
457 if (p->id == 0x20) {
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
458 write(fd_spu, p->data, p->size);
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
459 } else
5361
3e81a50e33ff XorA added the option of switching between fame/avcodec without
mswitch
parents: 5330
diff changeset
460 #endif
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
461 write(fd_video, p->data, p->size);
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
462 return 0;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
463 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
464
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
465 static void flip_page(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
466 {
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
467 if (newsync) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
468 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
469 ioval <<= 1;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
470 if (vo_pts == 0) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
471 ioval = 0;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
472 ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
473 pts_offset = 0;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
474 } else if ((vo_pts - pts_offset) < (ioval - 7200) || (vo_pts - pts_offset) > (ioval + 7200)) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
475 ioval = (vo_pts + pts_offset) >> 1;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
476 ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
477 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
478 pts_offset = vo_pts - (ioval << 1);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
479 if (pts_offset < 0) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
480 pts_offset = 0;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
481 }
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
482 }
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
483 ioval = vo_pts + pts_offset;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
484 ioctl(fd_video, EM8300_IOCTL_SPU_SETPTS, &ioval);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
485 ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &ioval);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
486 prev_pts = vo_pts;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
487 } else if (prebuf) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
488 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
489 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
490 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
491 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
492
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
493 static uint32_t draw_slice(uint8_t *srcimg[], int stride[], int w, int h, int x0, int y0)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
494 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
495 return -1;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
496 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
497
3208
98a587aaf505 Support for YV12 with DXR3, patch by D. Holm.
atmos4
parents: 3201
diff changeset
498 static void uninit(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
499 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
500 printf("VO: [dxr3] Uninitializing\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
501 if (fd_video) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
502 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
503 }
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
504 if (fd_spu) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
505 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
506 }
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
507 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
508 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
509 }
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
510 #ifdef SPU_SUPPORT
5490
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
511 if(osdpicbuf) {
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
512 free(osdpicbuf);
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
513 }
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
514 if(spued) {
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
515 free(spued);
78bd1fa449c3 Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents: 5397
diff changeset
516 }
6647
c66284733f3d removed fame and lavc encoder, enabled spu encoder, added equaliuzer support
alex
parents: 6618
diff changeset
517 #endif
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
518 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
519
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
520 static void check_events(void)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
521 {
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
522 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
523
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
524 static uint32_t preinit(const char *arg)
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
525 {
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
526 char devname[80];
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
527 char devnum = 0;
4605
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
528 int fdflags = O_WRONLY;
5097
3456dd4a53f1 No longer force the device into not using fame
mswitch
parents: 5065
diff changeset
529
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
530 /* Parse commandline */
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
531 while (arg) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
532 if (!strncmp("prebuf", arg, 6) && !prebuf) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
533 printf("VO: [dxr3] Enabling prebuffering.\n");
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
534 prebuf = 1;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
535 } else if (!strncmp("sync", arg, 4) && !newsync) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
536 printf("VO: [dxr3] Using new sync engine.\n");
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
537 newsync = 1;
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
538 } else if (arg[0] == '0' || arg[0] == '1' || arg[0] == '2' || arg[0] == '3') {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
539 devnum = arg[0];
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
540 }
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
541
5377
f7402401318c lego++ bug fixed by XorA
mswitch
parents: 5361
diff changeset
542 arg = strchr(arg, ':');
f7402401318c lego++ bug fixed by XorA
mswitch
parents: 5361
diff changeset
543 if (arg) {
f7402401318c lego++ bug fixed by XorA
mswitch
parents: 5361
diff changeset
544 arg++;
f7402401318c lego++ bug fixed by XorA
mswitch
parents: 5361
diff changeset
545 }
5361
3e81a50e33ff XorA added the option of switching between fame/avcodec without
mswitch
parents: 5330
diff changeset
546 }
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
547
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
548 if (prebuf) {
5361
3e81a50e33ff XorA added the option of switching between fame/avcodec without
mswitch
parents: 5330
diff changeset
549 fdflags |= O_NONBLOCK;
4723
93e959f0a6e4 Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents: 4685
diff changeset
550 }
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
551
5225
a4a39919022a Fame support enabled, awaiting bugreports =D
mswitch
parents: 5199
diff changeset
552
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
553 /* Open the control interface */
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
554 if (devnum) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
555 printf("VO: [dxr3] Forcing use of device %c\n", devnum);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
556 sprintf(devname, "/dev/em8300-%c", devnum);
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
557 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
558 /* Try new naming scheme by default */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
559 sprintf(devname, "/dev/em8300-0");
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
560 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
561 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
562 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
563 /* Fall back to old naming scheme */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
564 printf("VO: [dxr3] Error opening %s for writing, trying /dev/em8300 instead\n", devname);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
565 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
566 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
567 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
568 printf("VO: [dxr3] Error opening /dev/em8300 for writing as well!\nBailing\n");
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
569 return -1;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
570 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
571 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
572
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
573 /* Open the video interface */
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
574 if (devnum) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
575 sprintf(devname, "/dev/em8300_mv-%c", devnum);
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
576 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
577 /* Try new naming scheme by default */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
578 sprintf(devname, "/dev/em8300_mv-0");
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
579 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
580 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
581 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
582 /* Fall back to old naming scheme */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
583 printf("VO: [dxr3] Error opening %s for writing, trying /dev/em8300_mv instead\n", devname);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
584 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
585 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
586 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
587 printf("VO: [dxr3] Error opening /dev/em8300_mv for writing as well!\nBailing\n");
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
588 uninit();
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
589 return -1;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
590 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
591 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
592 printf("VO: [dxr3] Opened %s\n", devname);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
593 }
4602
e4a96fe4f3d2 Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents: 4596
diff changeset
594 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
595
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
596 /* Open the subpicture interface */
5647
5a2d49aa72c2 Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents: 5547
diff changeset
597 fdflags |= O_NONBLOCK;
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
598 if (devnum) {
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
599 sprintf(devname, "/dev/em8300_sp-%c", devnum);
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
600 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
601 /* Try new naming scheme by default */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
602 sprintf(devname, "/dev/em8300_sp-0");
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
603 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
604 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
605 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
606 /* Fall back to old naming scheme */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
607 printf("VO: [dxr3] Error opening %s for writing, trying /dev/em8300_sp instead\n", devname);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
608 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
609 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
610 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
611 printf("VO: [dxr3] Error opening /dev/em8300_sp for writing as well!\nBailing\n");
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
612 uninit();
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
613 return -1;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
614 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
615 }
5499
58864ce0eef7 Fixed bug that would cause the dxr3 to lock if too many subpics were sent at once
mswitch
parents: 5497
diff changeset
616 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
617
7950
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
618 ioctl(fd_control, EM8300_IOCTL_SCR_GET, &ioval);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
619 pts_offset = vo_pts - (ioval << 1);
d41eb993f6e2 Prebuffering is no longer the default option.
mswitch
parents: 7945
diff changeset
620
4480
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
621 return 0;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
622 }