annotate libvo/vo_dxr3.c @ 5097:3456dd4a53f1

No longer force the device into not using fame
author mswitch
date Fri, 15 Mar 2002 17:24:27 +0000
parents 0d0694219daf
children cfccb5dbe992
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
1 /*
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
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
9 * 2002-03-13:
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
10 * Preliminary fame support added (it breaks after seeking, why?)
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
11 *
4755
67c33b0fb847 Accidentally mixed experimental code with stable one during last commit,
mswitch
parents: 4754
diff changeset
12 * 2002-02-18:
67c33b0fb847 Accidentally mixed experimental code with stable one during last commit,
mswitch
parents: 4754
diff changeset
13 * 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
14 *
4723
93e959f0a6e4 Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents: 4685
diff changeset
15 * 2002-02-16:
93e959f0a6e4 Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents: 4685
diff changeset
16 * 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
17 * 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
18 *
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
19 * 2002-02-13:
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
20 * 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
21 * 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
22 * 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
23 * 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
24 * 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
25 *
4602
e4a96fe4f3d2 Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents: 4596
diff changeset
26 * 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
27 * 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
28 * 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
29 * 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
30 * 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
31 *
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
32 * 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
33 * 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
34 *
4480
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
35 * 2002-02-02:
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
36 * Cleaned out some old code which might have slowed down writes
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
37 *
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
38 * 2002-01-17:
4219
70888f501b4a Fixed seeking
mswitch
parents: 4218
diff changeset
39 * 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
40 *
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
41 * 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
42 * 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
43 * 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
44 *
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
45 * 2002-01-10:
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
46 * 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
47 * 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
48 * find any inconcistencies.
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
49 */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
50
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
51 #include <linux/em8300.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
52 #include <sys/ioctl.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
53 #include <sys/stat.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
54 #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
55 #include <sys/select.h>
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
56 #include <unistd.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
57 #include <stdio.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
58 #include <stdlib.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
59 #include <string.h>
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
60 #include <fcntl.h>
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
61 #include <stdio.h>
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
62 #include <time.h>
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
63
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
64 #include "config.h"
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
65 #include "fastmemcpy.h"
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
66
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
67 #include "video_out.h"
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
68 #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
69 #include "aspect.h"
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
70 #include "../postproc/rgb2rgb.h"
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
71 #include "../postproc/swscale.h"
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
72
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
73 #ifdef USE_LIBFAME
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
74 #include "../libfame/fame.h"
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
75 static unsigned char *outbuf = NULL;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
76 static fame_parameters_t fame_params;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
77 static fame_yuv_t fame_yuv;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
78 static fame_context_t *fame_ctx=NULL;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
79 #elif 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
80 #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
81 #include <libffmpeg/avcodec.h>
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
82 #else
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
83 #include "libavcodec/avcodec.h"
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
84 #endif
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
85 /* 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
86 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
87 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
88 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
89 int avc_outbuf_size = 100000;
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
90 #endif
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
91
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
92 char *picture_data[] = { NULL, NULL, NULL };
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
93 int picture_linesize[] = { 0, 0, 0 };
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
94
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
95 #ifdef HAVE_MMX
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
96 #include "mmx.h"
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
97 #endif
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
98
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
99 LIBVO_EXTERN (dxr3)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
100
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
101 /* Resolutions and positions */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
102 static int v_width, v_height;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
103 static int s_width, s_height;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
104 static int osd_w, osd_h;
4605
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
105 static int noprebuf = 0;
2770
b9732eaa82d9 DXR3 beta2 patch by David Holm.
atmos4
parents: 2732
diff changeset
106 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
107 static SwsContext * sws = NULL;
3329
529a001496c2 Switched from rte which caused alot of problems for some users to libmp1e.
mswitch
parents: 3232
diff changeset
108
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
109 /* File descriptors */
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
110 static int fd_control = -1;
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
111 static int fd_video = -1;
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
112 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
113 static char fdv_name[80];
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
114
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
115 /* Static variable used in ioctl's */
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
116 static int ioval = 0;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
117
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
118 static vo_info_t vo_info =
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
119 {
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
120 "DXR3/H+ video out",
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
121 "dxr3",
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
122 "David Holm <dholm@iname.com>",
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
123 ""
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
124 };
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
125
4602
e4a96fe4f3d2 Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents: 4596
diff changeset
126 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
127 {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
128 uint32_t flag = 0;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
129 switch (request) {
4754
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
130 case VOCTRL_RESUME:
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
131 if (!noprebuf) {
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
132 ioval = EM8300_PLAYMODE_PLAY;
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
133 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
134 printf("VO: [dxr3] Unable to set playmode!\n");
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
135 }
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
136 }
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
137 return VO_TRUE;
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
138 case VOCTRL_PAUSE:
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
139 if (!noprebuf) {
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
140 ioval = EM8300_PLAYMODE_PAUSED;
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
141 if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
142 printf("VO: [dxr3] Unable to set playmode!\n");
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
143 }
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
144 }
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
145 return VO_TRUE;
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
146 case VOCTRL_RESET:
4605
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
147 if (!noprebuf) {
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
148 close(fd_video);
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
149 fd_video = open(fdv_name, O_WRONLY);
4609
272b0a173417 Fixed a bug where seeking would lock mplayer
mswitch
parents: 4607
diff changeset
150 fsync(fd_video);
4605
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
151 }
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
152 return VO_TRUE;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
153 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
154 switch (*((uint32_t*)data)) {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
155 case IMGFMT_MPEGPES:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
156 /* Hardware accelerated | Hardware supports subpics */
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
157 flag = 0x2 | 0x8;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
158 break;
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
159 #if defined(USE_LIBFAME) || defined(USE_LIBAVCODEC)
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
160 case IMGFMT_YV12:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
161 case IMGFMT_YUY2:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
162 case IMGFMT_RGB24:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
163 case IMGFMT_BGR24:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
164 /* Conversion needed | OSD Supported */
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
165 flag = 0x1 | 0x4;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
166 break;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
167 default:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
168 printf("VO: [dxr3] Format unsupported, mail dholm@iname.com\n");
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
169 #else
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
170 default:
4602
e4a96fe4f3d2 Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents: 4596
diff changeset
171 printf("VO: [dxr3] You have disabled libavcodec support (Read DOCS/codecs.html)!\n");
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
172 #endif
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
173 }
4605
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
174 if (noprebuf) {
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
175 return flag;
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
176 } else {
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
177 return (flag | 0x100);
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
178 }
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
179 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
180 return VO_NOTIMPL;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
181 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
182
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
183 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
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
184 {
4754
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
185 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
186 em8300_register_t reg;
3639
64ee21b3bd09 Modified the sync code once again, commented out hardware pts sync (I'll likely burn in hell before understanding how to get this bastard to sync well)
mswitch
parents: 3630
diff changeset
187
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
188 /* 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
189 /* 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
190 /* 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
191 /* up in a lockup */
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
192 ioval = EM8300_SPUMODE_ON;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
193 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
194 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
195 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
196 return -1;
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
197 }
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
198
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
199 /* 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
200 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
201 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
202 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
203 }
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
204
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
205 /* 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
206 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
207 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
208 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
209 ioctl(fd_control, EM8300_IOCTL_WRITEREG, &reg);
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
210
4607
da09673aea00 Removed some stuff from the em8300 driver, had to compensate
mswitch
parents: 4605
diff changeset
211 /* Clean buffer by syncing it */
4609
272b0a173417 Fixed a bug where seeking would lock mplayer
mswitch
parents: 4607
diff changeset
212 ioval = EM8300_SUBDEVICE_VIDEO;
272b0a173417 Fixed a bug where seeking would lock mplayer
mswitch
parents: 4607
diff changeset
213 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval);
272b0a173417 Fixed a bug where seeking would lock mplayer
mswitch
parents: 4607
diff changeset
214 ioval = EM8300_SUBDEVICE_AUDIO;
272b0a173417 Fixed a bug where seeking would lock mplayer
mswitch
parents: 4607
diff changeset
215 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
216 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
217 if (!noprebuf) {
8497da33a0d2 updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents: 4609
diff changeset
218 ioval = 0x900;
8497da33a0d2 updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents: 4609
diff changeset
219 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
220 ioval = 0;
8497da33a0d2 updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents: 4609
diff changeset
221 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
222 }
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
223
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
224 /* 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
225 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
226 v_width = width;
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
227 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
228
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
229 /* libavcodec requires a width and height that is x|16 */
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
230 aspect_save_orig(width, height);
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
231 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
232 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
233 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
234 printf("VO: [dxr3] Setting up for NTSC.\n");
5065
0d0694219daf This will slow down wobbling (just a bit)
mswitch
parents: 5064
diff changeset
235 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
236 } else {
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
237 printf("VO: [dxr3] Setting up for PAL/SECAM.\n");
5065
0d0694219daf This will slow down wobbling (just a bit)
mswitch
parents: 5064
diff changeset
238 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
239 }
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
240 aspect(&s_width, &s_height, A_ZOOM);
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
241 s_width -= s_width % 16;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
242 s_height -= s_height % 16;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
243
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
244 /* 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
245 /* 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
246 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
247 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
248 if (tmp1 < tmp2) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
249 ioval = EM8300_ASPECTRATIO_4_3;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
250 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
251 } else {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
252 ioval = EM8300_ASPECTRATIO_16_9;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
253 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
254 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
255 ioctl(fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval);
4754
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
256
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
257 if (format != IMGFMT_MPEGPES) {
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
258 size = s_width * s_height;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
259 picture_data[0] = malloc((size * 3) / 2);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
260 picture_data[1] = picture_data[0] + size;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
261 picture_data[2] = picture_data[1] + size / 4;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
262
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
263 picture_linesize[0] = s_width;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
264 picture_linesize[1] = s_width / 2;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
265 picture_linesize[2] = s_width / 2;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
266 #ifdef USE_LIBFAME
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
267 fame_ctx = fame_open();
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
268 if (!fame_ctx) {
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
269 printf("VO: [dxr3] Cannot open libFAME!\n");
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
270 return -1;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
271 }
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
272
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
273 fame_params.width = s_width;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
274 fame_params.height = s_height;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
275 fame_params.coding = "I";
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
276 fame_params.quality = 100;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
277 fame_params.bitrate = 0;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
278 fame_params.slices_per_frame = 1;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
279 fame_params.frames_per_sequence = 0xffffffff;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
280 fame_params.frame_rate_num = 60;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
281 fame_params.frame_rate_den = 1;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
282 fame_params.shape_quality = 100;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
283 fame_params.search_range = 8;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
284 fame_params.verbose = 0;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
285 fame_params.profile = NULL;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
286
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
287 outbuf = malloc(100000);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
288 fame_init(fame_ctx, &fame_params, outbuf, 100000);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
289
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
290 fame_yuv.w = s_width;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
291 fame_yuv.h = s_height;
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
292 fame_yuv.y = picture_data[0];
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
293 fame_yuv.u = picture_data[1];
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
294 fame_yuv.v = picture_data[2];
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
295 #elif 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
296 avc_codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
297 if (!avc_codec) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
298 printf("VO: [dxr3] Unable to find mpeg1video codec\n");
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
299 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
300 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
301 }
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
302 avc_context = malloc(sizeof(AVCodecContext));
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
303 memset(avc_context, 0, sizeof(avc_context));
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
304 avc_context->width = s_width;
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
305 avc_context->height = s_height;
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
306 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
307 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
308 avc_context->gop_size = 18;
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
309 } else {
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
310 avc_context->gop_size = 15;
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
311 }
4754
ad892563d9c4 Added VOCTRL_PAUSE and VOCTRL_RESUME
mswitch
parents: 4727
diff changeset
312 avc_context->frame_rate = vo_fps * FRAME_RATE_BASE;
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
313 avc_context->bit_rate = 8e6;
4523
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
314 avc_context->flags = CODEC_FLAG_HQ | CODEC_FLAG_QSCALE;
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
315 avc_context->quality = 2;
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
316 avc_context->pix_fmt = PIX_FMT_YUV420P;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
317 if (avcodec_open(avc_context, avc_codec) < 0) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
318 printf("VO: [dxr3] Unable to open codec\n");
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
319 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
320 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
321 }
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
322 /* Create a pixel buffer and set up pointers for color components */
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
323 memset(&avc_picture, 0, sizeof(avc_picture));
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
324 avc_picture.linesize[0] = picture_linesize[0];
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
325 avc_picture.linesize[1] = picture_linesize[1];
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
326 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
327
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
328 avc_picture.data[0] = picture_data[0];
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
329 avc_picture.data[1] = picture_data[1];
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
330 avc_picture.data[2] = picture_data[2];
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
331 #endif
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
332 sws = getSwsContextFromCmdLine(v_width, v_height, img_format, s_width, s_height, IMGFMT_YV12);
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
333 if (!sws) {
4685
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
334 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
335 return -1;
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
336 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
337
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
338 /* 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
339 osd_w = s_width;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
340 osd_h = s_height;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
341
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
342 if (format == IMGFMT_BGR24) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
343 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
344 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
345 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
346 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
347 return 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
348 } else if (format == IMGFMT_MPEGPES) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
349 printf("VO: [dxr3] Format: MPEG-PES (no conversion needed)\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
350 return 0;
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
351 }
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
352
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
353 printf("VO: [dxr3] Format: Unsupported\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
354 uninit();
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
355 return -1;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
356 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
357
2866
4f6190ab52e7 Added a temporary fix to the DXR3 win32 codec playback, win32 codecs might prove to play back an unscaled image!
mswitch
parents: 2770
diff changeset
358 static const vo_info_t* get_info(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
359 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
360 return &vo_info;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
361 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
362
4602
e4a96fe4f3d2 Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents: 4596
diff changeset
363 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
364 {
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
365 #if defined(USE_LIBFAME) || defined(USE_LIBAVCODEC)
4602
e4a96fe4f3d2 Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents: 4596
diff changeset
366 vo_draw_alpha_yv12(w, h, src, srca, srcstride,
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
367 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
368 #endif
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
369 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
370
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
371 static void draw_osd(void)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
372 {
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
373 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
374 vo_draw_text(osd_w, osd_h, draw_alpha);
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
375 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
376 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
377
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
378 static uint32_t draw_frame(uint8_t * src[])
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
379 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
380 if (img_format == IMGFMT_MPEGPES) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
381 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
382
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
383 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
384 if (!noprebuf) {
8497da33a0d2 updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents: 4609
diff changeset
385 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
386 }
4480
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
387 write(fd_spu, p->data, p->size);
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
388 } else {
4755
67c33b0fb847 Accidentally mixed experimental code with stable one during last commit,
mswitch
parents: 4754
diff changeset
389 write(fd_video, p->data, p->size);
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
390 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
391 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
392 } else {
4755
67c33b0fb847 Accidentally mixed experimental code with stable one during last commit,
mswitch
parents: 4754
diff changeset
393 int size, srcStride = (img_format == IMGFMT_YUY2) ? (v_width * 2) : (v_width * 3);
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
394 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
395 draw_osd();
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
396 #ifdef USE_LIBFAME
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
397 size = fame_encode_frame(fame_ctx, &fame_yuv, NULL);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
398 write(fd_video, outbuf, size);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
399 #else USE_LIBAVCODEC
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
400 size = avcodec_encode_video(avc_context, picture_data[0], avc_outbuf_size, &avc_picture);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
401 write(fd_video, picture_data[0], size);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
402 #endif
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
403 return 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
404 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
405 return -1;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
406 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
407
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
408 static void flip_page(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
409 {
4755
67c33b0fb847 Accidentally mixed experimental code with stable one during last commit,
mswitch
parents: 4754
diff changeset
410 if (!noprebuf) {
67c33b0fb847 Accidentally mixed experimental code with stable one during last commit,
mswitch
parents: 4754
diff changeset
411 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
412 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
413 if (img_format == IMGFMT_YV12) {
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
414 #ifdef USE_LIBFAME
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
415 int size = fame_encode_frame(fame_ctx, &fame_yuv, NULL);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
416 write(fd_video, outbuf, size);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
417 #elif USE_LIBAVCODEC
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
418 int size = avcodec_encode_video(avc_context, picture_data[0], avc_outbuf_size, &avc_picture);
4613
8497da33a0d2 updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents: 4609
diff changeset
419 if (!noprebuf) {
8497da33a0d2 updated :noprebuf to emulate the playback used in mplayer 0.60 (with dxr3 patch), this solves
mswitch
parents: 4609
diff changeset
420 ioctl(fd_video, EM8300_IOCTL_VIDEO_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
421 }
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
422 write(fd_video, picture_data[0], size);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
423 #endif
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
424 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
425 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
426
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
427 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
428 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
429 if (img_format == IMGFMT_YV12) {
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
430 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
431 return 0;
3232
d037e1201721 Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents: 3218
diff changeset
432 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
433 return -1;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
434 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
435
3208
98a587aaf505 Support for YV12 with DXR3, patch by D. Holm.
atmos4
parents: 3201
diff changeset
436 static void uninit(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
437 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
438 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
439 if (sws) {
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
440 freeSwsContext(sws);
e8a749c866cf Using the mplayer SwScaler instead of doing scaling manually (sometimes this dies with sig FPE
mswitch
parents: 4613
diff changeset
441 }
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
442 #ifdef USE_LIBFAME
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
443 if (fame_ctx) {
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
444 fame_close(fame_ctx);
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
445 }
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
446 #elif 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
447 if (avc_context) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
448 avcodec_close(avc_context);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
449 }
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
450 #endif
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
451 if (picture_data[0]) {
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
452 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
453 }
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
454 if (fd_video) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
455 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
456 }
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
457 if (fd_spu) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
458 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
459 }
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
460 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
461 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
462 }
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
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
465 static void check_events(void)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
466 {
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
467 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
468
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
469 static uint32_t preinit(const char *arg)
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
470 {
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
471 char devname[80];
4605
b63ebfab3cdd Added switch to disable prebuffering
mswitch
parents: 4604
diff changeset
472 int fdflags = O_WRONLY;
5097
3456dd4a53f1 No longer force the device into not using fame
mswitch
parents: 5065
diff changeset
473
3456dd4a53f1 No longer force the device into not using fame
mswitch
parents: 5065
diff changeset
474 /* With fame we loose sync and seeking =( */
3456dd4a53f1 No longer force the device into not using fame
mswitch
parents: 5065
diff changeset
475 #ifdef USE_LIBFAME
3456dd4a53f1 No longer force the device into not using fame
mswitch
parents: 5065
diff changeset
476 noprebuf = 1;
3456dd4a53f1 No longer force the device into not using fame
mswitch
parents: 5065
diff changeset
477 #endif
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
478 /* Open the control interface */
4724
798fdbcef121 Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents: 4723
diff changeset
479 if (arg && !strcmp("noprebuf", arg)) {
4723
93e959f0a6e4 Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents: 4685
diff changeset
480 printf("VO: [dxr3] Disabling prebuffering.\n");
93e959f0a6e4 Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents: 4685
diff changeset
481 noprebuf = 1;
93e959f0a6e4 Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents: 4685
diff changeset
482 fdflags |= O_NONBLOCK;
93e959f0a6e4 Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents: 4685
diff changeset
483 }
93e959f0a6e4 Fixed bug which would cause gibberish to be printed when using :noprebuf
mswitch
parents: 4685
diff changeset
484
4724
798fdbcef121 Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents: 4723
diff changeset
485 if (arg && !noprebuf) {
798fdbcef121 Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents: 4723
diff changeset
486 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
487 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
488 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
489 /* 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
490 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
491 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
492 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
493 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
494 /* 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
495 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
496 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
497 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
498 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
499 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
500 return -1;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
501 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
502 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
503
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
504 /* Open the video interface */
4724
798fdbcef121 Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents: 4723
diff changeset
505 if (arg && !noprebuf) {
798fdbcef121 Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents: 4723
diff changeset
506 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
507 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
508 /* 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
509 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
510 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
511 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
512 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
513 /* 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
514 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
515 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
516 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
517 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
518 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
519 uninit();
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
520 return -1;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
521 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
522 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
523 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
524 }
4602
e4a96fe4f3d2 Thanks to the new control() method I've finally been able to add prebuffering support. This
mswitch
parents: 4596
diff changeset
525 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
526
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
527 /* Open the subpicture interface */
4724
798fdbcef121 Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents: 4723
diff changeset
528 if (arg && !noprebuf) {
798fdbcef121 Fixed a strange bug that sneaked in at the last minute (vobsub would
mswitch
parents: 4723
diff changeset
529 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
530 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
531 /* 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
532 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
533 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
534 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
535 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
536 /* 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
537 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
538 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
539 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
540 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
541 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
542 uninit();
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
543 return -1;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
544 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
545 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
546
5064
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
547 #ifdef USE_LIBFAME
e0122262fb3c Added preliminary fame support
mswitch
parents: 4755
diff changeset
548 #elif 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
549 avcodec_init();
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
550 avcodec_register_all();
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
551 #endif
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
552
4480
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
553 return 0;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
554 }