annotate libvo/vo_dxr3.c @ 4294:21dbbbbd5479

a few filters (should be removed/merged when arpis videofilter stuff is finished) -ssf cgb=<float> -> chrominance gaussian blur (nice to improve picture quality) -ssf lgb=<float> -> luminance gaussian blur (dunno what its good for) -ssf chs=<int> -> shift chrominance horizontally -ssf cvs=<int> -> shift chrominance vertically these will only work if the swscaler is used at all
author michael
date Mon, 21 Jan 2002 15:22:28 +0000
parents 68c78efeea2b
children ed5b85b713a3
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
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
9 * 2002-01-17:
4219
70888f501b4a Fixed seeking
mswitch
parents: 4218
diff changeset
10 * 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
11 *
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
12 * 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
13 * 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
14 * 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
15 *
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
16 * 2002-01-10:
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
17 * 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
18 * 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
19 * find any inconcistencies.
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
20 */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
21
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
22 #include <linux/em8300.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
23 #include <sys/ioctl.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
24 #include <sys/stat.h>
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
25 #include <sys/types.h>
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
26 #include <unistd.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
27 #include <stdio.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
28 #include <stdlib.h>
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
29 #include <string.h>
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
30 #include <fcntl.h>
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
31 #include <stdio.h>
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
32 #include <time.h>
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
33
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
34 #include "config.h"
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
35 #include "fastmemcpy.h"
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
36
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
37 #include "video_out.h"
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
38 #include "video_out_internal.h"
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
39 #include "../postproc/rgb2rgb.h"
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
40
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
41 #ifdef USE_MP1E
3333
5c6cdf5490f0 Minor typo fix (which I thought I commited yesterday)
mswitch
parents: 3329
diff changeset
42 #include "../libmp1e/libmp1e.h"
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
43 #endif
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
44
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
45 #ifdef HAVE_MMX
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
46 #include "mmx.h"
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
47 #endif
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
48
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
49 LIBVO_EXTERN (dxr3)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
50
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
51 #ifdef USE_MP1E
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
52 /* libmp1e specific stuff */
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
53 static rte_context *mp1e_context = NULL;
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
54 static rte_codec *mp1e_codec = NULL;
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
55 static rte_buffer mp1e_buffer;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
56
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
57 /* Color buffer data used with libmp1e */
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
58 static unsigned char *picture_data[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
59 static int picture_linesize[3];
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
60 #endif
3329
529a001496c2 Switched from rte which caused alot of problems for some users to libmp1e.
mswitch
parents: 3232
diff changeset
61
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
62 /* Resolutions and positions */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
63 static int v_width, v_height;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
64 static int s_width, s_height;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
65 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
66 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
67 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
68
2770
b9732eaa82d9 DXR3 beta2 patch by David Holm.
atmos4
parents: 2732
diff changeset
69 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
70
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
71 /* File descriptors */
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
72 static int fd_control = -1;
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
73 static int fd_video = -1;
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
74 static int fd_spu = -1;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
75
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
76 /* Static variable used in ioctl's */
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
77 static int ioval = 0;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
78
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
79 static vo_info_t vo_info =
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
80 {
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
81 "DXR3/H+ video out",
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
82 "dxr3",
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
83 "David Holm <dholm@iname.com>",
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
84 ""
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
85 };
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
86
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
87 #ifdef USE_MP1E
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
88 void write_dxr3(rte_context *context, void *data, size_t size, void *user_data)
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
89 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
90 size_t data_left = size;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
91
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
92 /* Force data into the buffer */
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
93 while (data_left) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
94 data_left -= write(fd_video, (void*) data + (size - data_left), data_left);
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
95 }
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
96 }
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
97 #endif
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
98
3218
8ba06b63f873 Fix green borders -> black borders, patch from D. Holm, also small fix to dxr3 ao.
atmos4
parents: 3208
diff changeset
99 static uint32_t init(uint32_t scr_width, uint32_t scr_height, uint32_t width, uint32_t height, uint32_t fullscreen, char *title, uint32_t format)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
100 {
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
101 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
102 em8300_register_t reg;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
103 char devname[80];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
104
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
105 /* Open the control interface */
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
106 if (vo_subdevice) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
107 sprintf(devname, "/dev/em8300-%s", vo_subdevice);
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
108 } else {
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
109 /* Try new naming scheme by default */
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
110 sprintf(devname, "/dev/em8300-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
111 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
112 fd_control = open(devname, O_WRONLY);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
113 if (fd_control < 1) {
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
114 /* Fall back to old naming scheme */
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
115 printf("VO: [dxr3] Error opening %s for writing, trying /dev/em8300 instead\n", devname);
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
116 sprintf(devname, "/dev/em8300");
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
117 fd_control = open(devname, O_WRONLY);
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
118 if (fd_control < 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
119 printf("VO: [dxr3] Error opening /dev/em8300 for writing as well!\nBailing\n");
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
120 return -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
121 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
122 }
2921
ee37c7fc3022 dxr3-patch4 by David Holm
arpi
parents: 2866
diff changeset
123
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
124 /* Open the video interface */
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
125 if (vo_subdevice) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
126 sprintf(devname, "/dev/em8300_mv-%s", vo_subdevice);
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
127 } else {
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
128 /* Try new naming scheme by default */
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
129 sprintf(devname, "/dev/em8300_mv-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
130 }
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 fd_video = open(devname, O_WRONLY);
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
132 if (fd_video < 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
133 /* Fall back to old naming scheme */
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 printf("VO: [dxr3] Error opening %s for writing, trying /dev/em8300_mv instead\n", devname);
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 sprintf(devname, "/dev/em8300_mv");
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
136 fd_video = open(devname, O_WRONLY);
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
137 if (fd_video < 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
138 printf("VO: [dxr3] Error opening /dev/em8300_mv for writing as well!\nBailing\n");
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
139 uninit();
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
140 return -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
141 }
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 } else {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
143 printf("VO: [dxr3] Opened %s\n", devname);
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
144 }
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
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 /* Open the subpicture interface */
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 if (vo_subdevice) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
148 sprintf(devname, "/dev/em8300_sp-%s", vo_subdevice);
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
149 } else {
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 /* Try new naming scheme by default */
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 sprintf(devname, "/dev/em8300_sp-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 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
153 fd_spu = open(devname, O_WRONLY);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
154 if (fd_spu < 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
155 /* Fall back to old naming scheme */
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
156 printf("VO: [dxr3] Error opening %s for writing, trying /dev/em8300_sp instead\n", devname);
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 sprintf(devname, "/dev/em8300_sp");
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
158 fd_spu = open(devname, O_WRONLY);
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 if (fd_spu < 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
160 printf("VO: [dxr3] Error opening /dev/em8300_sp for writing as well!\nBailing\n");
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 uninit();
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 return -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 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
164 }
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
165
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 /* 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
167 /* 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
168 /* up in a lockup */
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
169 ioval = EM8300_SPUMODE_ON;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
170 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
171 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
172 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
173 return -1;
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
174 }
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
175
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
176 /* 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
177 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
178 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
179 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
180 }
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
181
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
182 /* 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
183 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
184 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
185 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
186 ioctl(fd_control, EM8300_IOCTL_WRITEREG, &reg);
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
187
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
188 /* 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
189 img_format = format;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
190 v_width = scr_width;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
191 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
192
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
193 /* 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
194 s_width = (v_width + 15) / 16;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
195 s_width *= 16;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
196 s_height = (v_height + 15) / 16;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
197 s_height *= 16;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
198
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
199 /* 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
200 /* 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
201 tmp1 = abs(height - ((width / 4) * 3));
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
202 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
203 if (tmp1 < tmp2) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
204 ioval = EM8300_ASPECTRATIO_4_3;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
205 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
206 } else {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
207 ioval = EM8300_ASPECTRATIO_16_9;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
208 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
209 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
210 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
211
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
212 if (format == IMGFMT_YV12 || format == IMGFMT_YUY2 || format == IMGFMT_BGR24) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
213 #ifdef USE_MP1E
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
214 int size;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
215 enum rte_frame_rate frame_rate;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
216 enum rte_pixformat pixel_format;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
217
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
218 /* Here follows initialization of libmp1e specific stuff */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
219 if (!rte_init()) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
220 printf("VO: [dxr3] Unable to initialize MP1E!\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
221 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
222 return -1;
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
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
225 mp1e_context = rte_context_new(s_width, s_height, NULL);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
226 rte_set_verbosity(mp1e_context, 0);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
227
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
228 printf("VO: [dxr3] %dx%d => %dx%d\n", v_width, v_height, s_width, s_height);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
229
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
230 if (!mp1e_context) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
231 printf( "VO: [dxr3] Unable to create context!\n" );
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
232 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
233 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
234 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
235
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 /* I wonder if we could benefit from using mpeg2 em8300-wise (hardware processing) */
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
237 if (!rte_set_format(mp1e_context, "mpeg1")) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
238 printf("VO: [dxr3] Unable to set format\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
239 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
240 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
241 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
242
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
243 rte_set_mode(mp1e_context, RTE_VIDEO);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
244 mp1e_codec = rte_codec_set(mp1e_context, RTE_STREAM_VIDEO, 0, "mpeg1-video");
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
245
4218
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
246 if (vo_fps < 24.0) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
247 frame_rate = RTE_RATE_1;
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
248 } else if (vo_fps < 25.0) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
249 frame_rate = RTE_RATE_2;
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 } else if (vo_fps < 29.97) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
251 frame_rate = RTE_RATE_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
252 } else if (vo_fps < 30.0) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
253 frame_rate = RTE_RATE_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
254 } else if (vo_fps < 50.0) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
255 frame_rate = RTE_RATE_5;
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
256 } else if (vo_fps < 59.97) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
257 frame_rate = RTE_RATE_6;
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
258 } else if (vo_fps < 60.0) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
259 frame_rate = RTE_RATE_7;
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
260 } else if (vo_fps > 60.0) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
261 frame_rate = RTE_RATE_8;
4218
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
262 } else {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
263 frame_rate = RTE_RATE_NORATE;
4218
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
264 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
265
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
266 if (format == IMGFMT_YUY2) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
267 pixel_format = RTE_YUYV;
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
268 } else {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
269 pixel_format = RTE_YUV420;
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
270 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
271 if (!rte_set_video_parameters(mp1e_context, pixel_format, mp1e_context->width, mp1e_context->height, frame_rate, 3e6, "I")) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
272 printf("VO: [dxr3] Unable to set mp1e context!\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
273 rte_context_destroy(mp1e_context);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
274 mp1e_context = 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
275 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
276 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
277 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
278
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
279 rte_set_input(mp1e_context, RTE_VIDEO, RTE_PUSH, TRUE, NULL, NULL, NULL);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
280 rte_set_output(mp1e_context, (void*) write_dxr3, NULL, NULL);
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
281
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
282 if (!rte_init_context(mp1e_context)) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
283 printf("VO: [dxr3] Unable to init mp1e context!\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
284 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
285 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
286 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
287
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
288 /* 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
289 /* 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
290 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
291 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
292 if (d_pos_x < 0) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
293 s_pos_x = -d_pos_x;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
294 d_pos_x = 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
295 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
296 } else {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
297 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
298 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
299 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
300 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
301 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
302 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
303 d_pos_y = 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
304 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
305 } else {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
306 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
307 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
308
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
309 size = s_width * s_height;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
310
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
311 if (format == IMGFMT_YUY2) {
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
312 /* YUY2 Needs no conversion, so no need for a pixel buffer */
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
313 picture_data[0] = NULL;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
314 picture_linesize[0] = s_width * 2;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
315 } else {
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
316 /* Create a pixel buffer and set up pointers for color components */
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
317 picture_data[0] = malloc((size * 3)/2);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
318 picture_data[1] = picture_data[0] + size;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
319 picture_data[2] = picture_data[1] + size / 4;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
320 picture_linesize[0] = s_width;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
321 picture_linesize[1] = s_width / 2;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
322 picture_linesize[2] = s_width / 2;
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
4218
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
325 if (!rte_start_encoding(mp1e_context)) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
326 printf("VO: [dxr3] Unable to start mp1e encoding!\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
327 uninit();
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
328 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
329 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
330
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
331 if (format == IMGFMT_BGR24) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
332 yuv2rgb_init(24, MODE_BGR);
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
333 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
334 return 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
335 #endif
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
336 return -1;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
337 } else if (format == IMGFMT_MPEGPES) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
338 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
339 return 0;
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
340 }
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
341
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
342 printf("VO: [dxr3] Format: Unsupported\n");
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
343 uninit();
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
344 return -1;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
345 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
346
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
347 static const vo_info_t* get_info(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
348 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
349 return &vo_info;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
350 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
351
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
352 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
353 {
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
354 #ifdef USE_MP1E
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
355 /* This function draws the osd and subtitles etc. It will change to use spuenc soon */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
356 switch (img_format) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
357 case IMGFMT_BGR24:
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
358 case IMGFMT_YV12:
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
359 vo_draw_alpha_yv12(w, h, src, srca, srcstride,
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
360 picture_data[0] + (x0 + d_pos_x) + (y0 + d_pos_y) * picture_linesize[0], picture_linesize[0]);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
361 break;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
362 case IMGFMT_YUY2:
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
363 vo_draw_alpha_yuy2(w, h, src, srca, srcstride,
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
364 picture_data[0] + (x0 + d_pos_x) * 2 + (y0 + d_pos_y) * picture_linesize[0], picture_linesize[0]);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
365 break;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
366 }
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
367 #endif
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
368 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
369
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
370 static void draw_osd(void)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
371 {
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
372 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
373 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
374 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
375 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
376
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
377 static uint32_t draw_frame(uint8_t * src[])
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
378 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
379 if (img_format == IMGFMT_MPEGPES) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
380 vo_mpegpes_t *p = (vo_mpegpes_t *) src[0];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
381 size_t data_left = p->size;
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 3186
diff changeset
382
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
383 if (p->id == 0x20) {
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
384 /* Force subpic data into buffer */
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
385 while (data_left) {
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
386 data_left -= write(fd_spu, (void*) (p->data + p->size-data_left), data_left);
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
387 }
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
388 } else {
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
389 /* Force video data into buffer */
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
390 while (data_left) {
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
391 data_left -= write(fd_video, (void*) (p->data + p->size-data_left), data_left);
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
392 }
4160
ac62f8534409 hw spu support for dxr3 - patch by David Holm
arpi
parents: 4109
diff changeset
393 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
394 return 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
395 }
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
396 #ifdef USE_MP1E
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
397 else if (img_format == IMGFMT_YUY2) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
398 picture_data[0] = src[0];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
399 return 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
400 } else if (img_format == IMGFMT_BGR24) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
401 /* BGR24 needs to be converted to YUV420 before libmp1e will touch it */
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
402 int x, y, w = v_width, h = v_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
403 unsigned char *s, *dY, *dU, *dV;
3232
d037e1201721 Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents: 3218
diff changeset
404
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
405 if ((d_pos_x + w) > picture_linesize[0]) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
406 w = picture_linesize[0] - d_pos_x;
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
407 }
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
408 if ((d_pos_y + h) > s_height) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
409 h = s_height - d_pos_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
410 }
3232
d037e1201721 Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents: 3218
diff changeset
411
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
412 s = src[0] + s_pos_y * (w * 3);
3232
d037e1201721 Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents: 3218
diff changeset
413
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
414 dY = picture_data[0] + d_pos_y * picture_linesize[0];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
415 dU = picture_data[1] + (d_pos_y / 2) * picture_linesize[1];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
416 dV = picture_data[2] + (d_pos_y / 2) * picture_linesize[2];
3232
d037e1201721 Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents: 3218
diff changeset
417
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
418 rgb24toyv12(s, dY, dU, dV, w, h, picture_linesize[0], picture_linesize[1], v_width * 3);
3232
d037e1201721 Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents: 3218
diff changeset
419
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
420 mp1e_buffer.data = picture_data[0];
4269
68c78efeea2b Reverted to using software sync again, some day I'll die of a heartattack if I can't get this
mswitch
parents: 4267
diff changeset
421 mp1e_buffer.time = vo_pts / 90000.0;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
422 mp1e_buffer.user_data = NULL;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
423 vo_draw_text(osd_w, osd_h, draw_alpha);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
424 rte_push_video_buffer(mp1e_context, &mp1e_buffer);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
425 return 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
426 }
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
427 #endif
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
428 return -1;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
429 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
430
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
431 static void flip_page(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
432 {
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
433 static int prev_pts = 0;
4219
70888f501b4a Fixed seeking
mswitch
parents: 4218
diff changeset
434 /* Flush the device if a seek occured */
4269
68c78efeea2b Reverted to using software sync again, some day I'll die of a heartattack if I can't get this
mswitch
parents: 4267
diff changeset
435 if (prev_pts > vo_pts) {
68c78efeea2b Reverted to using software sync again, some day I'll die of a heartattack if I can't get this
mswitch
parents: 4267
diff changeset
436 /* Flush video */
4219
70888f501b4a Fixed seeking
mswitch
parents: 4218
diff changeset
437 ioval = EM8300_SUBDEVICE_VIDEO;
70888f501b4a Fixed seeking
mswitch
parents: 4218
diff changeset
438 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
439 }
4269
68c78efeea2b Reverted to using software sync again, some day I'll die of a heartattack if I can't get this
mswitch
parents: 4267
diff changeset
440 prev_pts = vo_pts;
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
441 #ifdef USE_MP1E
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
442 if (img_format == IMGFMT_YV12) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
443 mp1e_buffer.data = picture_data[0];
4269
68c78efeea2b Reverted to using software sync again, some day I'll die of a heartattack if I can't get this
mswitch
parents: 4267
diff changeset
444 mp1e_buffer.time = vo_pts / 90000.0;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
445 mp1e_buffer.user_data = NULL;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
446 rte_push_video_buffer(mp1e_context, &mp1e_buffer);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
447 } else if (img_format == IMGFMT_YUY2) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
448 mp1e_buffer.data = picture_data[0];
4269
68c78efeea2b Reverted to using software sync again, some day I'll die of a heartattack if I can't get this
mswitch
parents: 4267
diff changeset
449 mp1e_buffer.time = vo_pts / 90000.0;
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
450 mp1e_buffer.user_data = NULL;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
451 rte_push_video_buffer(mp1e_context, &mp1e_buffer);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
452 }
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
453 #endif
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
454 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
455
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
456 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
457 {
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
458 #ifdef USE_MP1E
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
459 if (img_format == IMGFMT_YV12) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
460 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
461 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
462 unsigned char *d, *d1;
3232
d037e1201721 Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents: 3218
diff changeset
463
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
464 x0 += d_pos_x;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
465 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
466
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
467 if ((x0 + w) > picture_linesize[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
468 w = picture_linesize[0] - x0;
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
469 }
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
470 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
471 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
472 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
473
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
474 s = srcimg[0] + s_pos_x + s_pos_y * stride[0];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
475 d = picture_data[0] + x0 + y0 * picture_linesize[0];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
476 for(y = 0; y < h; y++) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
477 memcpy(d, s, w);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
478 s += stride[0];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
479 d += picture_linesize[0];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
480 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
481
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
482 w /= 2;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
483 h /= 2;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
484 x0 /= 2;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
485 y0 /= 2;
3218
8ba06b63f873 Fix green borders -> black borders, patch from D. Holm, also small fix to dxr3 ao.
atmos4
parents: 3208
diff changeset
486
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
487 s = srcimg[1] + s_pos_x + (s_pos_y * stride[1]);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
488 d = picture_data[1] + x0 + (y0 * picture_linesize[1]);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
489 s1 = srcimg[2] + s_pos_x + (s_pos_y * stride[2]);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
490 d1 = picture_data[2] + x0 + (y0 * picture_linesize[2]);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
491 for(y = 0; y < h; y++) {
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
492 memcpy(d, s, w);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
493 memcpy(d1, s1, w);
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
494 s += stride[1];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
495 s1 += stride[2];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
496 d += picture_linesize[1];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
497 d1 += picture_linesize[2];
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
498 }
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
499 return 0;
3232
d037e1201721 Added support for codecs that supports BGR24 (some opensource codecs and vivo)
mswitch
parents: 3218
diff changeset
500 }
4218
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
501 #endif
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
502 return -1;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
503 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
504
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
505 static uint32_t query_format(uint32_t format)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
506 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
507 uint32_t flag = 0;
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
508
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
509 if (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
510 /* Hardware accelerated | Hardware supports subpics | Hardware handles syncing */
4269
68c78efeea2b Reverted to using software sync again, some day I'll die of a heartattack if I can't get this
mswitch
parents: 4267
diff changeset
511 flag = 0x2 | 0x8;
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
512 #ifdef USE_MP1E
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
513 } else if (format == IMGFMT_YV12) {
4267
90562e9c36d6 Only use hardware sync and prebuffering with mpegs!
mswitch
parents: 4265
diff changeset
514 /* Conversion needed | OSD Supported */
90562e9c36d6 Only use hardware sync and prebuffering with mpegs!
mswitch
parents: 4265
diff changeset
515 flag = 0x1 | 0x4;
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
516 } else if (format == IMGFMT_YUY2) {
4267
90562e9c36d6 Only use hardware sync and prebuffering with mpegs!
mswitch
parents: 4265
diff changeset
517 /* Conversion needed | OSD Supported */
90562e9c36d6 Only use hardware sync and prebuffering with mpegs!
mswitch
parents: 4265
diff changeset
518 flag = 0x1 | 0x4;
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
519 } else if (format == IMGFMT_BGR24) {
4267
90562e9c36d6 Only use hardware sync and prebuffering with mpegs!
mswitch
parents: 4265
diff changeset
520 /* Conversion needed | OSD Supported */
90562e9c36d6 Only use hardware sync and prebuffering with mpegs!
mswitch
parents: 4265
diff changeset
521 flag = 0x1 | 0x4;
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
522 } else {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
523 printf("VO: [dxr3] Format unsupported, mail dholm@iname.com\n");
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
524 #else
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
525 } else {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
526 printf("VO: [dxr3] You have disabled libmp1e support, you won't be able to play this format!\n");
3432
5cb7caab5536 MP1E configure patch by D. Holm.
atmos4
parents: 3387
diff changeset
527 #endif
4218
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
528 }
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
529 return flag;
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
530 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
531
3208
98a587aaf505 Support for YV12 with DXR3, patch by D. Holm.
atmos4
parents: 3201
diff changeset
532 static void uninit(void)
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
533 {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
534 printf("VO: [dxr3] Uninitializing\n");
4218
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
535 #ifdef USE_MP1E
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
536 if (picture_data[0]) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
537 free(picture_data[0]);
4218
3931c41f740a Added new syncengine thanks to a new previously undocumented feature of the em8300, this might fix playback on both slow and fast machines (more testing needed). This also requires users to get the em8300 driver from cvs until the next version is released (will probably happen this weekend)
mswitch
parents: 4166
diff changeset
538 }
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
539 #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
540 if (fd_video) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
541 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
542 }
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
543 if (fd_spu) {
4095
a3f3858b8c15 useless cosmetics changes... a.k.a. cvslog killer - patch by David Holm
arpi
parents: 4063
diff changeset
544 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
545 }
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
546 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
547 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
548 }
2645
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
549 }
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
550
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
551 static void check_events(void)
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
552 {
9d8d69fc517c ao_dxr3 by David Holm <dholm@telia.com>
arpi
parents:
diff changeset
553 }