annotate libvo/vo_zr.c @ 10780:94dd8a952b40

updated the list of supported lavc video encoders
author alex
date Mon, 01 Sep 2003 14:09:30 +0000
parents e3727e92e9d8
children 70b1673fe399
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
1 /*
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
2 * vo_zr.c - playback on zoran cards
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
3 * Copyright (C) Rik Snel 2001,2002, License GNU GPL v2
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
4 */
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
5
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
6 /* $Id$ */
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
7
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
8 #include <stdio.h>
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
9 #include <stdlib.h>
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
10 #include <string.h>
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
11 #include <unistd.h>
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
12 #include <fcntl.h>
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4668
diff changeset
13 #include <errno.h>
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
14 #include <sys/stat.h>
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
15 #include <sys/types.h>
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
16 #include <sys/time.h>
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
17 #include <sys/mman.h>
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
18 #include <sys/ioctl.h>
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
19 #include <linux/types.h>
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
20 #include <linux/videodev.h>
4668
d20978449650 migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents: 4651
diff changeset
21 #include "videodev_mjpeg.h"
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
22
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
23 #include "config.h"
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
24
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
25 #include "video_out.h"
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
26 #include "video_out_internal.h"
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
27 #include "../mp_msg.h"
10594
57bdcdb061d7 Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents: 10319
diff changeset
28 #include "../m_option.h"
4232
3a5f381c8c19 Missed fastmemcpy
nick
parents: 4214
diff changeset
29 #include "fastmemcpy.h"
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
30
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4596
diff changeset
31 #include "jpeg_enc.h"
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4596
diff changeset
32
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7962
diff changeset
33 static vo_info_t info =
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
34 {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
35 "Zoran ZR360[56]7/ZR36060 Driver (DC10(+)/buz/lml33/MatroxRR)",
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
36 "zr",
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
37 "Rik Snel <snel@phys.uu.nl>",
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
38 ""
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
39 };
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
40
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7962
diff changeset
41 LIBVO_EXTERN (zr)
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7962
diff changeset
42
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
43 #define ZR_MAX_DEVICES 4
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
44 /* General variables */
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
45
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
46 typedef struct {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
47 int width;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
48 int height;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
49 int xoff;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
50 int yoff;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
51 int set;
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
52 } geo_t;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
53
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
54 static int zr_count = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
55 static int zr_parsing = 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
56 static int framenum;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
57
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
58 typedef struct {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
59 /* commandline args given for this device (and defaults) */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
60 int vdec, hdec; /* requested decimation 1,2,4 */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
61 int fd; /* force decimation */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
62 int xdoff, ydoff; /* offset from upperleft of screen
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
63 * default is 'centered' */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
64 int quality; /* jpeg quality 1=best, 20=bad */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
65 geo_t g; /* view window (zrcrop) */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
66 char *device; /* /dev/video1 */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
67 int bw; /* if bw == 1, display in black&white */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
68 int norm; /* PAL/NTSC */
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
69 int buffer_size; /* MJPEG buffer size */
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
70
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
71 /* buffers + pointers + info */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
72
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
73 unsigned char *image;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
74 int image_width, image_height, size;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
75 int off_y, off_c, stride; /* for use by 'draw slice/frame' */
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
76
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
77 unsigned char *buf; /* the jpeg images will be placed here */
9976
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
78 unsigned int buf_allocated; /* size of the block actually allocated */
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
79 jpeg_enc_t *j;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
80 unsigned char *y_data, *u_data, *v_data; /* used by the jpeg encoder */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
81 int y_stride, u_stride, v_stride; /* these point somewhere in image */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
82
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
83 /* information for (and about) the zoran card */
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
84
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
85 int vdes; /* file descriptor of card */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
86 int frame, synco, queue; /* buffer management */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
87 struct mjpeg_sync zs; /* state information */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
88 struct mjpeg_params p;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
89 struct video_capability vc; /* max resolution and so on */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
90 int fields, stretchy; /* must the *image be interlaced
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
91 or stretched to fit on the screen? */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
92 } zr_info_t;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
93
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
94 static zr_info_t zr_info[ZR_MAX_DEVICES] = {
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
95 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0,
9976
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
96 0, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
97 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0,
9976
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
98 0, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
99 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0,
9976
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
100 0, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
101 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0,
9976
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
102 0, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
103
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
104
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
105
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
106
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
107 #define MJPEG_NBUFFERS 2
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
108 /*#define MJPEG_SIZE 1024*128*/
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
109
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
110
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
111 int zoran_getcap(zr_info_t *zr) {
10319
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
112 char* dev = NULL;
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
113
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
114 if (zr->device)
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
115 dev = zr->device;
10319
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
116 else {
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
117 struct stat vstat;
10319
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
118 const char *devs[] = {
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
119 "/dev/video",
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
120 "/dev/video0",
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
121 "/dev/v4l/video0",
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
122 "/dev/v4l0",
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
123 "/dev/v4l",
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
124 NULL
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
125 };
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
126 int i = 0;
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
127
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
128 do
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
129 {
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
130 if ((stat(devs[i], &vstat) == 0) && S_ISCHR(vstat.st_mode))
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
131 {
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
132 dev = devs[i];
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
133 mp_msg(MSGT_VO, MSGL_V, "zr: found video device %s\n", dev);
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
134 break;
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
135 }
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
136 } while (devs[++i] != NULL);
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
137
10319
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
138 if (!dev)
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
139 {
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
140 mp_msg(MSGT_VO, MSGL_ERR, "zr: unable to find video device\n");
2e9b7465d242 more flexible device name guessing
alex
parents: 9976
diff changeset
141 return 1;
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
142 }
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
143 }
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
144
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
145 zr->vdes = open(dev, O_RDWR);
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
146
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
147 if (zr->vdes < 0) {
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
148 mp_msg(MSGT_VO, MSGL_ERR, "zr: error opening %s: %s\n",
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
149 dev, strerror(errno));
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
150 return 1;
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
151 }
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
152
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
153 /* before we can ask for the maximum resolution, we must set
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
154 * the correct tv norm */
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
155
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
156 if (ioctl(zr->vdes, MJPIOC_G_PARAMS, &zr->p) < 0) {
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
157 mp_msg(MSGT_VO, MSGL_ERR, "zr: device at %s is probably not a DC10(+)/buz/lml33\n", dev);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
158 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
159 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
160
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
161 if (zr->p.norm != zr->norm && zr->norm != VIDEO_MODE_AUTO) {
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
162 /* attempt to set requested norm */
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
163 zr->p.norm = zr->norm;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
164 if (ioctl(zr->vdes, MJPIOC_S_PARAMS, &zr->p) < 0) {
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
165 mp_msg(MSGT_VO, MSGL_ERR,
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
166 "zr: unable to change video norm, use another program to change it (XawTV)\n");
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
167 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
168 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
169 ioctl(zr->vdes, MJPIOC_G_PARAMS, &zr->p);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
170 if (zr->norm != zr->p.norm) {
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
171 mp_msg(MSGT_VO, MSGL_ERR,
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
172 "zr: unable to change video norm, use another program to change it (XawTV)\n");
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
173 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
174 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
175 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
176
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
177 if (ioctl(zr->vdes, VIDIOCGCAP, &zr->vc) < 0) {
10718
alex
parents: 10605
diff changeset
178 mp_msg(MSGT_VO, MSGL_ERR, "zr: error getting video capabilities from %s\n", dev);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
179 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
180 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
181 mp_msg(MSGT_VO, MSGL_V, "zr: MJPEG card reports maxwidth=%d, maxheight=%d\n", zr->vc.maxwidth, zr->vc.maxheight);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
182
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
183 return 0;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
184 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
185
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
186 int init_zoran(zr_info_t *zr, int stretchx, int stretchy) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
187 struct mjpeg_requestbuffers zrq;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
188 /* center the image, and stretch it as far as possible (try to keep
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
189 * aspect) and check if it fits */
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
190 if (zr->image_width > zr->vc.maxwidth) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
191 mp_msg(MSGT_VO, MSGL_ERR, "zr: movie to be played is too wide, max width currenty %d\n", zr->vc.maxwidth);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
192 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
193 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
194
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
195 if (zr->image_height > zr->vc.maxheight) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
196 mp_msg(MSGT_VO, MSGL_ERR, "zr: movie to be played is too high, max height currenty %d\n", zr->vc.maxheight);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
197 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
198 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
199
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
200 zr->p.decimation = 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
201 zr->p.HorDcm = stretchx;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
202 zr->p.VerDcm = stretchy;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
203 zr->p.TmpDcm = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
204 zr->p.field_per_buff = zr->fields;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
205 if (zr->xdoff == -1) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
206 zr->p.img_x = (zr->vc.maxwidth -
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
207 zr->p.HorDcm*(int)zr->image_width/zr->hdec)/2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
208 } else {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
209 zr->p.img_x = zr->xdoff;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
210 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
211 if (zr->ydoff == -1) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
212 zr->p.img_y = (zr->vc.maxheight - zr->p.VerDcm*
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
213 (3-zr->fields)*(int)zr->image_height)/4;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
214 } else {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
215 zr->p.img_y = zr->ydoff;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
216 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
217 zr->p.img_width = zr->p.HorDcm*zr->image_width/zr->hdec;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
218 zr->p.img_height = zr->p.VerDcm*zr->image_height/zr->fields;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
219 mp_msg(MSGT_VO, MSGL_V, "zr: geometry (after 'scaling'): %dx%d+%d+%d fields=%d, w=%d, h=%d\n", zr->p.img_width, (3-zr->fields)*zr->p.img_height, zr->p.img_x, zr->p.img_y, zr->fields, zr->image_width/zr->hdec, zr->image_height);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
220
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
221 if (ioctl(zr->vdes, MJPIOC_S_PARAMS, &zr->p) < 0) {
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
222 mp_msg(MSGT_VO, MSGL_ERR, "zr: error setting display parameters\n");
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
223 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
224 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
225
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
226 zrq.count = MJPEG_NBUFFERS;
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
227 zrq.size = 1024*zr->buffer_size;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
228
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
229 if (ioctl(zr->vdes, MJPIOC_REQBUFS, &zrq)) {
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
230 mp_msg(MSGT_VO, MSGL_ERR, "zr: error requesting %d buffers of size %d\n", zrq.count, zrq.size);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
231 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
232 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
233
9976
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
234 /* the buffer count allocated may be different to the request */
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
235 zr->buf_allocated = zrq.count * zrq.size;
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
236 zr->buf = (unsigned char*)mmap(0, zrq.count*zrq.size,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
237 PROT_READ|PROT_WRITE, MAP_SHARED, zr->vdes, 0);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
238
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
239 if (zr->buf == MAP_FAILED) {
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
240 mp_msg(MSGT_VO, MSGL_ERR, "zr: error requesting %d buffers of size %d\n", zrq.count, zrq.size);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
241 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
242 }
9976
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
243
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
244 zr->queue = 0;
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
245 zr->synco = 0;
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
246
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
247 return 0;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
248 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
249
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
250 void uninit_zoran(zr_info_t *zr) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
251 if (zr->image) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
252 free(zr->image);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
253 zr->image=NULL;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
254 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
255 while (zr->queue > zr->synco + 1) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
256 if (ioctl(zr->vdes, MJPIOC_SYNC, &zr->zs) < 0)
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
257 mp_msg(MSGT_VO, MSGL_ERR, "zr: error waiting for buffers to become free\n");
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
258 zr->synco++;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
259 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
260 /* stop streaming */
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
261 zr->frame = -1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
262 if (ioctl(zr->vdes, MJPIOC_QBUF_PLAY, &zr->frame) < 0)
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
263 mp_msg(MSGT_VO, MSGL_ERR, "zr: error stopping playback of last frame\n");
9976
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
264 if (munmap(zr->buf,zr->buf_allocated))
5843993013a8 fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
rik
parents: 8148
diff changeset
265 mp_msg(MSGT_VO, MSGL_ERR, "zr: error unmapping buffer\n");
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
266 close(zr->vdes);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
267 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
268
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
269 int zr_geometry_sane(geo_t *g, unsigned int width, unsigned int height) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
270 if (g->set) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
271 if (g->width%2 != 0 || g->height%2 != 0 ||
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
272 g->xoff%2 != 0 || g->yoff%2 != 0) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
273 mp_msg(MSGT_VO, MSGL_ERR, "zr: arguments in -zrcrop must be multiples of 2\n");
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
274 return 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
275 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
276 if (g->width <= 0 || g->height <= 0 ||
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
277 g->xoff < 0 || g->yoff < 0) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
278 mp_msg(MSGT_VO, MSGL_ERR, "zr: width and height must be positive and offset nonnegative\n");
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
279 return 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
280 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
281 if (g->width + g->xoff > width) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
282 mp_msg(MSGT_VO, MSGL_ERR, "zr: width+xoffset (%d+%d>%d) is too big\n", g->width, g->xoff, width);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
283 return 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
284 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
285 if (g->height + g->yoff > height) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
286 mp_msg(MSGT_VO, MSGL_ERR, "zr: height+yoffset (%d+%d>%d) is too big\n", g->height, g->yoff, height);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
287 return 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
288 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
289 } else {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
290 g->width = width;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
291 g->height = height;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
292 g->xoff = 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
293 g->yoff = 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
294 g->set = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
295 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
296 return 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
297 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
298
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
299
4433
df8e0f71cc3c new info for tuning
nick
parents: 4361
diff changeset
300 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
7124
eca7dbad0166 finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents: 6933
diff changeset
301 uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
302 {
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
303 int i, tmp, stretchx, stretchy;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
304 framenum = 0;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
305 if (format != IMGFMT_YV12 && format != IMGFMT_YUY2) {
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
306 printf("vo_zr called with wrong format");
10605
alex
parents: 10594
diff changeset
307 return 1;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
308 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
309 for (i = 0; i < zr_count; i++) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
310 zr_info_t *zr = &zr_info[i];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
311 geo_t *g = &zr->g;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
312
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
313 zr->stride = 2*width;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
314 if (zr_geometry_sane(g, width, height)) return 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
315
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
316 /* we must know the maximum resolution of the device
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
317 * it differs for DC10+ and buz for example */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
318 zoran_getcap(zr); /*must be called before init_zoran */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
319 /* make the scaling decision
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
320 * we are capable of stretching the image in the horizontal
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
321 * direction by factors 1, 2 and 4
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
322 * we can stretch the image in the vertical direction by a
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
323 * factor of 1 and 2 AND we must decide about interlacing */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
324 if (g->width > zr->vc.maxwidth/2 ||
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
325 g->height > zr->vc.maxheight/2) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
326 stretchx = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
327 stretchy = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
328 zr->fields = 2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
329 if (zr->vdec == 2) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
330 zr->fields = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
331 } else if (zr->vdec == 4) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
332 zr->fields = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
333 stretchy = 2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
334 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
335 stretchx = zr->hdec;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
336 } else if (g->width > zr->vc.maxwidth/4 ||
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
337 g->height > zr->vc.maxheight/4) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
338 stretchx = 2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
339 stretchy = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
340 zr->fields = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
341 if (zr->vdec == 2) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
342 stretchy = 2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
343 } else if (zr->vdec == 4) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
344 if (!zr->fd) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
345 mp_msg(MSGT_VO, MSGL_WARN, "zr: vertical decimation too high, changing to 2 (use -zrfd to keep vdec=4)\n");
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
346 zr->vdec = 2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
347 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
348 stretchy = 2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
349 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
350 if (zr->hdec == 2) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
351 stretchx = 4;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
352 } else if (zr->hdec == 4){
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
353 if (!zr->fd) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
354 mp_msg(MSGT_VO, MSGL_WARN, "zr: horizontal decimation too high, changing to 2 (use -zrfd to keep hdec=4)\n");
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
355 zr->hdec = 2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
356 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
357 stretchx = 4;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
358 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
359 } else {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
360 /* output image is maximally stretched */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
361 stretchx = 4;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
362 stretchy = 2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
363 zr->fields = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
364 if (zr->vdec != 1 && !zr->fd) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
365 mp_msg(MSGT_VO, MSGL_WARN, "zr: vertical decimation too high, changing to 1 (use -zrfd to keep vdec=%d)\n", zr->vdec);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
366 zr->vdec = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
367 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
368 if (zr->hdec != 1 && !zr->fd) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
369 mp_msg(MSGT_VO, MSGL_WARN, "zr: vertical decimation too high, changing to 1 (use -zrfd to keep hdec=%d)\n", zr->hdec);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
370 zr->hdec = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
371 }
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
372 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
373 /* It can be that the original frame was too big for display,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
374 * or that the width of the decimated image (for example) after
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
375 * padding up to a multiple of 16 has become too big. (orig
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
376 * width 720 (exactly right for the Buz) after decimation 360,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
377 * after padding up to a multiple of 16 368, display 736 -> too
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
378 * large). In these situations we auto(re)crop. */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
379 tmp = 16*((g->width - 1)/(zr->hdec*16) + 1);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
380 if (stretchx*tmp > zr->vc.maxwidth) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
381 g->xoff += 2*((g->width - zr->hdec*(tmp-16))/4);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
382 /* g->off must be a multiple of 2 */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
383 g->width = zr->hdec*(tmp - 16);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
384 g->set = 0; /* we abuse this field to
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
385 report that g has changed*/
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
386 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
387 tmp = 8*zr->fields*((g->height - 1)/(zr->vdec*zr->fields*8)+1);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
388 if (stretchy*tmp > zr->vc.maxheight) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
389 g->yoff += 2*((g->height - zr->vdec*
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
390 (tmp - 8*zr->fields))/4);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
391 g->height = zr->vdec*(tmp - 8*zr->fields);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
392 g->set = 0;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
393 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
394 if (!g->set)
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
395 mp_msg(MSGT_VO, MSGL_V, "zr: auto(re)cropping %dx%d+%d+%d to make the image fit on the screen\n", g->width, g->height, g->xoff, g->yoff);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
396
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
397 /* the height must be a multiple of fields*8 and the width
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
398 * must be a multiple of 16 */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
399 /* add some black borders to make it so, and center the image*/
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
400 zr->image_height = zr->fields*8*((g->height/zr->vdec - 1)/
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
401 (zr->fields*8) + 1);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
402 zr->image_width = (zr->hdec*16)*((g->width - 1)/(zr->hdec*16) + 1);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
403 zr->off_y = (zr->image_height - g->height/zr->vdec)/2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
404 if (zr->off_y%2 != 0) zr->off_y++;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
405 zr->off_y *= zr->image_width;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
406 zr->off_c = zr->off_y/4;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
407 zr->off_y += (zr->image_width - g->width)/2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
408 if (zr->off_y%2 != 0) zr->off_y--;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
409 zr->off_c += (zr->image_width - g->width)/4;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
410 zr->size = zr->image_width*zr->image_height;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
411 mp_msg(MSGT_VO, MSGL_V, "zr: input: %dx%d, cropped: %dx%d, output: %dx%d, off_y=%d, off_c=%d\n", width, height, g->width, g->height, zr->image_width, zr->image_height, zr->off_y, zr->off_c);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
412
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
413 zr->image = malloc(2*zr->size); /* this buffer allows for YUV422 data,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
414 * so it is a bit too big for YUV420 */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
415 if (!zr->image) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
416 mp_msg(MSGT_VO, MSGL_ERR, "zr: Memory exhausted\n");
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
417 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
418 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
419 /* and make sure that the borders are _really_ black */
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
420 switch (format) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
421 case IMGFMT_YV12:
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
422 memset(zr->image, 0, zr->size);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
423 memset(zr->image + zr->size, 0x80, zr->size/4);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
424 memset(zr->image + 3*zr->size/2, 0x80, zr->size/4);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
425 zr->y_data = zr->image;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
426 zr->u_data = zr->image + zr->size;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
427 zr->v_data = zr->image + 3*zr->size/2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
428
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
429 zr->y_stride = zr->image_width;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
430 zr->u_stride = zr->image_width/2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
431 zr->v_stride = zr->image_width/2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
432
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
433 zr->j = jpeg_enc_init(zr->image_width/zr->hdec,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
434 zr->image_height/zr->fields,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
435 zr->hdec, zr->y_stride*zr->fields,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
436 zr->hdec, zr->u_stride*zr->fields,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
437 zr->hdec, zr->v_stride*zr->fields,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
438 1, zr->quality, zr->bw);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
439 break;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
440 case IMGFMT_YUY2:
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
441 for (tmp = 0; tmp < 2*zr->size; tmp+=4) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
442 zr->image[tmp] = 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
443 zr->image[tmp+1] = 0x80;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
444 zr->image[tmp+2] = 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
445 zr->image[tmp+3] = 0x80;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
446 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
447
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
448 zr->y_data = zr->image;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
449 zr->u_data = zr->image + 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
450 zr->v_data = zr->image + 3;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
451
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
452 zr->y_stride = 2*zr->image_width;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
453 zr->u_stride = 2*zr->image_width;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
454 zr->v_stride = 2*zr->image_width;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
455
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
456 zr->j = jpeg_enc_init(zr->image_width/zr->hdec,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
457 zr->image_height/zr->fields,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
458 zr->hdec*2,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
459 zr->y_stride*zr->fields,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
460 zr->hdec*4,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
461 zr->u_stride*zr->fields,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
462 zr->hdec*4,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
463 zr->v_stride*zr->fields,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
464 0, zr->quality, zr->bw);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
465 break;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
466 default:
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
467 mp_msg(MSGT_VO, MSGL_FATAL, "zr: internal inconsistency in vo_zr\n");
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
468 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
469
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
470
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
471 if (zr->j == NULL) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
472 mp_msg(MSGT_VO, MSGL_ERR, "zr: error initializing the jpeg encoder\n");
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
473 return 1;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
474 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
475
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
476 if (init_zoran(zr, stretchx, stretchy)) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
477 return 1;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
478 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
479
4361
e7744189e03f fix a decimation/scaling bug in vo_zr and some verbose messages have changed - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4352
diff changeset
480 }
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
481 return 0;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
482 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
483
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
484 static void draw_osd(void) {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
485 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
486
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
487 static void flip_page (void) {
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
488 int i, j, k;
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4596
diff changeset
489 //FILE *fp;
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4596
diff changeset
490 //char filename[100];
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
491 /* do we have a free buffer? */
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
492 for (j = 0; j < zr_count; j++) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
493 zr_info_t *zr = &zr_info[j];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
494 if (zr->queue-zr->synco < MJPEG_NBUFFERS) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
495 zr->frame = zr->queue;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
496 } else {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
497 if (ioctl(zr->vdes, MJPIOC_SYNC, &zr->zs) < 0)
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
498 mp_msg(MSGT_VO, MSGL_ERR, "zr: error waiting for buffers to become free\n");
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
499 zr->frame = zr->zs.frame;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
500 zr->synco++;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
501 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
502 k=0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
503 for (i = 0; i < zr->fields; i++)
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
504 k+=jpeg_enc_frame(zr->j, zr->y_data + i*zr->y_stride,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
505 zr->u_data + i*zr->u_stride,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
506 zr->v_data + i*zr->v_stride,
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
507 zr->buf+
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
508 1024*zr->frame*zr->buffer_size+k);
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
509 if (k > 1024*zr->buffer_size) mp_msg(MSGT_VO, MSGL_WARN, "zr: jpeg image too large or buffer size too small, try -zrbsize 256. If your\nmotherboard/card combo can't handle that: lower the jpeg encoding quality\nor the resolution of the movie. Image may become distorted, MPlayer may crash.\nDon't bugreport, it is a known problem. The standard buffer size of 128kB\nshould be sufficient and is a safe-for-almost-all choice.\n");
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
510 }
4651
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4596
diff changeset
511 /* Warning: Only the first jpeg image contains huffman- and
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4596
diff changeset
512 * quantisation tables, so don't expect files other than
49f2bc22f880 mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4596
diff changeset
513 * test0001.jpg to be readable */
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
514 /*sprintf(filename, "test%04d.jpg", framenum);
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
515 fp = fopen(filename, "w");
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
516 if (!fp) exit(1);
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
517 fwrite(buf+frame*zrq.size, 1, k, fp);
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
518 fclose(fp);*/
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
519 /*fp = fopen("test1.jpg", "r");
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
520 fread(buf+frame*zrq.size, 1, 2126, fp);
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
521 fclose(fp);*/
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
522
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
523 for (j = 0; j < zr_count; j++) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
524 zr_info_t *zr = &zr_info[j];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
525 if (ioctl(zr->vdes, MJPIOC_QBUF_PLAY, &zr->frame) < 0)
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
526 mp_msg(MSGT_VO, MSGL_ERR, "zr: error queueing buffer for playback\n");
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
527 zr->queue++;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
528 }
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
529
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
530 framenum++;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
531 return;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
532 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
533
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
534 static uint32_t draw_frame(uint8_t * src[]) {
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
535 int i, j;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
536 char *source, *dest;
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
537 //printf("draw frame called\n");
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
538 for (j = 0; j < zr_count; j++) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
539 zr_info_t *zr = &zr_info[j];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
540 geo_t *g = &zr->g;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
541 source = src[0] + 2*g->yoff*zr->vdec*zr->stride + 2*g->xoff;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
542 dest = zr->image + 2*zr->off_y;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
543 for (i = 0; i < g->height/zr->vdec; i++) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
544 memcpy(dest, source, zr->image_width*2);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
545 dest += 2*zr->image_width;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
546 source += zr->vdec*zr->stride;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
547 }
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
548 }
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
549 return 0;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
550 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
551
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
552 static uint32_t query_format(uint32_t format) {
6213
7accc81d6f04 revised query_format
alex
parents: 5865
diff changeset
553 if(format==IMGFMT_YV12 || format==IMGFMT_YUY2)
6235
3fbaae881e40 10l - noticed by Terry Mohan <tmohan@users.sourceforge.net>
arpi
parents: 6213
diff changeset
554 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
555 return 0;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
556 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
557
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
558 static void uninit(void) {
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
559 int j;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
560 mp_msg(MSGT_VO, MSGL_V, "zr: uninit called\n");
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
561 for (j = 0; j < zr_count; j++) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
562 jpeg_enc_uninit(zr_info[j].j);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
563 uninit_zoran(&zr_info[j]);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
564 }
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
565 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
566
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
567 static void check_events(void) {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
568 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
569
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
570
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
571 static uint32_t draw_slice(uint8_t *srcimg[], int stride[],
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
572 int wf, int hf, int xf, int yf) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
573 int i, j, w, h, x, y;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
574 /* Apply 'geometry', crop unwanted parts */
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
575 uint8_t *dst;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
576 //printf("before: w=%d, h=%d, x=%d, y=%d, src0=%p, src1=%p, src2=%p\n", w, h, x, y, srcimg[0], srcimg[1], srcimg[2]);
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
577 for (j = 0; j < zr_count; j++) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
578 uint8_t *src=srcimg[0];
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
579 uint8_t *src1=srcimg[1];
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
580 uint8_t *src2=srcimg[2];
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
581 zr_info_t *zr = &zr_info[j];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
582 geo_t *g = &zr->g;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
583 w = wf; h = hf; x = xf; y = yf;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
584 if (x < g->xoff) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
585 src += g->xoff - x;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
586 src1 += (g->xoff - x)/2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
587 src2 += (g->xoff - x)/2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
588 w -= g->xoff - x;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
589 if (w < 0) break; //return 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
590 x = 0 /*g.xoff*/;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
591 } else {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
592 x -= g->xoff;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
593 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
594 if (x + w > g->width) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
595 w = g->width - x;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
596 if (w < 0) break; //return 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
597 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
598 if (y < g->yoff) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
599 src += (g->yoff - y)*stride[0];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
600 src1 += ((g->yoff - y)/2)*stride[1];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
601 src2 += ((g->yoff - y)/2)*stride[2];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
602 h -= g->yoff - y;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
603 if (h < 0) break; //return 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
604 y = 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
605 } else {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
606 y -= g->yoff;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
607 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
608 if (y + h > g->height) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
609 h = g->height - y;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
610 if (h < 0) break; //return 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
611 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
612 //printf("after: w=%d, h=%d, x=%d, y=%d, src0=%p, src1=%p, src2=%p\n", w, h, x, y, srcimg[0], srcimg[1], srcimg[2]);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
613 dst=zr->image + zr->off_y + zr->image_width*(y/zr->vdec)+x;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
614 // copy Y:
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
615 for (i = 0; i < h; i++) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
616 if ((i + x)%zr->vdec == 0) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
617 memcpy(dst,src,w);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
618 dst+=zr->image_width;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
619 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
620 src+=stride[0];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
621
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
622 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
623 if (!zr->bw) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
624 // copy U+V:
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
625 uint8_t *dst1=zr->image + zr->size + zr->off_c+ (y/(zr->vdec*2))*zr->image_width/2+(x/2);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
626 uint8_t *dst2=zr->image + 3*zr->size/2 + zr->off_c +
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
627 (y/(zr->vdec*2))*
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
628 zr->image_width/2+(x/2);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
629 for (i = 0; i< h/2; i++) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
630 if ((i+x/2)%zr->vdec == 0) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
631 memcpy(dst1,src1,w/2);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
632 memcpy(dst2,src2,w/2);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
633 dst1+=zr->image_width/2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
634 dst2+=zr->image_width/2;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
635 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
636 src1+=stride[1];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
637 src2+=stride[2];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
638 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
639 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
640 }
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
641 return 0;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
642 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
643
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
644
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
645 /* copied and adapted from vo_aa_parseoption */
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
646 int
10594
57bdcdb061d7 Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents: 10319
diff changeset
647 vo_zr_parseoption(m_option_t* conf, char *opt, char *param){
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
648 /* got an option starting with zr */
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
649 zr_info_t *zr = &zr_info[zr_parsing];
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
650 int i;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
651 /* do WE need it ?, always */
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
652 if (!strcasecmp(opt, "zrdev")) {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
653 if (param == NULL) return ERR_MISSING_PARAM;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
654 //if ((i=getcolor(param))==-1) return ERR_OUT_OF_RANGE;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
655 //aaopt_osdcolor=i;
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
656 free(zr->device);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
657 zr->device = malloc(strlen(param)+1);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
658 strcpy(zr->device, param);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
659 mp_msg(MSGT_VO, MSGL_V, "zr: using device %s\n", zr->device);
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
660 return 1;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
661 } else if (!strcasecmp(opt, "zrbw")) {
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
662 if (param != NULL) {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
663 return ERR_OUT_OF_RANGE;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
664 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
665 zr->bw = 1;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
666 return 1;
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
667 } else if (!strcasecmp(opt, "zrfd")) {
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
668 if (param != NULL) {
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
669 return ERR_OUT_OF_RANGE;
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
670 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
671 zr->fd = 1;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
672 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
673 } else if (!strcasecmp(opt, "zrcrop")){
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
674 geo_t *g = &zr->g;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
675 if (g->set == 1) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
676 zr_parsing++;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
677 zr_count++;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
678 zr = &zr_info[zr_parsing];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
679 g = &zr->g;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
680 if (zr_count > 4) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
681 mp_msg(MSGT_VO, MSGL_ERR, "zr: too many simultaneus display devices requested (max. is 4)\n");
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
682 return ERR_OUT_OF_RANGE;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
683 }
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
684 }
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
685 if (param == NULL) return ERR_MISSING_PARAM;
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
686 if (sscanf(param, "%dx%d+%d+%d", &g->width, &g->height,
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
687 &g->xoff, &g->yoff) != 4) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
688 g->xoff = 0; g->yoff = 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
689 if (sscanf(param, "%dx%d", &g->width, &g->height) != 2) {
5666
685df37d2c80 Minor patches from Tomi Ollila <Tomi.Ollila@iki.fi>:
rik
parents: 4737
diff changeset
690 mp_msg(MSGT_VO, MSGL_ERR, "zr: argument to -zrcrop must be of the form 352x288+16+0\n");
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
691 return ERR_OUT_OF_RANGE;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
692 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
693 }
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
694 g->set = 1;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
695 mp_msg(MSGT_VO, MSGL_V, "zr: cropping %s\n", param);
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
696 return 1;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
697 }else if (!strcasecmp(opt, "zrhdec")) {
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
698 i = atoi(param);
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
699 if (i != 1 && i != 2 && i != 4) return ERR_OUT_OF_RANGE;
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
700 zr->hdec = i;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
701 return 1;
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
702 }else if (!strcasecmp(opt, "zrbsize")) {
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
703 i = atoi(param);
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
704 if (i < 32) return ERR_OUT_OF_RANGE;
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
705 zr->buffer_size = i;
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
706 return 1;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
707 }else if (!strcasecmp(opt, "zrvdec")) {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
708 i = atoi(param);
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
709 if (i != 1 && i != 2 && i != 4) return ERR_OUT_OF_RANGE;
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
710 zr->vdec = i;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
711 return 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
712 }else if (!strcasecmp(opt, "zrxdoff")) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
713 i = atoi(param);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
714 zr->xdoff = i;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
715 return 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
716 }else if (!strcasecmp(opt, "zrydoff")) {
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
717 i = atoi(param);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
718 zr->ydoff = i;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
719 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
720 }else if (!strcasecmp(opt, "zrquality")) {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
721 i = atoi(param);
5865
f4b470b66a99 update: we use the new quantizer in libavcodec, -zrquality 1 is allowed
rik
parents: 5666
diff changeset
722 if (i < 1 || i > 20) return ERR_OUT_OF_RANGE;
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
723 zr->quality = i;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
724 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
725 }else if (!strcasecmp(opt, "zrnorm")) {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
726 if (param == NULL) return ERR_MISSING_PARAM;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
727 if (!strcasecmp(param, "NTSC")) {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
728 mp_msg(MSGT_VO, MSGL_V, "zr: Norm set to NTSC\n");
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
729 zr->norm = VIDEO_MODE_NTSC;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
730 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
731 } else if (!strcasecmp(param, "PAL")) {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
732 mp_msg(MSGT_VO, MSGL_V, "zr: Norm set to PAL\n");
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
733 zr->norm = VIDEO_MODE_PAL;
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
734 return 1;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
735 } else {
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
736 return ERR_OUT_OF_RANGE;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
737 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
738 }else if (!strcasecmp(opt, "zrhelp")){
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
739 printf("Help for -vo zr: Zoran ZR360[56]7/ZR36060 based MJPEG capture/playback cards\n");
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
740 printf("\n");
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
741 printf("Here are the zr options:\n");
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
742 printf(
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
743 "\n"
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
744 " -zrcrop specify part of the input image that\n"
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
745 " you want to see as an x-style geometry string\n"
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
746 " example: -zrcrop 352x288+16+0\n"
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
747 " -zrvdec vertical decimation 1, 2 or 4\n"
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
748 " -zrhdec horizontal decimation 1, 2 or 4\n"
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
749 " -zrfd decimation is only done if the primitive\n"
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
750 " hardware upscaler can correct for the decimation,\n"
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
751 " this switch allows you to see the effects\n"
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
752 " of too much decimation\n"
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
753 " -zrbw display in black&white (speed increase)\n"
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
754 " -zrxdoff x offset from upper-left of TV screen (default is 'centered')\n"
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
755 " -zrydoff y offset from upper-left of TV screen (default is 'centered')\n"
5865
f4b470b66a99 update: we use the new quantizer in libavcodec, -zrquality 1 is allowed
rik
parents: 5666
diff changeset
756 " -zrquality jpeg compression quality [BEST] 1 - 20 [VERY BAD]\n"
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
757 " -zrdev playback device (example -zrdev /dev/video1)\n"
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
758 " -zrnorm specify norm PAL/NTSC (default: leave at current setting)\n"
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
759 " -zrbsize set the MPJEG buffer size to a number of kilobytes (def. 128)\n"
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
760 " use this if MPlayer complains about the MJPEG buffer size\n"
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
761 " being too small, 256kB is recommended. If your card/mobo\n"
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
762 " doesn't allow buffers > 128kB lower the jpeg encoding\n"
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
763 " quality or the resolution of the movie\n"
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
764 "\n"
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
765 "Cinerama support: additional occurances of -zrcrop activate cinerama mode,\n"
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
766 "suppose you have a 704x272 movie, two DC10+ cards and two beamers (or tv's),\n"
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
767 "then you would issue the following command:\n\n"
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
768 "mplayer -vo zr -zrcrop 352x272+0+0 -zrdev /dev/video0 -zrcrop 352x272+352+0 \\\n"
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
769 " -zrdev /dev/video1 movie.avi\n\n"
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
770 "Options appearing after the second -zrcrop apply to the second card, it is\n"
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
771 "possible to dispay at a different jpeg quality or at different decimations.\n\n"
7903
5b9707780f3d spelling: paramerters -> parameters
rik
parents: 7124
diff changeset
772 "The parameters -zrxdoff and -zrydoff can be used to align the two images.\n"
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
773 "The maximum number of zoran cards participating in cinerama is 4, so you can\n"
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
774 "build a 2x2 vidiwall. (untested for obvious reasons, the setup wit a buz and\n"
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
775 "a DC10+ (and no beamers) is tested, however)\n"
4214
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
776 );
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
777 exit(0);
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
778
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
779 }
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
780 return ERR_NOT_AN_OPTION;
664984198aef zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff changeset
781 }
4259
f96a2b9b41eb Added reverting support for -zr* options
albeu
parents: 4232
diff changeset
782
10594
57bdcdb061d7 Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents: 10319
diff changeset
783 void vo_zr_revertoption(m_option_t* opt,char* param) {
4259
f96a2b9b41eb Added reverting support for -zr* options
albeu
parents: 4232
diff changeset
784
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
785 zr_info_t *zr = &zr_info[1];
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
786 zr_count = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
787 zr_parsing = 0;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
788
4259
f96a2b9b41eb Added reverting support for -zr* options
albeu
parents: 4232
diff changeset
789 if (!strcasecmp(param, "zrdev")) {
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
790 if(zr->device)
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
791 free(zr->device);
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
792 zr->device=NULL;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
793 } else if (!strcasecmp(param, "zrbw"))
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
794 zr->bw=0;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
795 else if (!strcasecmp(param, "zrfd"))
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
796 zr->fd=0;
4259
f96a2b9b41eb Added reverting support for -zr* options
albeu
parents: 4232
diff changeset
797 else if (!strcasecmp(param, "zrcrop"))
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
798 zr->g.set = zr->g.xoff = zr->g.yoff = 0;
7962
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
799 else if (!strcasecmp(param, "zrbsize"))
1d2d47aa8717 some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
rik
parents: 7903
diff changeset
800 zr->buffer_size = 128;
4348
d4acef803c94 use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents: 4259
diff changeset
801 else if (!strcasecmp(param, "zrhdec"))
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
802 zr->hdec = 1;
4259
f96a2b9b41eb Added reverting support for -zr* options
albeu
parents: 4232
diff changeset
803 else if (!strcasecmp(param, "zrvdec"))
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
804 zr->vdec = 1;
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
805 else if (!strcasecmp(param, "zrxdoff"))
6933
rik
parents: 6932
diff changeset
806 zr->xdoff = -1;
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
807 else if (!strcasecmp(param, "zrydoff"))
6933
rik
parents: 6932
diff changeset
808 zr->ydoff = -1;
4259
f96a2b9b41eb Added reverting support for -zr* options
albeu
parents: 4232
diff changeset
809 else if (!strcasecmp(param, "zrquality"))
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
810 zr->quality = 2;
4259
f96a2b9b41eb Added reverting support for -zr* options
albeu
parents: 4232
diff changeset
811 else if (!strcasecmp(param, "zrnorm"))
6932
56cb4837384b cinerama support in -vo zr for people with more than one zoran card, documentation contained in -zrhelp
rik
parents: 6235
diff changeset
812 zr->norm = VIDEO_MODE_AUTO;
4259
f96a2b9b41eb Added reverting support for -zr* options
albeu
parents: 4232
diff changeset
813
f96a2b9b41eb Added reverting support for -zr* options
albeu
parents: 4232
diff changeset
814 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4348
diff changeset
815
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4348
diff changeset
816 static uint32_t preinit(const char *arg)
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4348
diff changeset
817 {
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4668
diff changeset
818 if(arg)
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4668
diff changeset
819 {
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4668
diff changeset
820 printf("vo_zr: Unknown subdevice: %s\n",arg);
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4668
diff changeset
821 return ENOSYS;
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4668
diff changeset
822 }
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4668
diff changeset
823 return 0;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4348
diff changeset
824 }
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4348
diff changeset
825
4596
c35d7ce151b3 10000hl to Holm... control MUST BE static...
arpi
parents: 4592
diff changeset
826 static uint32_t control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4348
diff changeset
827 {
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
828 switch (request) {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
829 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
830 return query_format(*((uint32_t*)data));
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
831 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
832 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4348
diff changeset
833 }