Mercurial > mplayer.hg
annotate libvo/vo_zr.c @ 4515:4064940f3f9b
optimization
author | nick |
---|---|
date | Sun, 03 Feb 2002 15:16:46 +0000 |
parents | df8e0f71cc3c |
children | 5fbfd8545c3b |
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 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
6 #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
|
7 #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
|
8 #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
|
9 #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
|
10 #include <fcntl.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 <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
|
12 #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
|
13 #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
|
14 #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
|
15 #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
|
16 #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
|
17 #include <linux/videodev.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 "zoran.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 |
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 "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
|
21 |
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 #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
|
23 #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
|
24 #include "../mp_msg.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
|
25 #include "../cfgparser.h" |
4232 | 26 #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
|
27 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
28 LIBVO_EXTERN (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
|
29 |
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 static vo_info_t vo_info = |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
31 { |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
32 "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
|
33 "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
|
34 "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
|
35 "" |
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 }; |
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 |
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 /* 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
|
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 static int image_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
|
41 static int image_height; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
42 static 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
|
43 static int 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
|
44 static int fields = 1; /* currently no interlacing */ |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
45 static int zrfd = 0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
46 static int bw = 0; /* if bw == 1, then display in black&white */ |
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
|
47 static int vdec = 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
48 static int hdec = 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
|
49 static int size; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
50 static int quality = 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
|
51 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 int 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
|
58 } geo; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
59 geo g = {0, 0, 0, 0, 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
|
60 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
61 static uint8_t *image=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
|
62 static uint8_t *buf=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
|
63 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
64 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
65 /* Variables needed for Zoran */ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
66 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
67 int vdes; /* the file descriptor of the video device */ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
68 int frame = 0, synco = 0, queue = 0; /* buffer management */ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
69 struct zoran_params zp; |
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 struct zoran_requestbuffers zrq; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
71 struct zoran_sync zs; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
72 struct video_capability vc; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
73 #define MJPEG_NBUFFERS 2 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
74 #define MJPEG_SIZE 1024*256 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
75 |
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 //should be command line options |
4259 | 77 int norm = VIDEO_MODE_AUTO; |
78 #ifndef VO_ZR_DEFAULT_DEVICE | |
79 #define VO_ZR_DEFAULT_DEVICE "/dev/video" | |
80 #endif | |
81 char *device = 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
|
82 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
83 |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
84 extern int mjpeg_encode_frame(char *bufr, int field); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
85 extern void mjpeg_encoder_init(int w, int h, unsigned char *y, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
86 int y_psize, int y_rsize, unsigned char *u, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
87 int u_psize, int u_rsize, unsigned char *v, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
88 int v_psize, int v_rsize, int f, int cu, int q, int b); |
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
|
89 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
90 int zoran_getcap() { |
4259 | 91 char* dev = device ? device : VO_ZR_DEFAULT_DEVICE; |
92 vdes = open(dev, O_RDWR); | |
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
|
93 /* 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
|
94 * 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
|
95 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
96 if (ioctl(vdes, BUZIOC_G_PARAMS, &zp) < 0) { |
4259 | 97 mp_msg(MSGT_VO, MSGL_ERR, "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
|
98 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
|
99 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
100 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
101 if (zp.norm != norm && norm != VIDEO_MODE_AUTO) { |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
102 /* attempt to set requested 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
|
103 zp.norm = 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
|
104 if (ioctl(vdes, BUZIOC_S_PARAMS, &zp) < 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
|
105 mp_msg(MSGT_VO, MSGL_ERR, |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
106 "unable to change video norm, use another program to change it (XawTV)\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
|
107 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
|
108 } |
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 ioctl(vdes, BUZIOC_G_PARAMS, &zp); |
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 if (norm != zp.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
|
111 mp_msg(MSGT_VO, MSGL_ERR, |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
112 "unable to change video norm, use another program to change it (XawTV)\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
|
113 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
|
114 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
115 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
116 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
117 if (vdes < 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
|
118 mp_msg(MSGT_VO, MSGL_ERR, "error opening %s\n", |
4259 | 119 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
|
120 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
|
121 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
122 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
123 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
124 if (ioctl(vdes, VIDIOCGCAP, &vc) < 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
|
125 mp_msg(MSGT_VO, MSGL_ERR, "error getting video capabilities from %s\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
|
126 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
|
127 } |
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
|
128 mp_msg(MSGT_VO, MSGL_V, "zr: MJPEG card reports maxwidth=%d, maxheight=%d\n", vc.maxwidth, 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
|
129 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
130 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
|
131 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
132 |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
133 int init_zoran(int zrhdec, int zrvdec) { |
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
|
134 /* 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
|
135 * aspect) and check if it fits */ |
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
|
136 if (image_width > vc.maxwidth) { |
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
|
137 mp_msg(MSGT_VO, MSGL_ERR, "zr: movie to be played is too wide, max width currenty %d\n", 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
|
138 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
|
139 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
140 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
141 if (image_height > vc.maxheight) { |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
142 mp_msg(MSGT_VO, MSGL_ERR, "movie to be played is too high, max height currenty %d\n", vc.maxheight); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
143 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
|
144 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
145 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
146 zp.decimation = 0; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
147 zp.HorDcm = zrhdec; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
148 zp.VerDcm = zrvdec; |
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
|
149 zp.TmpDcm = 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
|
150 zp.field_per_buff = fields; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
151 zp.img_x = (vc.maxwidth - zp.HorDcm*(int)image_width/hdec)/2; |
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
|
152 zp.img_y = (vc.maxheight - zp.VerDcm*(3-fields)*(int)image_height)/4; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
153 zp.img_width = zp.HorDcm*image_width/hdec; |
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
|
154 zp.img_height = zp.VerDcm*image_height/fields; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
155 mp_msg(MSGT_VO, MSGL_V, "zr: geometry (after 'scaling'): %dx%d+%d+%d fields=%d, w=%d, h=%d\n", zp.img_width, (3-fields)*zp.img_height, zp.img_x, zp.img_y, fields, image_width/hdec, 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
|
156 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
157 if (ioctl(vdes, BUZIOC_S_PARAMS, &zp) < 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
|
158 mp_msg(MSGT_VO, MSGL_ERR, "error setting display parameters\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
|
159 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
|
160 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
161 |
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 zrq.count = MJPEG_NBUFFERS; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
163 zrq.size = MJPEG_SIZE; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
164 |
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 if (ioctl(vdes, BUZIOC_REQBUFS, &zrq)) { |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
166 mp_msg(MSGT_VO, MSGL_ERR, "error requesting %d buffers of size %d\n", zrq.count, zrq.size); |
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 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
169 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
170 buf = (char*)mmap(0, zrq.count*zrq.size, PROT_READ|PROT_WRITE, |
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 MAP_SHARED, vdes, 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
|
172 |
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 if (buf == MAP_FAILED) { |
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 mp_msg(MSGT_VO, MSGL_ERR, "error requesting %d buffers of size %d\n", zrq.count, zrq.size); |
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 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
|
176 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
177 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
|
178 } |
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 |
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 void uninit_zoran(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
|
181 if (image) { |
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 free(image); |
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 image=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
|
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 while (queue > synco + 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
|
186 if (ioctl(vdes, BUZIOC_SYNC, &zs) < 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
|
187 mp_msg(MSGT_VO, MSGL_ERR, "error waiting for buffers to become free"); |
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 synco++; |
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 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
190 /* stop streaming */ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
191 frame = -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
|
192 if (ioctl(vdes, BUZIOC_QBUF_PLAY, &frame) < 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
|
193 mp_msg(MSGT_VO, MSGL_ERR, "error stopping playback of last frame"); |
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 close(vdes); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
195 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
196 |
4433 | 197 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, |
198 uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_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
|
199 { |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
200 int j, stretchx, stretchy; |
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
|
201 /* this allows to crop parts from incoming picture, |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
202 * for easy 512x240 -> 352x240 */ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
203 /* These values must be multples of 2 */ |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
204 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
|
205 printf("vo_zr called with wrong format"); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
206 exit(1); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
207 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
208 stride = 2*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
|
209 if (g.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
|
210 if (g.width%2 != 0 || g.height%2 != 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
|
211 g.xoff%2 != 0 || g.yoff%2 != 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
|
212 mp_msg(MSGT_VO, MSGL_ERR, "arguments in -zrcrop must be multiples of 2\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
|
213 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
|
214 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
215 if (g.width <= 0 || g.height <= 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
|
216 g.xoff < 0 || g.yoff < 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
|
217 mp_msg(MSGT_VO, MSGL_ERR, "width and height must be positive and offset nonnegative\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
|
218 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
|
219 } |
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 if (g.width + g.xoff > 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
|
221 mp_msg(MSGT_VO, MSGL_ERR, "width+xoffset (%d+%d>%d) is too big\n", g.width, g.xoff, 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
|
222 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
|
223 } |
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 if (g.height + g.yoff > 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
|
225 mp_msg(MSGT_VO, MSGL_ERR, "height+yoffset (%d+%d>%d) is too big\n", g.height, g.yoff, 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
|
226 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
|
227 } |
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 } 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
|
229 g.width = 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
|
230 g.height = 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
|
231 g.xoff = 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
|
232 g.yoff = 0; |
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
|
233 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
|
234 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
235 /* we must know the maximum resolution of the device |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
236 * it differs for DC10+ and buz for example */ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
237 zoran_getcap(); /*must be called before init_zoran */ |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
238 /* make the scaling decision |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
239 * we are capable of stretching the image in the horizontal |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
240 * direction by factors 1, 2 and 4 |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
241 * we can stretch the image in the vertical direction by a factor |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
242 * of 1 and 2 AND we must decide about interlacing */ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
243 if (g.width > vc.maxwidth/2 || g.height > vc.maxheight/2) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
244 stretchx = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
245 stretchy = 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
|
246 fields = 2; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
247 if (vdec == 2) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
248 fields = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
249 } else if (vdec == 4) { |
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
|
250 fields = 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
251 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
252 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
253 stretchx = hdec; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
254 } else if (g.width > vc.maxwidth/4 || g.height > vc.maxheight/4) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
255 stretchx = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
256 stretchy = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
257 fields = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
258 if (vdec == 2) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
259 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
260 } else if (vdec == 4) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
261 if (!zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
262 mp_msg(MSGT_VO, MSGL_WARN, "vo_zr: vertical decimation too high, changing to 2 (use -zrfd to keep vdec=4)\n"); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
263 vdec = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
264 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
265 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
266 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
267 if (hdec == 2) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
268 stretchx = 4; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
269 } else if (hdec == 4){ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
270 if (!zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
271 mp_msg(MSGT_VO, MSGL_WARN, "vo_zr: horizontal decimation too high, changing to 2 (use -zrfd to keep hdec=4)\n"); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
272 hdec = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
273 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
274 stretchx = 4; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
275 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
276 } else { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
277 /* output image is maximally stretched */ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
278 stretchx = 4; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
279 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
280 fields = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
281 if (vdec != 1 && !zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
282 mp_msg(MSGT_VO, MSGL_WARN, "vo_zr: vertical decimation too high, changing to 1 (use -zrfd to keep vdec=%d)\n", vdec); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
283 vdec = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
284 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
285 |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
286 if (hdec != 1 && !zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
287 mp_msg(MSGT_VO, MSGL_WARN, "vo_zr: vertical decimation too high, changing to 1 (use -zrfd to keep hdec=%d)\n", hdec); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
288 hdec = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
289 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
290 } |
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
|
291 /* It can be that the original frame was too big for display, |
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
|
292 * or that the width of the decimated image (for example) after |
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
|
293 * padding up to a multiple of 16 has become too big. (orig |
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
|
294 * width 720 (exactly right for the Buz) after decimation 360, |
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
|
295 * after padding up to a multiple of 16 368, display 736 -> too |
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
|
296 * large). In these situations we auto(re)crop. */ |
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
|
297 j = 16*((g.width - 1)/(hdec*16) + 1); |
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
|
298 if (stretchx*j > vc.maxwidth) { |
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
|
299 g.xoff += 2*((g.width - hdec*(j-16))/4); |
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
|
300 /* g.off must be a multiple of 2 */ |
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
|
301 g.width = hdec*(j - 16); |
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
|
302 g.set = 0; /* we abuse this field to report that g has changed*/ |
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
|
303 } |
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
|
304 j = 8*fields*((g.height - 1)/(vdec*fields*8) + 1); |
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
|
305 if (stretchy*j > vc.maxheight) { |
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
|
306 g.yoff += 2*((g.height - vdec*(j - 8*fields))/4); |
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
|
307 g.height = vdec*(j - 8*fields); |
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
|
308 g.set = 0; |
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
|
309 } |
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
|
310 if (!g.set) |
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
|
311 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); |
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
|
312 |
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
|
313 /* the height must be a multiple of fields*8 and the 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
|
314 * must be a multiple of 16 */ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
315 /* add some black borders to make it so, and center the image*/ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
316 image_height = fields*8*((g.height/vdec - 1)/(fields*8) + 1); |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
317 image_width = (hdec*16)*((g.width - 1)/(hdec*16) + 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
|
318 off_y = (image_height - g.height/vdec)/2; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
319 if (off_y%2 != 0) off_y++; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
320 off_y *= image_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
|
321 off_c = off_y/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
|
322 off_y += (image_width - g.width)/2; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
323 if (off_y%2 != 0) off_y--; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
324 off_c += (image_width - g.width)/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
|
325 framenum = 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
|
326 size = image_width*image_height; |
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
|
327 mp_msg(MSGT_VO, MSGL_V, "input: %dx%d, cropped: %dx%d, output: %dx%d, off_y=%d, off_c=%d\n", width, height, g.width, g.height, image_width, image_height, off_y, off_c); |
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
|
328 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
329 image = malloc(2*size); /* this buffer allows for YUV422 data, |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
330 * so it is a bit too big for YUV420 */ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
331 if (!image) { |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
332 mp_msg(MSGT_VO, MSGL_ERR, "Memory exhausted\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
|
333 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
|
334 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
335 /* and make sure that the borders are _really_ black */ |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
336 switch (format) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
337 case IMGFMT_YV12: |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
338 memset(image, 0, image_width*image_height); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
339 memset(image + size, 0x80, image_width*image_height/4); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
340 memset(image + 3*size/2, 0x80, image_width*image_height/4); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
341 mjpeg_encoder_init(image_width/hdec, image_height, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
342 image, hdec, image_width, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
343 image + image_width*image_height, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
344 hdec, image_width/2, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
345 image + 3*image_width*image_height/2, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
346 hdec, image_width/2, fields, 1, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
347 quality, bw); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
348 break; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
349 case IMGFMT_YUY2: |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
350 for (j = 0; j < 2*size; j+=4) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
351 image[j] = 0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
352 image[j+1] = 0x80; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
353 image[j+2] = 0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
354 image[j+3] = 0x80; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
355 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
356 mjpeg_encoder_init(image_width/hdec, image_height, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
357 image, hdec*2, image_width*2, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
358 image + 1, hdec*4, image_width*2, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
359 image + 3, hdec*4, image_width*2, |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
360 fields, 0, quality, bw); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
361 break; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
362 default: |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
363 mp_msg(MSGT_VO, MSGL_FATAL, "internal inconsistency in vo_zr\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
|
364 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
365 |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
366 |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
367 if (init_zoran(stretchx, stretchy)) { |
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
|
368 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
|
369 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
370 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
371 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
|
372 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
373 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
374 static const vo_info_t* get_info(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
|
375 return &vo_info; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
376 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
377 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
378 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
|
379 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
380 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
381 static void flip_page (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
|
382 int i, j, k; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
383 /*FILE *fp; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
384 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
|
385 /* do we have a free buffer? */ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
386 if (queue-synco < zrq.count) { |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
387 frame = queue; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
388 } 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
|
389 if (ioctl(vdes, BUZIOC_SYNC, &zs) < 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
|
390 mp_msg(MSGT_VO, MSGL_ERR, "error waiting for buffers to become free"); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
391 frame = zs.frame; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
392 synco++; |
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 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
394 k=0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
395 for (i = 0; i < fields; i++) |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
396 k+=mjpeg_encode_frame(buf+frame*zrq.size+k, i); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
397 /* Warning, Quantization and Huffman tables are only |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
398 * written in the first frame by default (to preserver bandwidth) */ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
399 /*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
|
400 fp = fopen(filename, "w"); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
401 if (!fp) exit(1); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
402 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
|
403 fclose(fp);*/ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
404 /*fp = fopen("test1.jpg", "r"); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
405 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
|
406 fclose(fp);*/ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
407 |
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
|
408 if (ioctl(vdes, BUZIOC_QBUF_PLAY, &frame) < 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
|
409 mp_msg(MSGT_VO, MSGL_ERR, |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
410 "error queueing buffer for playback"); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
411 queue++; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
412 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
413 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
|
414 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
|
415 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
416 |
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 static uint32_t draw_frame(uint8_t * src[]) { |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
418 int i; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
419 char *source, *dest; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
420 //printf("draw frame called\n"); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
421 source = src[0] + 2*g.yoff*image_width + 2*g.xoff; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
422 dest = image + 2*off_y; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
423 for (i = 0; i < g.height/vdec; i++) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
424 memcpy(dest, source, image_width*2); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
425 dest += 2*image_width; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
426 source += vdec*stride; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
427 } |
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
|
428 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
|
429 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
430 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
431 static uint32_t query_format(uint32_t format) { |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
432 if(format==IMGFMT_YV12) return 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
433 if(format==IMGFMT_YUY2) 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
|
434 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
|
435 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
436 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
437 static void uninit(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
|
438 uninit_zoran(); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
439 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
440 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
441 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
|
442 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
443 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
444 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
445 static uint32_t draw_slice(uint8_t *srcimg[], int stride[], |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
446 int w, int h, int x, int y) { |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
447 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
|
448 /* 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
|
449 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
|
450 uint8_t *src; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
451 //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]); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
452 if (x < g.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
|
453 srcimg[0] += g.xoff - x; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
454 srcimg[1] += (g.xoff - x)/2; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
455 srcimg[2] += (g.xoff - x)/2; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
456 w -= g.xoff - x; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
457 if (w < 0) 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
|
458 x = 0 /*g.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
|
459 } 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
|
460 x -= g.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
|
461 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
462 if (x + w > g.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
|
463 w = g.width - x; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
464 if (w < 0) 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
|
465 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
466 if (y < g.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
|
467 srcimg[0] += (g.yoff - y)*stride[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
|
468 srcimg[1] += ((g.yoff - y)/2)*stride[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
|
469 srcimg[2] += ((g.yoff - y)/2)*stride[2]; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
470 h -= g.yoff - y; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
471 if (h < 0) 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
|
472 y = 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
|
473 } 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
|
474 y -= g.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
|
475 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
476 if (y + h > g.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
|
477 h = g.height - y; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
478 if (h < 0) 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
|
479 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
480 //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]); |
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 dst=image + off_y + image_width*(y/vdec)+x; |
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 src=srcimg[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
|
483 // copy Y: |
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 for (i = 0; i < h; 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
|
485 if ((i + x)%vdec == 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
|
486 memcpy(dst,src,w); |
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 dst+=image_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
|
488 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
489 src+=stride[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
|
490 |
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 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
492 if (!bw) { |
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
|
493 // copy U+V: |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
494 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
|
495 uint8_t *src2=srcimg[2]; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
496 uint8_t *dst1=image + size + off_c+ (y/(vdec*2))*image_width/2+(x/2); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
497 uint8_t *dst2=image + 3*size/2 + off_c + |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
498 (y/(vdec*2))*image_width/2+(x/2); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
499 for (i = 0; i< h/2; 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
|
500 if ((i+x/2)%vdec == 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
|
501 memcpy(dst1,src1,w/2); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
502 memcpy(dst2,src2,w/2); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
503 dst1+=image_width/2; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
504 dst2+=image_width/2; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
505 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
506 src1+=stride[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
|
507 src2+=stride[2]; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
508 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
509 } |
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 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
|
511 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
512 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
513 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
514 /* 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
|
515 int |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
516 vo_zr_parseoption(struct config * conf, char *opt, char *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
|
517 /* got an option starting with 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
|
518 char *x, *help; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
519 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
|
520 /* 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
|
521 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
|
522 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
|
523 //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
|
524 //aaopt_osdcolor=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
|
525 device = malloc(strlen(param)+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
|
526 strcpy(device, 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
|
527 mp_msg(MSGT_VO, MSGL_V, "zr: using device %s\n", device); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
528 return 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
529 } 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
|
530 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
|
531 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
|
532 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
533 bw = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
534 return 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
535 } else if (!strcasecmp(opt, "zrfd")) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
536 if (param != NULL) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
537 return ERR_OUT_OF_RANGE; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
538 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
539 zrfd = 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
|
540 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
|
541 } else if (!strcasecmp(opt, "zrcrop")){ |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
542 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
|
543 if (sscanf(param, "%dx%d+%d+%d", &g.width, &g.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
|
544 &g.xoff, &g.yoff) != 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
|
545 g.xoff = 0; g.yoff = 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
|
546 if (sscanf(param, "%dx%d", &g.width, &g.height) != 2) { |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
547 mp_msg(MSGT_VO, MSGL_ERR, "argument to -zrcrop must be of the form 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
|
548 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
|
549 } |
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 g.set = 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
|
552 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
|
553 return 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
554 }else if (!strcasecmp(opt, "zrhdec")) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
555 i = atoi(param); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
556 if (i != 1 && i != 2 && i != 4) return ERR_OUT_OF_RANGE; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
557 hdec = i; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
558 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
|
559 }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
|
560 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
|
561 if (i != 1 && i != 2 && i != 4) 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
|
562 vdec = 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
|
563 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
|
564 }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
|
565 i = atoi(param); |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
566 if (i < 1 || i > 20) return ERR_OUT_OF_RANGE; |
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
|
567 quality = 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
|
568 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
|
569 }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
|
570 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
|
571 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
|
572 mp_msg(MSGT_VO, MSGL_V, "zr: Norm set to NTSC\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
|
573 norm = VIDEO_MODE_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
|
574 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
|
575 } 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
|
576 mp_msg(MSGT_VO, MSGL_V, "zr: Norm set to PAL\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
|
577 norm = VIDEO_MODE_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
|
578 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
|
579 } 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
|
580 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
|
581 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
582 }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
|
583 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
|
584 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
|
585 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
|
586 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
|
587 "\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
|
588 " -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
|
589 " 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
|
590 " 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
|
591 " -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
|
592 " -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
|
593 " -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
|
594 " 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
|
595 " 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
|
596 " of too much decimation\n" |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
597 " -zrbw display in black&white (speed increase)\n" |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
598 " -zrquality jpeg compression quality [BEST] 1 - 20 [VERY BAD]\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
|
599 " -zrdev playback device (example -zrdev /dev/video1\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
|
600 " -zrnorm specify norm PAL/NTSC [dev: leave at current setting]\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
|
601 "\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
|
602 ); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
603 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
|
604 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
605 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
606 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
|
607 } |
4259 | 608 |
609 void vo_zr_revertoption(config_t* opt,char* param) { | |
610 | |
611 if (!strcasecmp(param, "zrdev")) { | |
612 if(device) | |
613 free(device); | |
614 device=NULL; | |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
615 } else if (!strcasecmp(param, "zrbw")) |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
616 bw=0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
617 else if (!strcasecmp(param, "zrfd")) |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
618 zrfd=0; |
4259 | 619 else if (!strcasecmp(param, "zrcrop")) |
620 g.set = g.xoff = g.yoff = 0; | |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
621 else if (!strcasecmp(param, "zrhdec")) |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
622 hdec = 1; |
4259 | 623 else if (!strcasecmp(param, "zrvdec")) |
624 vdec = 1; | |
625 else if (!strcasecmp(param, "zrquality")) | |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
626 quality = 1; |
4259 | 627 else if (!strcasecmp(param, "zrnorm")) |
628 norm = VIDEO_MODE_AUTO; | |
629 | |
630 } | |
4352 | 631 |
632 static uint32_t preinit(const char *arg) | |
633 { | |
634 return 0; | |
635 } | |
636 | |
637 static void query_vaa(vo_vaa_t *vaa) | |
638 { | |
639 memset(vaa,0,sizeof(vo_vaa_t)); | |
640 } |