annotate libvo/vo_dxr3.c @ 4601:8cda24d7f074

Make code simple. Use swScaler even for fastmemcpy purposes :)
author nick
date Sat, 09 Feb 2002 10:24:44 +0000
parents c35d7ce151b3
children e4a96fe4f3d2
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
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
9 * 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
10 * 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
11 * We will call this one the "gentoo" release in favour of the gentoo linux distribution (www.gentoo.org), which
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
12 * aims at providing maximum performance
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
13 *
4480
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
14 * 2002-02-02:
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
15 * Cleaned out some old code which might have slowed down writes
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
16 *
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
17 * 2002-01-17:
4219
70888f501b4a Fixed seeking
mswitch
parents: 4218
diff changeset
18 * 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
19 *
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
20 * 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
21 * 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
22 * 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
23 *
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
24 * 2002-01-10:
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
25 * 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
26 * 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
27 * find any inconcistencies.
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
28 */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
29
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
30 #include <linux/em8300.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
31 #include <sys/ioctl.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
32 #include <sys/stat.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
33 #include <sys/types.h>
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
34 #include <unistd.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
35 #include <stdio.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
36 #include <stdlib.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
37 #include <string.h>
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
38 #include <fcntl.h>
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
39 #include <stdio.h>
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
40 #include <time.h>
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
41
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
42 #include "config.h"
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
43 #include "fastmemcpy.h"
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
44
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
45 #include "video_out.h"
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
46 #include "video_out_internal.h"
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
47 #include "../postproc/rgb2rgb.h"
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
48
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
49 #ifdef USE_LIBAVCODEC
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
50 #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
51 #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
52 #else
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
53 #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
54 #endif
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
55 /* 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
56 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
57 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
58 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
59 char *picture_buf = NULL;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
60 char *avc_outbuf = NULL;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
61 int avc_outbuf_size = 100000;
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
62 #endif
2645
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 #ifdef HAVE_MMX
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
65 #include "mmx.h"
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
66 #endif
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
67
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
68 LIBVO_EXTERN (dxr3)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
69
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
70 /* Resolutions and positions */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
71 static int v_width, v_height;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
72 static int s_width, s_height;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
73 static int s_pos_x, s_pos_y;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
74 static int d_pos_x, d_pos_y;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
75 static int osd_w, osd_h;
3329
529a001496c2 Switched from rte which caused alot of problems for some users to libmp1e.
mswitch
parents: 3232
diff changeset
76
2770
b9732eaa82d9 DXR3 beta2 patch by David Holm.
atmos4
parents: 2732
diff changeset
77 static int img_format = 0;
3329
529a001496c2 Switched from rte which caused alot of problems for some users to libmp1e.
mswitch
parents: 3232
diff changeset
78
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
79 /* File descriptors */
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
80 static int fd_control = -1;
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
81 static int fd_video = -1;
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
82 static int fd_spu = -1;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
83
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
84 /* Static variable used in ioctl's */
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
85 static int ioval = 0;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
86
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
87 static vo_info_t vo_info =
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
88 {
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
89 "DXR3/H+ video out",
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
90 "dxr3",
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
91 "David Holm <dholm@iname.com>",
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
92 ""
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
93 };
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
94
4596
c35d7ce151b3 10000hl to Holm... control MUST BE static...
arpi
parents: 4592
diff changeset
95 static uint32_t control(uint32_t request, void *data, ...)
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
96 {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
97 uint32_t flag = 0;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
98 switch (request) {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
99 case VOCTRL_RESET:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
100 fsync(fd_video);
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
101 return VO_TRUE;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
102 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
103 switch (*((uint32_t*)data)) {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
104 case IMGFMT_MPEGPES:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
105 /* Hardware accelerated | Hardware supports subpics */
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
106 flag = 0x2 | 0x8;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
107 break;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
108 #ifdef USE_LIBAVCODEC
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
109 case IMGFMT_YV12:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
110 case IMGFMT_YUY2:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
111 case IMGFMT_RGB24:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
112 case IMGFMT_BGR24:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
113 /* Conversion needed | OSD Supported */
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
114 flag = 0x1 | 0x4;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
115 break;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
116 default:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
117 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
118 #else
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
119 default:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
120 printf("VO: [dxr3] You have enable libavcodec support (Read DOCS/codecs.html)!\n");
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
121 #endif
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
122 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
123 return flag;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
124 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
125 return VO_NOTIMPL;
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
126 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4523
diff changeset
127
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
128 static uint32_t config(uint32_t scr_width, uint32_t scr_height, uint32_t width, uint32_t 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
129 {
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
130 int tmp1, tmp2;
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
131 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
132
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
133 /* 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
134 /* 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
135 /* up in a lockup */
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
136 ioval = EM8300_SPUMODE_ON;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
137 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
138 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
139 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
140 return -1;
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
141 }
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
142
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
143 /* 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
144 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
145 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
146 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
147 }
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
148
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
149 /* 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
150 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
151 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
152 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
153 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
154
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
155 /* Flush the buffer and make sure it is clean by syncing it */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
156 ioval = EM8300_SUBDEVICE_VIDEO;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
157 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
158 fsync(fd_video);
4523
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
159 ioval = 0x900;
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
160 ioctl(fd_control, EM8300_IOCTL_SCR_SETSPEED, &ioval);
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
161 ioval = 0;
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
162 ioctl(fd_control, EM8300_IOCTL_SCR_SET, &ioval);
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
163 /* We'll be nice and flush the audio buffer as well */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
164 ioval = EM8300_SUBDEVICE_AUDIO;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
165 ioctl(fd_control, EM8300_IOCTL_FLUSH, &ioval);
4218
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
166
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
167 /* 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
168 img_format = format;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
169 v_width = scr_width;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
170 v_height = scr_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
171
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
172 /* libmp1e requires a width and height that is x|16 */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
173 s_width = (v_width + 15) / 16;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
174 s_width *= 16;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
175 s_height = (v_height + 15) / 16;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
176 s_height *= 16;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
177
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
178 /* 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
179 /* Anamorphic widescreen modes makes this a pain in the ass */
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
180 tmp1 = abs(height - ((width / 4) * 3));
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
181 tmp2 = abs(height - (int) (width / 2.35));
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
182 if (tmp1 < tmp2) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
183 ioval = EM8300_ASPECTRATIO_4_3;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
184 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
185 } else {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
186 ioval = EM8300_ASPECTRATIO_16_9;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
187 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
188 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
189 ioctl(fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
190
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
191 if (format != IMGFMT_MPEGPES) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
192 #ifdef USE_LIBAVCODEC
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
193 int size;
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
194
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
195 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
196 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
197 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
198 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
199 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
200 }
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
201 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
202 memset(avc_context, 0, sizeof(avc_context));
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
203 avc_context->width = v_width;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
204 avc_context->height = v_height;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
205 avc_context->frame_rate = 30 * FRAME_RATE_BASE;
4514
4e21ffb56104 Forgot the osd fix in the other patch, well, here it is ;)
mswitch
parents: 4513
diff changeset
206 avc_context->gop_size = 12;
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
207 avc_context->bit_rate = 8e6;
4523
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
208 avc_context->flags = CODEC_FLAG_HQ | CODEC_FLAG_QSCALE;
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
209 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
210 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
211 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
212 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
213 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
214 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
215 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
216
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
217 /* This stuff calculations the relative position of video and osd on screen */
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
218 /* Old stuff taken from the dvb driver, should be removed when introducing spuenc */
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
219 osd_w = s_width;
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
220 d_pos_x = (s_width - v_width) / 2;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
221 if (d_pos_x < 0) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
222 s_pos_x = -d_pos_x;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
223 d_pos_x = 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
224 osd_w = s_width;
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
225 } else {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
226 s_pos_x = 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
227 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
228 osd_h = s_height;
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
229 d_pos_y = (s_height - v_height) / 2;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
230 if (d_pos_y < 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
231 s_pos_y = -d_pos_y;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
232 d_pos_y = 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
233 osd_h = s_height;
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
234 } else {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
235 s_pos_y = 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
236 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
237
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
238 /* Create a pixel buffer and set up pointers for color components */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
239 memset(&avc_picture, 0, sizeof(avc_picture));
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
240 avc_picture.linesize[0] = v_width;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
241 avc_picture.linesize[1] = v_width / 2;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
242 avc_picture.linesize[2] = v_width / 2;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
243 avc_outbuf = malloc(avc_outbuf_size);
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
244
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
245 size = s_width * s_height;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
246 picture_buf = malloc((size * 3) / 2);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
247 avc_picture.data[0] = picture_buf;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
248 avc_picture.data[1] = avc_picture.data[0] + size;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
249 avc_picture.data[2] = avc_picture.data[1] + size / 4;
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 if (format == IMGFMT_BGR24) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
251 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
252 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
253 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
254 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
255 return 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
256 #endif
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
257 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
258 } else if (format == IMGFMT_MPEGPES) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
259 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
260 return 0;
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
261 }
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
262
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
263 printf("VO: [dxr3] Format: Unsupported\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
264 uninit();
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
265 return -1;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
266 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
267
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
268 static const vo_info_t* get_info(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
269 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
270 return &vo_info;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
271 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
272
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
273 static void draw_alpha(int x0, int y0, 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
274 {
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
275 #ifdef USE_LIBAVCODEC
4523
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
276 /* This function draws the osd and subtitles etc. */
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
277 if (img_format != IMGFMT_MPEGPES) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
278 vo_draw_alpha_yv12(w, h, src, srca, srcstride,
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
279 avc_picture.data[0] + (x0 + d_pos_x) + (y0 + d_pos_y) * avc_picture.linesize[0], avc_picture.linesize[0]);
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
280 }
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
281 #endif
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
282 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
283
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
284 static void draw_osd(void)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
285 {
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
286 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
287 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
288 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
289 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
290
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
291 static uint32_t draw_frame(uint8_t * src[])
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
292 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
293 if (img_format == IMGFMT_MPEGPES) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
294 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
295
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
296 if (p->id == 0x20) {
4480
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
297 write(fd_spu, p->data, p->size);
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
298 } else {
4480
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
299 write(fd_video, p->data, p->size);
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
300 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
301 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
302 #ifdef USE_LIBAVCODEC
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
303 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
304 int size = s_width * s_height;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
305 if (img_format == IMGFMT_YUY2) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
306 yuy2toyv12(src[0], avc_picture.data[0], avc_picture.data[1], avc_picture.data[2],
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
307 v_width, v_height, avc_picture.linesize[0], avc_picture.linesize[1], v_width*2);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
308 } else if (img_format == IMGFMT_BGR24) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
309 rgb24toyv12(src[0], avc_picture.data[0], avc_picture.data[1], avc_picture.data[2],
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
310 v_width, v_height, avc_picture.linesize[0], avc_picture.linesize[1], v_width*3);
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
311 }
4514
4e21ffb56104 Forgot the osd fix in the other patch, well, here it is ;)
mswitch
parents: 4513
diff changeset
312 draw_osd();
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
313 size = avcodec_encode_video(avc_context, avc_outbuf, avc_outbuf_size, &avc_picture);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
314 write(fd_video, avc_outbuf, size);
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
315 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
316 #endif
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
317 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
318 return -1;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
319 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
320
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
321 static void flip_page(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
322 {
4219
70888f501b4a Fixed seeking
mswitch
parents: 4218
diff changeset
323 /* Flush the device if a seek occured */
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
324 #ifdef USE_LIBAVCODEC
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
325 if (img_format == IMGFMT_YV12) {
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
326 int out_size = avcodec_encode_video(avc_context, avc_outbuf, avc_outbuf_size, &avc_picture);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
327 write(fd_video, avc_outbuf, out_size);
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
328 }
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
329 #endif
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
330 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
331
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
332 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
333 {
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
334 #ifdef USE_LIBAVCODEC
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
335 if (img_format == IMGFMT_YV12) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
336 int y;
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
337 unsigned char *s, *s1;
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
338 unsigned char *d, *d1;
3232
d037e1201721 Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents: 3218
diff changeset
339
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
340 x0 += d_pos_x;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
341 y0 += d_pos_y;
3218
8ba06b63f873 Fix green borders -> black borders, patch from D. Holm, also small fix to dxr3 ao.
atmos4
parents: 3208
diff changeset
342
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
343 if ((x0 + w) > avc_picture.linesize[0]) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
344 w = avc_picture.linesize[0] - x0;
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
345 }
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 if ((y0 + h) > s_height) {
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
347 h = s_height - y0;
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
348 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
349
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
350 s = srcimg[0] + s_pos_x + s_pos_y * stride[0];
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
351 d = avc_picture.data[0] + x0 + y0 * avc_picture.linesize[0];
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
352 for(y = 0; y < h; y++) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
353 memcpy(d, s, w);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
354 s += stride[0];
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
355 d += avc_picture.linesize[0];
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
356 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
357
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
358 w /= 2;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
359 h /= 2;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
360 x0 /= 2;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
361 y0 /= 2;
3218
8ba06b63f873 Fix green borders -> black borders, patch from D. Holm, also small fix to dxr3 ao.
atmos4
parents: 3208
diff changeset
362
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
363 s = srcimg[1] + s_pos_x + (s_pos_y * stride[1]);
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
364 d = avc_picture.data[1] + x0 + (y0 * avc_picture.linesize[1]);
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
365 s1 = srcimg[2] + s_pos_x + (s_pos_y * stride[2]);
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
366 d1 = avc_picture.data[2] + x0 + (y0 * avc_picture.linesize[2]);
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
367 for(y = 0; y < h; y++) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
368 memcpy(d, s, w);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
369 memcpy(d1, s1, w);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
370 s += stride[1];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
371 s1 += stride[2];
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
372 d += avc_picture.linesize[1];
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
373 d1 += avc_picture.linesize[2];
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
374 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
375 return 0;
3232
d037e1201721 Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents: 3218
diff changeset
376 }
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
377 #endif
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
378 return -1;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
379 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
380
3208
98a587aaf505 Support for YV12 with DXR3, patch by D. Holm.
atmos4
parents: 3201
diff changeset
381 static void uninit(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
382 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
383 printf("VO: [dxr3] Uninitializing\n");
4523
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
384 /* Set the default playback speed to 0x900 */
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
385 ioval = 0x900;
433104e0ec0f Activate QSCALE flag for avcodec
mswitch
parents: 4514
diff changeset
386 ioctl(fd_control, EM8300_IOCTL_SCR_SETSPEED, &ioval);
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
387 #ifdef USE_LIBAVCODEC
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
388 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
389 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
390 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
391 if (picture_buf) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
392 free(picture_buf);
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
393 }
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
394 #endif
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
395 if (fd_video) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
396 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
397 }
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
398 if (fd_spu) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
399 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
400 }
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
401 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
402 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
403 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
404 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
405
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
406 static void check_events(void)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
407 {
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
408 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
409
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
410 static uint32_t preinit(const char *arg)
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
411 {
4513
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
412 char devname[80];
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
413 int fdflags = O_WRONLY | O_NONBLOCK;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
414
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
415 /* Open the control interface */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
416 if (vo_subdevice) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
417 sprintf(devname, "/dev/em8300-%s", vo_subdevice);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
418 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
419 /* 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
420 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
421 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
422 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
423 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
424 /* 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
425 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
426 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
427 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
428 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
429 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
430 return -1;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
431 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
432 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
433
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
434 /* Open the video interface */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
435 if (vo_subdevice) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
436 sprintf(devname, "/dev/em8300_mv-%s", vo_subdevice);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
437 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
438 /* 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
439 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
440 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
441 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
442 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
443 /* 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
444 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
445 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
446 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
447 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
448 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
449 uninit();
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
450 return -1;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
451 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
452 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
453 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
454 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
455
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
456 /* Open the subpicture interface */
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
457 if (vo_subdevice) {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
458 sprintf(devname, "/dev/em8300_sp-%s", vo_subdevice);
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
459 } else {
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
460 /* 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
461 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
462 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
463 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
464 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
465 /* 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
466 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
467 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
468 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
469 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
470 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
471 uninit();
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
472 return -1;
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
473 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
474 }
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
475
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
476 #ifdef USE_LIBAVCODEC
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
477 avcodec_init();
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
478 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
479 #endif
2e3800da1ceb Switched from libmp1e to libavcodec, at least for me it runs helluva lot faster than libmp1e
mswitch
parents: 4480
diff changeset
480
4480
0919d2ec5e22 Cleaned up some code
mswitch
parents: 4433
diff changeset
481 return 0;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4269
diff changeset
482 }