annotate libvo/vo_dxr3.c @ 4607:da09673aea00

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