Mercurial > mplayer.hg
annotate libvo/vo_zr.c @ 4737:32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
author | nick |
---|---|
date | Sun, 17 Feb 2002 08:24:43 +0000 |
parents | d20978449650 |
children | 685df37d2c80 |
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> |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4668
diff
changeset
|
11 #include <errno.h> |
4214
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
12 #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
|
13 #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
|
14 #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
|
15 #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
|
16 #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
|
17 #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
|
18 #include <linux/videodev.h> |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
19 #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
|
20 |
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 #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
|
22 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
23 #include "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
|
24 #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
|
25 #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
|
26 #include "../cfgparser.h" |
4232 | 27 #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
|
28 |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
29 #include "jpeg_enc.h" |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
30 |
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
|
31 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
|
32 |
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 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
|
34 { |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
35 "Zoran ZR360[56]7/ZR36060 Driver (DC10(+)/buz/lml33/MatroxRR)", |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
36 "zr", |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
37 "Rik Snel <snel@phys.uu.nl>", |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
38 "" |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
39 }; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
40 |
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 /* 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
|
42 |
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_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
|
44 static int image_height; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
45 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
|
46 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
|
47 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
|
48 static int zrfd = 0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
49 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
|
50 static int vdec = 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
51 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
|
52 static int size; |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
53 static int quality = 2; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
54 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
|
55 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
|
56 |
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 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 } 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
|
64 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
|
65 |
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 *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
|
67 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
|
68 |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
69 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
|
70 |
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 /* 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
|
72 |
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 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
|
74 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
|
75 struct mjpeg_params zp; |
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
76 struct mjpeg_requestbuffers zrq; |
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
77 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
|
78 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
|
79 #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
|
80 #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
|
81 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
82 //should be command line options |
4259 | 83 int norm = VIDEO_MODE_AUTO; |
84 #ifndef VO_ZR_DEFAULT_DEVICE | |
85 #define VO_ZR_DEFAULT_DEVICE "/dev/video" | |
86 #endif | |
87 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
|
88 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
89 int zoran_getcap() { |
4259 | 90 char* dev = device ? device : VO_ZR_DEFAULT_DEVICE; |
91 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
|
92 /* 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
|
93 * 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
|
94 |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
95 if (ioctl(vdes, MJPIOC_G_PARAMS, &zp) < 0) { |
4259 | 96 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
|
97 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
|
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 |
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 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
|
101 /* 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
|
102 zp.norm = norm; |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
103 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
|
104 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
|
105 "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
|
106 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
|
107 } |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
108 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
|
109 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
|
110 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
|
111 "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
|
112 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
|
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 |
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 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
|
117 mp_msg(MSGT_VO, MSGL_ERR, "error opening %s\n", |
4259 | 118 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
|
119 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
|
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 |
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 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
|
124 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
|
125 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
|
126 } |
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
|
127 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
|
128 |
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 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
|
130 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
131 |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
132 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
|
133 /* 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
|
134 * 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
|
135 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
|
136 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
|
137 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
|
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 |
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 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
|
141 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
|
142 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
|
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 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
145 zp.decimation = 0; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
146 zp.HorDcm = zrhdec; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
147 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
|
148 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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 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
|
154 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
|
155 |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
156 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
|
157 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
|
158 return 1; |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
159 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
160 |
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.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
|
162 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
|
163 |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
164 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
|
165 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
|
166 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
|
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 |
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 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
|
170 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
|
171 |
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 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
|
173 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
|
174 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
|
175 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
176 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
|
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 |
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 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
|
180 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
|
181 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
|
182 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
|
183 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
184 while (queue > synco + 1) { |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
185 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
|
186 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
|
187 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
|
188 } |
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 /* 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
|
190 frame = -1; |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
191 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
|
192 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
|
193 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
|
194 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
195 |
4433 | 196 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, |
197 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
|
198 { |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
199 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
|
200 /* 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
|
201 * 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
|
202 /* 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
|
203 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
|
204 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
|
205 exit(1); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
206 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 } |
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 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
|
215 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
|
216 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
|
217 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
|
218 } |
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 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
|
220 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
|
221 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
|
222 } |
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 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
|
224 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
|
225 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
|
226 } |
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 } 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
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 } |
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 /* 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
|
235 * 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
|
236 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
|
237 /* make the scaling decision |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
238 * 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
|
239 * 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
|
240 * 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
|
241 * 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
|
242 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
|
243 stretchx = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
244 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
|
245 fields = 2; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
246 if (vdec == 2) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
247 fields = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
248 } 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
|
249 fields = 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
250 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
251 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
252 stretchx = hdec; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
253 } 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
|
254 stretchx = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
255 stretchy = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
256 fields = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
257 if (vdec == 2) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
258 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
259 } else if (vdec == 4) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
260 if (!zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
261 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
|
262 vdec = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
263 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
264 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
265 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
266 if (hdec == 2) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
267 stretchx = 4; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
268 } else if (hdec == 4){ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
269 if (!zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
270 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
|
271 hdec = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
272 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
273 stretchx = 4; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
274 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
275 } else { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
276 /* output image is maximally stretched */ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
277 stretchx = 4; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
278 stretchy = 2; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
279 fields = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
280 if (vdec != 1 && !zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
281 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
|
282 vdec = 1; |
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 |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
285 if (hdec != 1 && !zrfd) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
286 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
|
287 hdec = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
288 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
289 } |
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
|
290 /* 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
|
291 * 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
|
292 * 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
|
293 * 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
|
294 * 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
|
295 * 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
|
296 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
|
297 if (stretchx*i > vc.maxwidth) { |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
298 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
|
299 /* 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
|
300 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
|
301 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
|
302 } |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
303 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
|
304 if (stretchy*i > vc.maxheight) { |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
305 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
|
306 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
|
307 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
|
308 } |
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 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
|
310 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
|
311 |
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
|
312 /* 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
|
313 * 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
|
314 /* 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
|
315 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
|
316 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
|
317 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
|
318 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
|
319 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 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
|
325 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
|
326 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
|
327 |
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 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
|
329 * 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
|
330 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
|
331 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
|
332 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
|
333 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
334 /* 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
|
335 switch (format) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
336 case IMGFMT_YV12: |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
337 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
|
338 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
|
339 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
|
340 y_data = image; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
341 u_data = image + image_width*image_height; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
342 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
|
343 |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
344 y_stride = image_width; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
345 u_stride = image_width/2; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
346 v_stride = image_width/2; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
347 |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
348 j = jpeg_enc_init(image_width/hdec, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
349 image_height/fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
350 hdec, y_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
351 hdec, u_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
352 hdec, v_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
353 1, quality, bw); |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
354 break; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
355 case IMGFMT_YUY2: |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
356 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
|
357 image[i] = 0; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
358 image[i+1] = 0x80; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
359 image[i+2] = 0; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
360 image[i+3] = 0x80; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
361 } |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
362 |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
363 y_data = image; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
364 u_data = image + 1; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
365 v_data = image + 3; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
366 |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
367 y_stride = 2*image_width; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
368 u_stride = 2*image_width; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
369 v_stride = 2*image_width; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
370 |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
371 j = jpeg_enc_init(image_width/hdec, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
372 image_height/fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
373 hdec*2, y_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
374 hdec*4, u_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
375 hdec*4, v_stride*fields, |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
376 0, quality, bw); |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
377 break; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
378 default: |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
379 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
|
380 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
381 |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
382 |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
383 if (j == NULL) { |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
384 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
|
385 return 1; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
386 } |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
387 |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
388 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
|
389 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
|
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 |
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 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
|
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 |
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 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
|
396 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
|
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 |
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 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
|
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 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
402 static void flip_page (void) { |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
403 int i, k; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
404 //FILE *fp; |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
405 //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
|
406 /* 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
|
407 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
|
408 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
|
409 } else { |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
410 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
|
411 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
|
412 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
|
413 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
|
414 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
415 k=0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
416 for (i = 0; i < fields; i++) |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
417 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
|
418 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
|
419 buf+frame*zrq.size+k); |
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
420 /* 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
|
421 * 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
|
422 * 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
|
423 /*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
|
424 fp = fopen(filename, "w"); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
425 if (!fp) exit(1); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
426 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
|
427 fclose(fp);*/ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
428 /*fp = fopen("test1.jpg", "r"); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
429 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
|
430 fclose(fp);*/ |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
431 |
4668
d20978449650
migration of -vo zr to Recommended Interface definition (this obsoletes zoran.h)
rik
parents:
4651
diff
changeset
|
432 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
|
433 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
|
434 "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
|
435 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
|
436 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
437 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
|
438 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
|
439 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
440 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
441 static 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
|
442 int i; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
443 char *source, *dest; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
444 //printf("draw frame called\n"); |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
445 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
|
446 dest = image + 2*off_y; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
447 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
|
448 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
|
449 dest += 2*image_width; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
450 source += vdec*stride; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
451 } |
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
|
452 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
|
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 |
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 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
|
456 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
|
457 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
|
458 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
|
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 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
461 static void uninit(void) { |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
462 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
|
463 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
|
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 |
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 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
|
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 |
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 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
|
471 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
|
472 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
|
473 /* 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
|
474 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
|
475 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
|
476 //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
|
477 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
|
478 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
|
479 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
|
480 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
|
481 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
|
482 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
|
483 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
|
484 } 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
|
485 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
|
486 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
487 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
|
488 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
|
489 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
|
490 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
491 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
|
492 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
|
493 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
|
494 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
|
495 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
|
496 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
|
497 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
|
498 } 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
|
499 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
|
500 } |
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 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
|
502 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
|
503 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
|
504 } |
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 //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
|
506 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
|
507 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
|
508 // 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
|
509 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
|
510 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
|
511 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
|
512 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
|
513 } |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
514 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
|
515 |
664984198aef
zr driver (tv-out for DC10/DC10+, iomega buz, LML33...) added - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
diff
changeset
|
516 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
517 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
|
518 // 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
|
519 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
|
520 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
|
521 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
|
522 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
|
523 (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
|
524 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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 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
|
530 } |
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 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
|
532 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
|
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 } |
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 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
|
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 |
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 /* 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
|
540 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
|
541 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
|
542 /* 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
|
543 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
|
544 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
|
545 /* 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
|
546 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
|
547 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
|
548 //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
|
549 //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
|
550 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
|
551 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
|
552 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
|
553 return 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
554 } else if (!strcasecmp(opt, "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
|
555 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
|
556 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
|
557 } |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
558 bw = 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
559 return 1; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
560 } else if (!strcasecmp(opt, "zrfd")) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
561 if (param != NULL) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
562 return ERR_OUT_OF_RANGE; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
563 } |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
564 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
|
565 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
|
566 } 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
|
567 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
|
568 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
|
569 &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
|
570 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
|
571 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
|
572 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
|
573 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
|
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 } |
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 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
|
577 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
|
578 return 1; |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
579 }else if (!strcasecmp(opt, "zrhdec")) { |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
580 i = atoi(param); |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
581 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
|
582 hdec = i; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
583 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
|
584 }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
|
585 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
|
586 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
|
587 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
|
588 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
|
589 }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
|
590 i = atoi(param); |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
591 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
|
592 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
|
593 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
|
594 }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
|
595 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
|
596 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
|
597 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
|
598 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
|
599 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
|
600 } 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
|
601 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
|
602 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
|
603 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
|
604 } 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
|
605 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
|
606 } |
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 }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
|
608 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
|
609 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
|
610 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
|
611 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
|
612 "\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 " -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
|
614 " 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
|
615 " 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
|
616 " -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
|
617 " -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
|
618 " -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
|
619 " 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
|
620 " 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
|
621 " of too much decimation\n" |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
622 " -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
|
623 " -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
|
624 " -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
|
625 " -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
|
626 "\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
|
627 ); |
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 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
|
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 } |
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 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
|
632 } |
4259 | 633 |
634 void vo_zr_revertoption(config_t* opt,char* param) { | |
635 | |
636 if (!strcasecmp(param, "zrdev")) { | |
637 if(device) | |
638 free(device); | |
639 device=NULL; | |
4348
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
640 } else if (!strcasecmp(param, "zrbw")) |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
641 bw=0; |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
642 else if (!strcasecmp(param, "zrfd")) |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
643 zrfd=0; |
4259 | 644 else if (!strcasecmp(param, "zrcrop")) |
645 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
|
646 else if (!strcasecmp(param, "zrhdec")) |
d4acef803c94
use the new jpeg encoder - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4259
diff
changeset
|
647 hdec = 1; |
4259 | 648 else if (!strcasecmp(param, "zrvdec")) |
649 vdec = 1; | |
650 else if (!strcasecmp(param, "zrquality")) | |
4651
49f2bc22f880
mjpeg encoder cleanup - patch by Rik Snel <rsnel@cube.dyndns.org>
arpi
parents:
4596
diff
changeset
|
651 quality = 2; |
4259 | 652 else if (!strcasecmp(param, "zrnorm")) |
653 norm = VIDEO_MODE_AUTO; | |
654 | |
655 } | |
4352 | 656 |
657 static uint32_t preinit(const char *arg) | |
658 { | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4668
diff
changeset
|
659 if(arg) |
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4668
diff
changeset
|
660 { |
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4668
diff
changeset
|
661 printf("vo_zr: Unknown subdevice: %s\n",arg); |
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4668
diff
changeset
|
662 return ENOSYS; |
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4668
diff
changeset
|
663 } |
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4668
diff
changeset
|
664 return 0; |
4352 | 665 } |
666 | |
4596 | 667 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 668 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
669 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
670 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
671 return query_format(*((uint32_t*)data)); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
672 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
673 return VO_NOTIMPL; |
4352 | 674 } |