Mercurial > mplayer.hg
annotate libvo/vo_dxr3.c @ 5865:f4b470b66a99
update: we use the new quantizer in libavcodec, -zrquality 1 is allowed
author | rik |
---|---|
date | Sat, 27 Apr 2002 18:24:12 +0000 |
parents | 9f4e13b3bfb2 |
children | 2001affedb75 |
rev | line source |
---|---|
2645 | 1 /* |
2 * vo_dxr3.c - DXR3/H+ video out | |
3 * | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
4 * Copyright (C) 2002 David Holm <dholm@iname.com> |
2645 | 5 * |
6 */ | |
7 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
8 /* ChangeLog added 2002-01-10 |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
9 * 2002-04-15: |
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
10 * 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
|
11 * 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
|
12 * |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
13 * 2002-04-03: |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
14 * Carl George added spuenc support |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
15 * |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
16 * 2002-03-26: |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
17 * 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
|
18 * codec. We thank him again. |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
19 * |
5330 | 20 * 2002-03-25: |
21 * A couple of bugfixes by XorA | |
22 * | |
5273
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
23 * 2002-03-23: |
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
24 * 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
|
25 * 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
|
26 * |
5134
83b3dc5132a5
Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents:
5132
diff
changeset
|
27 * 2002-03-16: |
83b3dc5132a5
Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents:
5132
diff
changeset
|
28 * 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
|
29 * 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
|
30 * with fame. |
83b3dc5132a5
Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents:
5132
diff
changeset
|
31 * |
5064 | 32 * 2002-03-13: |
33 * Preliminary fame support added (it breaks after seeking, why?) | |
34 * | |
4755
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
35 * 2002-02-18: |
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
36 * 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
|
37 * |
4723
93e959f0a6e4
Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents:
4685
diff
changeset
|
38 * 2002-02-16: |
93e959f0a6e4
Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents:
4685
diff
changeset
|
39 * 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
|
40 * 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
|
41 * |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
42 * 2002-02-13: |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
43 * 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
|
44 * 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
|
45 * 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
|
46 * 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
|
47 * 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
|
48 * |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
49 * 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
|
50 * 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
|
51 * 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
|
52 * 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
|
53 * 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
|
54 * |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
55 * 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
|
56 * 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
|
57 * |
4480 | 58 * 2002-02-02: |
59 * Cleaned out some old code which might have slowed down writes | |
60 * | |
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
|
61 * 2002-01-17: |
4219 | 62 * 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
|
63 * |
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
|
64 * 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
|
65 * 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
|
66 * 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
|
67 * |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
68 * 2002-01-10: |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
69 * 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
|
70 * 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
|
71 * find any inconcistencies. |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
72 */ |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
73 |
2921 | 74 #include <linux/em8300.h> |
75 #include <sys/ioctl.h> | |
76 #include <sys/stat.h> | |
77 #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
|
78 #include <sys/select.h> |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
79 #include <unistd.h> |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
80 #include <stdio.h> |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
81 #include <stdlib.h> |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
82 #include <string.h> |
2921 | 83 #include <fcntl.h> |
2645 | 84 #include <stdio.h> |
85 #include <time.h> | |
86 | |
87 #include "config.h" | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
88 #include "fastmemcpy.h" |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
89 |
2645 | 90 #include "video_out.h" |
91 #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
|
92 #include "aspect.h" |
5397 | 93 #include "postproc/rgb2rgb.h" |
94 #include "postproc/swscale.h" | |
95 #include "cpudetect.h" | |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
96 #include "spuenc.h" |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
97 |
5847 | 98 //#define USE_LIBFAME // this is done in configure now |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
99 |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
100 /* Libfame codec initialisation */ |
5064 | 101 #ifdef USE_LIBFAME |
102 #include "../libfame/fame.h" | |
103 static unsigned char *outbuf = NULL; | |
104 static fame_parameters_t fame_params; | |
105 static fame_yuv_t fame_yuv; | |
5225 | 106 static fame_context_t *fame_ctx = NULL; |
107 static fame_object_t *fame_obj; | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
108 #endif |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
109 |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
110 /* libavcodec codec initialisation */ |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
111 #ifdef USE_LIBAVCODEC |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
112 #ifdef USE_LIBAVCODEC_SO |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
113 #include <libffmpeg/avcodec.h> |
5397 | 114 #include <libffmpeg/dsputil.h> |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
115 #else |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
116 #include "libavcodec/avcodec.h" |
5397 | 117 #include "libavcodec/dsputil.h" |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
118 #endif |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
119 /* for video encoder */ |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
120 static AVCodec *avc_codec = NULL; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
121 static AVCodecContext *avc_context = NULL; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
122 static AVPicture avc_picture; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
123 int avc_outbuf_size = 100000; |
5397 | 124 extern int avcodec_inited; |
5547 | 125 extern int motion_estimation_method; |
3432 | 126 #endif |
5064 | 127 |
128 char *picture_data[] = { NULL, NULL, NULL }; | |
129 int picture_linesize[] = { 0, 0, 0 }; | |
2645 | 130 |
131 #ifdef HAVE_MMX | |
132 #include "mmx.h" | |
133 #endif | |
134 | |
135 LIBVO_EXTERN (dxr3) | |
5377 | 136 |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
137 /* codec control */ |
5377 | 138 enum MpegCodec { |
139 MPG_CODEC_NON, | |
140 MPG_CODEC_AVCODEC, | |
141 MPG_CODEC_FAME | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
142 }; |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
143 |
5544
80c4e6e50f1e
Make avcodec the default encoder again, thanks Michael
mswitch
parents:
5542
diff
changeset
|
144 #if defined(USE_LIBAVCODEC) |
80c4e6e50f1e
Make avcodec the default encoder again, thanks Michael
mswitch
parents:
5542
diff
changeset
|
145 static int mpeg_codec = MPG_CODEC_AVCODEC; |
80c4e6e50f1e
Make avcodec the default encoder again, thanks Michael
mswitch
parents:
5542
diff
changeset
|
146 #elif defined(USE_LIBFAME) |
5497
14323f846fc8
Make fame the default encoder until lavc's mpeg1 encoder is repaired.
mswitch
parents:
5491
diff
changeset
|
147 static int mpeg_codec = MPG_CODEC_FAME; |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
148 #else |
5377 | 149 static int mpeg_codec = MPG_CODEC_NONE; |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
150 #endif |
2645 | 151 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
152 /* Resolutions and positions */ |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
153 static int v_width, v_height; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
154 static int s_width, s_height; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
155 static int osd_w, osd_h; |
4605 | 156 static int noprebuf = 0; |
2770 | 157 static int img_format = 0; |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
158 static SwsContext * sws = NULL; |
3329
529a001496c2
Switched from rte which caused alot of problems for some users to libmp1e.
mswitch
parents:
3232
diff
changeset
|
159 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
160 /* File descriptors */ |
2921 | 161 static int fd_control = -1; |
162 static int fd_video = -1; | |
163 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
|
164 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
|
165 static char fds_name[80]; |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
166 |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
167 /* on screen display/subpics */ |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
168 static char *osdpicbuf = NULL; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
169 static int osdpicbuf_w; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
170 static int osdpicbuf_h; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
171 static int disposd = 0; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
172 static encodedata *spued; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
173 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
174 /* Static variable used in ioctl's */ |
2921 | 175 static int ioval = 0; |
2645 | 176 |
177 static vo_info_t vo_info = | |
178 { | |
179 "DXR3/H+ video out", | |
180 "dxr3", | |
181 "David Holm <dholm@iname.com>", | |
182 "" | |
183 }; | |
184 | |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
185 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
|
186 { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
187 uint32_t flag = 0; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
188 switch (request) { |
4754 | 189 case VOCTRL_RESUME: |
190 if (!noprebuf) { | |
191 ioval = EM8300_PLAYMODE_PLAY; | |
192 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) { | |
193 printf("VO: [dxr3] Unable to set playmode!\n"); | |
194 } | |
195 } | |
196 return VO_TRUE; | |
197 case VOCTRL_PAUSE: | |
198 if (!noprebuf) { | |
199 ioval = EM8300_PLAYMODE_PAUSED; | |
200 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) { | |
201 printf("VO: [dxr3] Unable to set playmode!\n"); | |
202 } | |
203 } | |
204 return VO_TRUE; | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
205 case VOCTRL_RESET: |
4605 | 206 if (!noprebuf) { |
207 close(fd_video); | |
208 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
|
209 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
|
210 fd_spu = open(fds_name, O_WRONLY); |
4609 | 211 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
|
212 fsync(fd_spu); |
4605 | 213 } |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
214 return VO_TRUE; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
215 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
216 switch (*((uint32_t*)data)) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
217 case IMGFMT_MPEGPES: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
218 /* Hardware accelerated | Hardware supports subpics */ |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
219 flag = 0x2 | 0x8; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
220 break; |
5064 | 221 #if defined(USE_LIBFAME) || defined(USE_LIBAVCODEC) |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
222 case IMGFMT_YV12: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
223 case IMGFMT_YUY2: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
224 case IMGFMT_RGB24: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
225 case IMGFMT_BGR24: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
226 /* Conversion needed | OSD Supported */ |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
227 flag = 0x1 | 0x4; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
228 break; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
229 #else |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
230 default: |
5134
83b3dc5132a5
Fixed some bugs with fame, had to disable prebuffering with fame though
mswitch
parents:
5132
diff
changeset
|
231 printf("VO: [dxr3] You have disabled libavcodec/libfame support (Read DOCS/codecs.html)!\n"); |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
232 #endif |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
233 } |
4605 | 234 if (noprebuf) { |
235 return flag; | |
236 } else { | |
237 return (flag | 0x100); | |
238 } | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
239 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
240 return VO_NOTIMPL; |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
241 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4523
diff
changeset
|
242 |
5225 | 243 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, const vo_tune_info_t *info) |
2645 | 244 { |
4754 | 245 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
|
246 em8300_register_t reg; |
5273
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
247 extern float monitor_aspect; |
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
248 |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
249 /* 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
|
250 /* 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
|
251 /* 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
|
252 /* up in a lockup */ |
4160 | 253 ioval = EM8300_SPUMODE_ON; |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
254 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
|
255 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
|
256 uninit(); |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
257 return -1; |
3201 | 258 } |
259 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
260 /* 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
|
261 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
|
262 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
|
263 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
|
264 } |
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
|
265 |
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
|
266 /* Start em8300 prebuffering and sync engine */ |
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
267 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
|
268 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
|
269 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
|
270 ioctl(fd_control, EM8300_IOCTL_WRITEREG, ®); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
271 |
4607
da09673aea00
Removed some stuff from the em8300 driver, had to compensate
mswitch
parents:
4605
diff
changeset
|
272 /* Clean buffer by syncing it */ |
4609 | 273 ioval = EM8300_SUBDEVICE_VIDEO; |
274 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval); | |
275 ioval = EM8300_SUBDEVICE_AUDIO; | |
276 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval); | |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
277 fsync(fd_video); |
4613
8497da33a0d2
updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents:
4609
diff
changeset
|
278 if (!noprebuf) { |
8497da33a0d2
updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents:
4609
diff
changeset
|
279 ioval = 0x900; |
8497da33a0d2
updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents:
4609
diff
changeset
|
280 ioctl(fd_control, EM8300_IOCTL_SCR_SETSPEED, &ioval); |
8497da33a0d2
updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents:
4609
diff
changeset
|
281 ioval = 0; |
8497da33a0d2
updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents:
4609
diff
changeset
|
282 ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval); |
8497da33a0d2
updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents:
4609
diff
changeset
|
283 } |
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
|
284 |
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
|
285 /* 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
|
286 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
|
287 v_width = width; |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
288 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
|
289 |
5273
8af542acc1b6
Jitter-bug fixed by Marcel Hild <hild@b4mad.net>, many many thanks goes
mswitch
parents:
5225
diff
changeset
|
290 /* 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
|
291 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
|
292 |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
293 /* 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
|
294 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
|
295 aspect_save_prescale(d_width, d_height); |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
296 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
|
297 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
|
298 printf("VO: [dxr3] Setting up for NTSC.\n"); |
5065 | 299 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
|
300 } else { |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
301 printf("VO: [dxr3] Setting up for PAL/SECAM.\n"); |
5065 | 302 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
|
303 } |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
304 aspect(&s_width, &s_height, A_ZOOM); |
5064 | 305 s_width -= s_width % 16; |
5281
88df6d5f6ce7
Aspect code reenabled, apparently users didn't like running movies
mswitch
parents:
5275
diff
changeset
|
306 s_height -= s_height % 16; |
5064 | 307 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
308 /* 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
|
309 /* 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
|
310 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
|
311 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
|
312 if (tmp1 < tmp2) { |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
313 ioval = EM8300_ASPECTRATIO_4_3; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
314 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
|
315 } else { |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
316 ioval = EM8300_ASPECTRATIO_16_9; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
317 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
|
318 } |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
319 ioctl(fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval); |
4754 | 320 |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
321 if (format != IMGFMT_MPEGPES) { |
5064 | 322 size = s_width * s_height; |
323 picture_data[0] = malloc((size * 3) / 2); | |
324 picture_data[1] = picture_data[0] + size; | |
325 picture_data[2] = picture_data[1] + size / 4; | |
326 | |
327 picture_linesize[0] = s_width; | |
328 picture_linesize[1] = s_width / 2; | |
329 picture_linesize[2] = s_width / 2; | |
5377 | 330 switch (mpeg_codec) { |
5064 | 331 #ifdef USE_LIBFAME |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
332 case MPG_CODEC_FAME: |
5377 | 333 printf("VO: [dxr3] Using FAME\n"); |
334 fame_ctx = fame_open(); | |
335 if (!fame_ctx) { | |
336 printf("VO: [dxr3] Cannot open libFAME!\n"); | |
337 return -1; | |
338 } | |
5064 | 339 |
5377 | 340 fame_obj = fame_get_object(fame_ctx, "motion/pmvfast"); |
341 fame_register(fame_ctx, "motion", fame_obj); | |
342 | |
343 memset(&fame_params, 0, sizeof(fame_parameters_t)); | |
344 fame_params.width = s_width; | |
345 fame_params.height = s_height; | |
346 fame_params.coding = "IPPPPPPP"; | |
347 fame_params.quality = 90; | |
348 fame_params.bitrate = 0; | |
349 fame_params.slices_per_frame = 1; | |
350 fame_params.frames_per_sequence = (int) (vo_fps + 0.5); | |
351 fame_params.shape_quality = 100; | |
352 fame_params.search_range = (int) (vo_fps + 0.5); | |
353 fame_params.verbose = 0; | |
354 fame_params.profile = NULL; | |
5064 | 355 |
5377 | 356 if (vo_fps < 24.0) { |
357 fame_params.frame_rate_num = 24000; | |
358 fame_params.frame_rate_den = 1001; | |
359 } else if (vo_fps < 25.0) { | |
360 fame_params.frame_rate_num = 24; | |
361 fame_params.frame_rate_den = 1; | |
362 } else if (vo_fps < 29.0) { | |
363 fame_params.frame_rate_num = 25; | |
364 fame_params.frame_rate_den = 1; | |
365 } else if (vo_fps < 30.0) { | |
366 fame_params.frame_rate_num = 30000; | |
367 fame_params.frame_rate_den = 1001; | |
368 } else if (vo_fps < 50.0) { | |
369 fame_params.frame_rate_num = 30; | |
370 fame_params.frame_rate_den = 1; | |
371 } else if (vo_fps < 55.0) { | |
372 fame_params.frame_rate_num = 50; | |
373 fame_params.frame_rate_den = 1; | |
374 } else if (vo_fps < 60.0) { | |
375 fame_params.frame_rate_num = 60000; | |
376 fame_params.frame_rate_den = 1001; | |
377 } else { | |
378 fame_params.frame_rate_num = 60; | |
379 fame_params.frame_rate_den = 1; | |
380 } | |
381 | |
382 outbuf = malloc(100000); | |
383 fame_init(fame_ctx, &fame_params, outbuf, 100000); | |
5064 | 384 |
5377 | 385 fame_yuv.w = s_width; |
386 fame_yuv.h = s_height; | |
387 fame_yuv.y = picture_data[0]; | |
388 fame_yuv.u = picture_data[1]; | |
389 fame_yuv.v = picture_data[2]; | |
390 break; | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
391 #endif |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
392 #ifdef USE_LIBAVCODEC |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
393 case MPG_CODEC_AVCODEC: |
5377 | 394 printf("VO: [dxr3] Using AVCODEC\n"); |
395 avc_codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO); | |
396 if (!avc_codec) { | |
397 printf("VO: [dxr3] Unable to find mpeg1video codec\n"); | |
398 uninit(); | |
399 return -1; | |
400 } | |
401 if (avc_context) { | |
402 free(avc_context); | |
403 } | |
404 avc_context = malloc(sizeof(AVCodecContext)); | |
405 memset(avc_context, 0, sizeof(AVCodecContext)); | |
406 avc_context->width = s_width; | |
407 avc_context->height = s_height; | |
408 ioctl(fd_control, EM8300_IOCTL_GET_VIDEOMODE, &ioval); | |
5547 | 409 avc_context->gop_size = 7; |
5377 | 410 avc_context->frame_rate = (int) (vo_fps * FRAME_RATE_BASE); |
5547 | 411 avc_context->bit_rate = 0; |
5542 | 412 avc_context->flags = CODEC_FLAG_QSCALE; |
5377 | 413 avc_context->quality = 2; |
414 avc_context->pix_fmt = PIX_FMT_YUV420P; | |
5547 | 415 motion_estimation_method = ME_EPZS; |
5377 | 416 if (avcodec_open(avc_context, avc_codec) < 0) { |
417 printf("VO: [dxr3] Unable to open codec\n"); | |
418 uninit(); | |
419 return -1; | |
420 } | |
421 /* Create a pixel buffer and set up pointers for color components */ | |
422 memset(&avc_picture, 0, sizeof(avc_picture)); | |
423 avc_picture.linesize[0] = picture_linesize[0]; | |
424 avc_picture.linesize[1] = picture_linesize[1]; | |
425 avc_picture.linesize[2] = picture_linesize[2]; | |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
426 |
5377 | 427 avc_picture.data[0] = picture_data[0]; |
428 avc_picture.data[1] = picture_data[1]; | |
429 avc_picture.data[2] = picture_data[2]; | |
430 break; | |
5064 | 431 #endif |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
432 } |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
433 |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
434 sws = getSwsContextFromCmdLine(v_width, v_height, img_format, s_width, s_height, IMGFMT_YV12); |
5064 | 435 if (!sws) { |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
436 printf("vo_vesa: Can't initialize SwScaler\n"); |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
437 return -1; |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
438 } |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
439 |
5064 | 440 /* This stuff calculations the relative position of the osd */ |
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
|
441 osd_w = s_width; |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
442 osd_h = s_height; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
443 |
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
|
444 if (format == IMGFMT_BGR24) { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
445 yuv2rgb_init(24, MODE_BGR); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
446 } else { |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
447 yuv2rgb_init(24, MODE_RGB); |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
448 } |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
449 return 0; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
450 } else if (format == IMGFMT_MPEGPES) { |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
451 printf("VO: [dxr3] Format: MPEG-PES (no conversion needed)\n"); |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
452 osdpicbuf = malloc(s_width * s_height); |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
453 if (osdpicbuf == NULL) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
454 printf("vo_dxr3: out of mem\n"); |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
455 return -1; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
456 } |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
457 spued = (encodedata *) malloc(sizeof(encodedata)); |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
458 if (spued == NULL) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
459 printf("vo_dxr3:out of mem\n"); |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
460 return -1; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
461 } |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
462 osd_w = s_width; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
463 osd_h = s_height; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
464 osdpicbuf_w = s_width; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
465 osdpicbuf_h = s_height; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
466 |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
467 return 0; |
3201 | 468 } |
469 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
470 printf("VO: [dxr3] Format: Unsupported\n"); |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
471 uninit(); |
3432 | 472 return -1; |
2645 | 473 } |
474 | |
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
|
475 static const vo_info_t* get_info(void) |
2645 | 476 { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
477 return &vo_info; |
2645 | 478 } |
479 | |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
480 static void draw_alpha(int x, int y, int w, int h, unsigned char* src, unsigned char *srca, int srcstride) |
2645 | 481 { |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
482 /*int lx, ly, bx; |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
483 unsigned char *buf; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
484 buf = &osdpicbuf[(y * osdpicbuf_w) + x]; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
485 if (img_format == IMGFMT_MPEGPES) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
486 for (ly = 0; ly < h - 1; ly++) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
487 for(lx = 0; lx < w; lx++) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
488 if ((srca[(ly * srcstride) + lx] != 0) && (src[(ly * srcstride) + lx] != 0)) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
489 if(src[(ly * srcstride) + lx] >= 128) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
490 buf[ly * osdpicbuf_w + lx] = 3; |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
491 } |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
492 } |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
493 } |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
494 } |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
495 pixbuf_encode_rle(x, y, osdpicbuf_w, osdpicbuf_h - 1, osdpicbuf, osdpicbuf_w, spued); |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
496 } else*/ { |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
497 #if defined(USE_LIBAVCODEC) || defined(USE_LIBFAME) |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
498 vo_draw_alpha_yv12(w, h, src, srca, srcstride, |
5064 | 499 picture_data[0] + x + y * picture_linesize[0], picture_linesize[0]); |
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
|
500 #endif |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
501 } |
2645 | 502 } |
503 | |
504 static void draw_osd(void) | |
505 { | |
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 if (img_format != IMGFMT_MPEGPES) { |
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 vo_draw_text(osd_w, osd_h, draw_alpha); |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
508 } /*else if ((disposd % 15) == 0) { |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
509 vo_draw_text(osd_w, osd_h, draw_alpha); |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
510 memset(osdpicbuf, 0, s_width * s_height); |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
511 */ |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
512 /* 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
|
513 * 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
|
514 * 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
|
515 */ |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
516 /*if (!noprebuf) { |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
517 ioctl(fd_spu, EM8300_IOCTL_SPU_SETPTS, &vo_pts); |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
518 } |
5499
58864ce0eef7
Fixed bug that would cause the dxr3 to lock if too many subpics were sent at once
mswitch
parents:
5497
diff
changeset
|
519 write(fd_spu, spued->data, spued->count); |
4218
3931c41f740a
Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents:
4166
diff
changeset
|
520 } |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
521 disposd++;*/ |
2645 | 522 } |
523 | |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
524 |
2645 | 525 static uint32_t draw_frame(uint8_t * src[]) |
526 { | |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
527 char *pData; |
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
528 int pSize; |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
529 if (img_format == IMGFMT_MPEGPES) { |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
530 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
|
531 |
4160 | 532 if (p->id == 0x20) { |
4613
8497da33a0d2
updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents:
4609
diff
changeset
|
533 if (!noprebuf) { |
8497da33a0d2
updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents:
4609
diff
changeset
|
534 ioctl(fd_spu, EM8300_IOCTL_SPU_SETPTS, &vo_pts); |
8497da33a0d2
updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents:
4609
diff
changeset
|
535 } |
4480 | 536 write(fd_spu, p->data, p->size); |
4160 | 537 } else { |
4755
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
538 write(fd_video, p->data, p->size); |
4160 | 539 } |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
540 return 0; |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
541 } else { |
4755
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
542 int size, srcStride = (img_format == IMGFMT_YUY2) ? (v_width * 2) : (v_width * 3); |
5064 | 543 sws->swScale(sws, src, &srcStride, 0, v_height, picture_data, picture_linesize); |
4514
4e21ffb56104
Forgot the osd fix in the other patch, well, here it is ;)
mswitch
parents:
4513
diff
changeset
|
544 draw_osd(); |
5377 | 545 switch (mpeg_codec) { |
5064 | 546 #ifdef USE_LIBFAME |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
547 case MPG_CODEC_FAME: |
5377 | 548 size = fame_encode_frame(fame_ctx, &fame_yuv, NULL); |
549 write(fd_video, outbuf, size); | |
550 break; | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
551 #endif |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
552 #ifdef USE_LIBAVCODEC |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
553 case MPG_CODEC_AVCODEC: |
5377 | 554 size = avcodec_encode_video(avc_context, picture_data[0], avc_outbuf_size, &avc_picture); |
555 write(fd_video, picture_data[0], size); | |
556 break; | |
5064 | 557 #endif |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
558 } |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
559 return 0; |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
560 } |
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
561 return -1; |
2645 | 562 } |
563 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
564 static void flip_page(void) |
2645 | 565 { |
5377 | 566 int size; |
4755
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
567 if (!noprebuf) { |
67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
mswitch
parents:
4754
diff
changeset
|
568 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
|
569 } |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
570 if (img_format == IMGFMT_YV12) { |
5377 | 571 switch (mpeg_codec) { |
5064 | 572 #ifdef USE_LIBFAME |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
573 case MPG_CODEC_FAME: |
5377 | 574 size = fame_encode_frame(fame_ctx, &fame_yuv, NULL); |
575 write(fd_video, outbuf, size); | |
576 break; | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
577 #endif |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
578 #ifdef USE_LIBAVCODEC |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
579 case MPG_CODEC_AVCODEC: |
5377 | 580 size = avcodec_encode_video(avc_context, picture_data[0], avc_outbuf_size, &avc_picture); |
581 if (!noprebuf) { | |
582 ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts); | |
583 } | |
584 write(fd_video, picture_data[0], size); | |
585 break; | |
5064 | 586 #endif |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
587 } |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
588 } |
2645 | 589 } |
590 | |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
591 static uint32_t draw_slice(uint8_t *srcimg[], int stride[], int w, int h, int x0, int y0) |
2645 | 592 { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
593 if (img_format == IMGFMT_YV12) { |
5064 | 594 sws->swScale(sws, srcimg, stride, y0, h, picture_data, picture_linesize); |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
595 return 0; |
3232
d037e1201721
Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents:
3218
diff
changeset
|
596 } |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
597 return -1; |
2645 | 598 } |
599 | |
3208 | 600 static void uninit(void) |
2645 | 601 { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
602 printf("VO: [dxr3] Uninitializing\n"); |
4685
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
603 if (sws) { |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
604 freeSwsContext(sws); |
e8a749c866cf
Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents:
4613
diff
changeset
|
605 } |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
606 |
5377 | 607 switch (mpeg_codec) { |
5064 | 608 #ifdef USE_LIBFAME |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
609 case MPG_CODEC_FAME: |
5377 | 610 if (fame_ctx) { |
611 fame_close(fame_ctx); | |
612 } | |
613 break; | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
614 #endif |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
615 #ifdef USE_LIBAVCODEC |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
616 case MPG_CODEC_AVCODEC: |
5377 | 617 if (avc_context) { |
618 avcodec_close(avc_context); | |
619 } | |
620 break; | |
5064 | 621 #endif |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
622 } |
5064 | 623 if (picture_data[0]) { |
624 free(picture_data[0]); | |
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
|
625 } |
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
|
626 if (fd_video) { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
627 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
|
628 } |
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
|
629 if (fd_spu) { |
4095
a3f3858b8c15
useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents:
4063
diff
changeset
|
630 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
|
631 } |
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
|
632 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
|
633 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
|
634 } |
5490
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
635 if(osdpicbuf) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
636 free(osdpicbuf); |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
637 } |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
638 if(spued) { |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
639 free(spued); |
78bd1fa449c3
Added spuenc... should write a draw_alpha_spu perhaps =D
mswitch
parents:
5397
diff
changeset
|
640 } |
2645 | 641 } |
642 | |
643 static void check_events(void) | |
644 { | |
645 } | |
4352 | 646 |
647 static uint32_t preinit(const char *arg) | |
648 { | |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
649 char devname[80]; |
4605 | 650 int fdflags = O_WRONLY; |
5310 | 651 CpuCaps cpucaps; |
5097 | 652 |
5310 | 653 GetCpuCaps(&cpucaps); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
654 /* Open the control interface */ |
5377 | 655 if (arg && !strncmp("noprebuf", arg, 8)) { |
4723
93e959f0a6e4
Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents:
4685
diff
changeset
|
656 printf("VO: [dxr3] Disabling prebuffering.\n"); |
93e959f0a6e4
Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents:
4685
diff
changeset
|
657 noprebuf = 1; |
93e959f0a6e4
Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents:
4685
diff
changeset
|
658 fdflags |= O_NONBLOCK; |
5377 | 659 arg = strchr(arg, ':'); |
660 if (arg) { | |
661 arg++; | |
662 } | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
663 } |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
664 |
5377 | 665 if (cpucaps.has3DNowExt) { |
666 printf("VO: [dxr3] Fast AMD special disabling prebuffering.\n"); | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
667 noprebuf = 1; |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
668 fdflags |= O_NONBLOCK; |
4723
93e959f0a6e4
Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents:
4685
diff
changeset
|
669 } |
5225 | 670 |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
671 #if defined(USE_LIBFAME) |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
672 printf("VO: [dxr3] FAME supported\n"); |
5377 | 673 if (arg && !strncmp("fame", arg, 4)) { |
674 mpeg_codec = MPG_CODEC_FAME; | |
675 arg = strchr(arg, ':'); | |
676 if (arg) { | |
677 arg++; | |
678 } | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
679 } |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
680 #endif |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
681 #if defined(USE_LIBAVCODEC) |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
682 printf("VO: [dxr3] AVCODEC supported\n"); |
5377 | 683 if (arg && !strncmp("avcodec", arg, 7)) { |
684 mpeg_codec = MPG_CODEC_AVCODEC; | |
685 arg = strchr(arg, ':'); | |
686 if (arg) { | |
687 arg++; | |
688 } | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
689 } |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
690 #endif |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
691 |
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
692 if (arg && arg[0]) { |
4724
798fdbcef121
Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents:
4723
diff
changeset
|
693 printf("VO: [dxr3] Forcing use of device %s\n", arg); |
798fdbcef121
Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents:
4723
diff
changeset
|
694 sprintf(devname, "/dev/em8300-%s", arg); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
695 } else { |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
696 /* 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
|
697 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
|
698 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
699 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
|
700 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
|
701 /* 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
|
702 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
|
703 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
|
704 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
|
705 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
|
706 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
|
707 return -1; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
708 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
709 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
710 |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
711 /* Open the video interface */ |
4724
798fdbcef121
Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents:
4723
diff
changeset
|
712 if (arg && !noprebuf) { |
798fdbcef121
Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents:
4723
diff
changeset
|
713 sprintf(devname, "/dev/em8300_mv-%s", arg); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
714 } else { |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
715 /* 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
|
716 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
|
717 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
718 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
|
719 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
|
720 /* 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
|
721 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
|
722 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
|
723 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
|
724 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
|
725 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
|
726 uninit(); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
727 return -1; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
728 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
729 } else { |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
730 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
|
731 } |
4602
e4a96fe4f3d2
Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents:
4596
diff
changeset
|
732 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
|
733 |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
734 /* Open the subpicture interface */ |
5647
5a2d49aa72c2
Disabled spuenc code due to upcoming prerelease, there are still bugs here
mswitch
parents:
5547
diff
changeset
|
735 fdflags |= O_NONBLOCK; |
4724
798fdbcef121
Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents:
4723
diff
changeset
|
736 if (arg && !noprebuf) { |
798fdbcef121
Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents:
4723
diff
changeset
|
737 sprintf(devname, "/dev/em8300_sp-%s", arg); |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
738 } else { |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
739 /* 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
|
740 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
|
741 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
742 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
|
743 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
|
744 /* 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
|
745 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
|
746 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
|
747 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
|
748 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
|
749 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
|
750 uninit(); |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
751 return -1; |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
752 } |
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
753 } |
5499
58864ce0eef7
Fixed bug that would cause the dxr3 to lock if too many subpics were sent at once
mswitch
parents:
5497
diff
changeset
|
754 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
|
755 |
5377 | 756 #if defined(USE_LIBAVCODEC) |
5397 | 757 if (mpeg_codec == MPG_CODEC_AVCODEC && !avcodec_inited) { |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
758 avcodec_init(); |
5397 | 759 avcodec_register_all(); |
760 avcodec_inited = 1; | |
5361
3e81a50e33ff
XorA added the option of switching between fame/avcodec without
mswitch
parents:
5330
diff
changeset
|
761 } |
5397 | 762 |
5377 | 763 #endif |
4513
2e3800da1ceb
Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents:
4480
diff
changeset
|
764 |
4480 | 765 return 0; |
4352 | 766 } |