Mercurial > mplayer.hg
annotate libvo/vo_zr.c @ 4725:534ef9323eca
MMX part rewritten and 16 tap filter added for better sound qualty
author | anders |
---|---|
date | Sat, 16 Feb 2002 13:08:14 +0000 |
parents | d20978449650 |
children | 32e1f5042f65 |
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> |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
18 #include "videodev_mjpeg.h" |
4214
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
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 |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
28 #include "jpeg_enc.h" |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
29 |
4214
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
30 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
|
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 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
|
33 { |
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 "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
|
35 "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
|
36 "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
|
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 }; |
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 /* 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
|
41 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
42 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
|
43 static int image_height; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
44 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
|
45 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
|
46 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
|
47 static int zrfd = 0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
48 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
|
49 static int vdec = 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
50 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
|
51 static int size; |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
52 static int quality = 2; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
53 static unsigned char *y_data, *u_data, *v_data; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
54 static int y_stride, u_stride, v_stride; |
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
|
55 |
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 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 } 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
|
63 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
|
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 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
|
66 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
|
67 |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
68 static jpeg_enc_t *j; |
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
|
69 |
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 /* 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
|
71 |
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 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
|
73 int frame = 0, synco = 0, queue = 0; /* buffer management */ |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
74 struct mjpeg_params zp; |
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
75 struct mjpeg_requestbuffers zrq; |
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
76 struct mjpeg_sync zs; |
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
|
77 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
|
78 #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
|
79 #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
|
80 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
81 //should be command line options |
4259 | 82 int norm = VIDEO_MODE_AUTO; |
83 #ifndef VO_ZR_DEFAULT_DEVICE | |
84 #define VO_ZR_DEFAULT_DEVICE "/dev/video" | |
85 #endif | |
86 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
|
87 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
88 int zoran_getcap() { |
4259 | 89 char* dev = device ? device : VO_ZR_DEFAULT_DEVICE; |
90 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
|
91 /* 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
|
92 * 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
|
93 |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
94 if (ioctl(vdes, MJPIOC_G_PARAMS, &zp) < 0) { |
4259 | 95 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
|
96 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
|
97 } |
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 |
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 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
|
100 /* 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
|
101 zp.norm = norm; |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
102 if (ioctl(vdes, MJPIOC_S_PARAMS, &zp) < 0) { |
4214
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
103 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
|
104 "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
|
105 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
|
106 } |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
107 ioctl(vdes, MJPIOC_G_PARAMS, &zp); |
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
|
108 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
|
109 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
|
110 "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
|
111 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
|
112 } |
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 } |
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 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
|
116 mp_msg(MSGT_VO, MSGL_ERR, "error opening %s\n", |
4259 | 117 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
|
118 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
|
119 } |
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 |
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 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
|
123 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
|
124 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
|
125 } |
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
|
126 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
|
127 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
128 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
|
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 |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
131 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
|
132 /* 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
|
133 * 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
|
134 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
|
135 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
|
136 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
|
137 } |
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 |
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 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
|
140 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
|
141 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
|
142 } |
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 |
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 zp.decimation = 0; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
145 zp.HorDcm = zrhdec; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
146 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
|
147 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
|
148 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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 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
|
154 |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
155 if (ioctl(vdes, MJPIOC_S_PARAMS, &zp) < 0) { |
4214
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
156 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
|
157 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
|
158 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
159 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
160 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
|
161 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
|
162 |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
163 if (ioctl(vdes, MJPIOC_REQBUFS, &zrq)) { |
4214
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
164 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
|
165 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
|
166 } |
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 |
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 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
|
169 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
|
170 |
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 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
|
172 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
|
173 return 1; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
174 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
175 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
|
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 |
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 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
|
179 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
|
180 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
|
181 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
|
182 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
183 while (queue > synco + 1) { |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
184 if (ioctl(vdes, MJPIOC_SYNC, &zs) < 0) |
4214
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
185 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
|
186 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
|
187 } |
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 /* 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
|
189 frame = -1; |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
190 if (ioctl(vdes, MJPIOC_QBUF_PLAY, &frame) < 0) |
4214
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
191 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
|
192 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
|
193 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
194 |
4433 | 195 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, |
196 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
|
197 { |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
198 int i, 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
|
199 /* 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
|
200 * 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
|
201 /* 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
|
202 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
|
203 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
|
204 exit(1); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
205 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
206 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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 } |
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 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
|
214 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
|
215 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
|
216 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
|
217 } |
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 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
|
219 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
|
220 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
|
221 } |
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 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
|
223 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
|
224 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
|
225 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
226 } 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
|
227 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
|
228 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
|
229 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
|
230 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
|
231 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
|
232 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
233 /* 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
|
234 * 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
|
235 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
|
236 /* make the scaling decision |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
237 * 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
|
238 * 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
|
239 * 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
|
240 * 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
|
241 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
|
242 stretchx = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
243 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
|
244 fields = 2; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
245 if (vdec == 2) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
246 fields = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
247 } 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
|
248 fields = 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
249 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
250 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
251 stretchx = hdec; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
252 } 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
|
253 stretchx = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
254 stretchy = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
255 fields = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
256 if (vdec == 2) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
257 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
258 } else if (vdec == 4) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
259 if (!zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
260 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
|
261 vdec = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
262 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
263 stretchy = 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 if (hdec == 2) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
266 stretchx = 4; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
267 } else if (hdec == 4){ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
268 if (!zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
269 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
|
270 hdec = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
271 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
272 stretchx = 4; |
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 } else { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
275 /* output image is maximally stretched */ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
276 stretchx = 4; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
277 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
278 fields = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
279 if (vdec != 1 && !zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
280 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
|
281 vdec = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
282 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
283 |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
284 if (hdec != 1 && !zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
285 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
|
286 hdec = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
287 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
288 } |
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
|
289 /* 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
|
290 * 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
|
291 * 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
|
292 * 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
|
293 * 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
|
294 * large). In these situations we auto(re)crop. */ |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
295 i = 16*((g.width - 1)/(hdec*16) + 1); |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
296 if (stretchx*i > vc.maxwidth) { |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
297 g.xoff += 2*((g.width - hdec*(i-16))/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
|
298 /* g.off must be a multiple of 2 */ |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
299 g.width = hdec*(i - 16); |
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
|
300 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
|
301 } |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
302 i = 8*fields*((g.height - 1)/(vdec*fields*8) + 1); |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
303 if (stretchy*i > vc.maxheight) { |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
304 g.yoff += 2*((g.height - vdec*(i - 8*fields))/4); |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
305 g.height = vdec*(i - 8*fields); |
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
|
306 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
|
307 } |
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 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
|
309 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
|
310 |
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
|
311 /* 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
|
312 * 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
|
313 /* 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
|
314 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
|
315 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
|
316 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
|
317 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
|
318 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
|
319 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 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
|
325 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
|
326 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
327 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
|
328 * 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
|
329 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
|
330 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
|
331 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
|
332 } |
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 /* 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
|
334 switch (format) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
335 case IMGFMT_YV12: |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
336 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
|
337 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
|
338 memset(image + 3*size/2, 0x80, image_width*image_height/4); |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
339 y_data = image; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
340 u_data = image + image_width*image_height; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
341 v_data = image + 3*image_width*image_height/2; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
342 |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
343 y_stride = image_width; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
344 u_stride = image_width/2; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
345 v_stride = image_width/2; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
346 |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
347 j = jpeg_enc_init(image_width/hdec, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
348 image_height/fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
349 hdec, y_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
350 hdec, u_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
351 hdec, v_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
352 1, quality, bw); |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
353 break; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
354 case IMGFMT_YUY2: |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
355 for (i = 0; i < 2*size; i+=4) { |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
356 image[i] = 0; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
357 image[i+1] = 0x80; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
358 image[i+2] = 0; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
359 image[i+3] = 0x80; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
360 } |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
361 |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
362 y_data = image; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
363 u_data = image + 1; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
364 v_data = image + 3; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
365 |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
366 y_stride = 2*image_width; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
367 u_stride = 2*image_width; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
368 v_stride = 2*image_width; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
369 |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
370 j = jpeg_enc_init(image_width/hdec, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
371 image_height/fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
372 hdec*2, y_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
373 hdec*4, u_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
374 hdec*4, v_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
375 0, quality, bw); |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
376 break; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
377 default: |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
378 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
|
379 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
380 |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
381 |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
382 if (j == NULL) { |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
383 mp_msg(MSGT_VO, MSGL_ERR, "Error initializing the jpeg encoder\n"); |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
384 return 1; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
385 } |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
386 |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
387 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
|
388 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
|
389 } |
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 |
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 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
|
392 } |
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 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
394 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
|
395 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
|
396 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
397 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
398 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
|
399 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
400 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
401 static void flip_page (void) { |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
402 int i, k; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
403 //FILE *fp; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
404 //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
|
405 /* 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
|
406 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
|
407 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
|
408 } else { |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
409 if (ioctl(vdes, MJPIOC_SYNC, &zs) < 0) |
4214
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
410 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
|
411 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
|
412 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
|
413 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
414 k=0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
415 for (i = 0; i < fields; i++) |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
416 k+=jpeg_enc_frame(j, y_data + i*y_stride, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
417 u_data + i*u_stride, v_data + i*v_stride, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
418 buf+frame*zrq.size+k); |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
419 /* Warning: Only the first jpeg image contains huffman- and |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
420 * quantisation tables, so don't expect files other than |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
421 * test0001.jpg to be readable */ |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
422 /*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
|
423 fp = fopen(filename, "w"); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
424 if (!fp) exit(1); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
425 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
|
426 fclose(fp);*/ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
427 /*fp = fopen("test1.jpg", "r"); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
428 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
|
429 fclose(fp);*/ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
430 |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
431 if (ioctl(vdes, MJPIOC_QBUF_PLAY, &frame) < 0) |
4214
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
432 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
|
433 "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
|
434 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
|
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 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
|
437 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
|
438 } |
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 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
|
441 int i; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
442 char *source, *dest; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
443 //printf("draw frame called\n"); |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
444 source = src[0] + 2*g.yoff*vdec*stride + 2*g.xoff; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
445 dest = image + 2*off_y; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
446 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
|
447 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
|
448 dest += 2*image_width; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
449 source += vdec*stride; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
450 } |
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
|
451 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
|
452 } |
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 |
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 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
|
455 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
|
456 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
|
457 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 } |
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 |
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 static void uninit(void) { |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
461 jpeg_enc_uninit(j); |
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
|
462 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
|
463 } |
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 |
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 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
|
466 } |
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 |
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 |
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 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
|
470 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
|
471 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
|
472 /* 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
|
473 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
|
474 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
|
475 //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
|
476 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
|
477 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
|
478 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
|
479 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
|
480 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
|
481 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
|
482 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
|
483 } 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
|
484 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
|
485 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
486 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
|
487 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
|
488 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
|
489 } |
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 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
|
491 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
|
492 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
|
493 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
|
494 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
|
495 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
|
496 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
|
497 } 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
|
498 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
|
499 } |
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 (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
|
501 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
|
502 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
|
503 } |
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 //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
|
505 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
|
506 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
|
507 // 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
|
508 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
|
509 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
|
510 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
|
511 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
|
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 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
|
514 |
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 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
516 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
|
517 // 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
|
518 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
|
519 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
|
520 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
|
521 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
|
522 (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
|
523 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
|
524 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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
530 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
|
531 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
|
532 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
533 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
534 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
|
535 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
536 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
537 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
538 /* 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
|
539 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
|
540 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
|
541 /* 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
|
542 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
|
543 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
|
544 /* 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
|
545 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
|
546 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
|
547 //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
|
548 //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
|
549 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
|
550 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
|
551 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
|
552 return 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
553 } 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
|
554 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
|
555 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
|
556 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
557 bw = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
558 return 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
559 } else if (!strcasecmp(opt, "zrfd")) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
560 if (param != NULL) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
561 return ERR_OUT_OF_RANGE; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
562 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
563 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
|
564 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
|
565 } 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
|
566 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
|
567 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
|
568 &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
|
569 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
|
570 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
|
571 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
|
572 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
|
573 } |
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 } |
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 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
|
576 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
|
577 return 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
578 }else if (!strcasecmp(opt, "zrhdec")) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
579 i = atoi(param); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
580 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
|
581 hdec = i; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
582 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
|
583 }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
|
584 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
|
585 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
|
586 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
|
587 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
|
588 }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
|
589 i = atoi(param); |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
590 if (i < 2 || 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
|
591 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
|
592 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
|
593 }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
|
594 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
|
595 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
|
596 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
|
597 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
|
598 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
|
599 } 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
|
600 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
|
601 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
|
602 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
|
603 } 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
|
604 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
|
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 }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
|
607 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
|
608 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
|
609 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
|
610 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
|
611 "\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
|
612 " -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
|
613 " 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
|
614 " 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
|
615 " -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
|
616 " -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
|
617 " -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
|
618 " 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
|
619 " 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
|
620 " of too much decimation\n" |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
621 " -zrbw display in black&white (speed increase)\n" |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
622 " -zrquality jpeg compression quality [BEST] 2 - 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
|
623 " -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
|
624 " -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
|
625 "\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
|
626 ); |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
627 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
|
628 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
629 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
630 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
|
631 } |
4259 | 632 |
633 void vo_zr_revertoption(config_t* opt,char* param) { | |
634 | |
635 if (!strcasecmp(param, "zrdev")) { | |
636 if(device) | |
637 free(device); | |
638 device=NULL; | |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
639 } else if (!strcasecmp(param, "zrbw")) |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
640 bw=0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
641 else if (!strcasecmp(param, "zrfd")) |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
642 zrfd=0; |
4259 | 643 else if (!strcasecmp(param, "zrcrop")) |
644 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
|
645 else if (!strcasecmp(param, "zrhdec")) |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
646 hdec = 1; |
4259 | 647 else if (!strcasecmp(param, "zrvdec")) |
648 vdec = 1; | |
649 else if (!strcasecmp(param, "zrquality")) | |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
650 quality = 2; |
4259 | 651 else if (!strcasecmp(param, "zrnorm")) |
652 norm = VIDEO_MODE_AUTO; | |
653 | |
654 } | |
4352 | 655 |
656 static uint32_t preinit(const char *arg) | |
657 { | |
658 return 0; | |
659 } | |
660 | |
4596 | 661 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 662 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
663 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
664 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
665 return query_format(*((uint32_t*)data)); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
666 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
667 return VO_NOTIMPL; |
4352 | 668 } |