Mercurial > mplayer.hg
annotate libvo/vo_zr2.c @ 33259:04dc3e55cd90
Increase the maximum value of the DVB timeout to 240 seconds.
Some devices may need more time for the initial tune (e.g. firmware loading).
Let the user specify higher timeout value if there is need to.
The default remains 30 seconds.
author | iive |
---|---|
date | Sun, 01 May 2011 18:07:59 +0000 |
parents | 1772a5171ac7 |
children | ddb45e9443ec |
rev | line source |
---|---|
27509
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
1 /* |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
2 * playback on Zoran cards, based on vo_zr.c |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
3 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
4 * copyright (C) 2001-2005 Rik Snel |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
5 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
6 * This file is part of MPlayer. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
7 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
11 * (at your option) any later version. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
12 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
16 * GNU General Public License for more details. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
17 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
26203
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
21 */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
22 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
23 /* $Id$ */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
24 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
25 #include <stdio.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
26 #include <stdlib.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
27 #include <string.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
28 #include <unistd.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
29 #include <fcntl.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
30 #include <errno.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
31 #include <sys/stat.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
32 #include <sys/types.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
33 #include <sys/time.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
34 #include <sys/mman.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
35 #include <sys/ioctl.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
36 #include <linux/types.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
37 #include <linux/videodev.h> |
26203 | 38 #include "config.h" |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
39 #include "videodev_mjpeg.h" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
40 #include "video_out.h" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
41 #include "video_out_internal.h" |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
11660
diff
changeset
|
42 #include "mp_msg.h" |
14428 | 43 #include "subopt-helper.h" |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
44 #include "fastmemcpy.h" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
45 |
25216 | 46 static const vo_info_t info = { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
47 "Zoran ZR360[56]7/ZR36060 Driver (DC10(+)/buz/lml33/MatroxRR)", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
48 "zr2", |
14429
90b4a1345b96
replace almost obsolete email address: snel@phys.uu.nl -> rsnel@cube.dyndns.org
rik
parents:
14428
diff
changeset
|
49 "Rik Snel <rsnel@cube.dyndns.org>", |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
50 "" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
51 }; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
52 |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
53 const LIBVO_EXTERN(zr2) |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
54 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
55 typedef struct { |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
56 /* options */ |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
57 char *subdevice; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
58 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
59 /* information for (and about) the zoran card */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
60 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
61 unsigned char *buf; /* the JPEGs will be placed here */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
62 struct mjpeg_requestbuffers zrq; /* info about this buffer */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
63 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
64 int vdes; /* file descriptor of card */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
65 int playing; /* 0 or 1 */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
66 int frame, sync, queue; /* buffer management */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
67 struct mjpeg_sync zs; /* state information */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
68 struct mjpeg_params zp; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
69 struct video_capability vc; /* max resolution and so on */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
70 } vo_zr2_priv_t; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
71 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
72 static vo_zr2_priv_t priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
73 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
74 #define ZR2_MJPEG_NBUFFERS 2 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
75 #define ZR2_MJPEG_SIZE 1024*256 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
76 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
77 /* some convenient #define's, is this portable enough? */ |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
78 #define DBG2(...) mp_msg(MSGT_VO, MSGL_DBG2, "vo_zr2: " __VA_ARGS__) |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
79 #define VERBOSE(...) mp_msg(MSGT_VO, MSGL_V, "vo_zr2: " __VA_ARGS__) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
80 #define ERROR(...) mp_msg(MSGT_VO, MSGL_ERR, "vo_zr2: " __VA_ARGS__) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
81 #define WARNING(...) mp_msg(MSGT_VO, MSGL_WARN, "vo_zr2: " __VA_ARGS__) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
82 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
83 static void stop_playing(vo_zr2_priv_t *p) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
84 if (p->playing) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
85 p->frame = -1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
86 if (ioctl(p->vdes, MJPIOC_QBUF_PLAY, &p->frame) < 0) |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
87 ERROR("error stopping playback\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
88 p->playing = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
89 p->sync = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
90 p->queue = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
91 p->frame = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
92 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
93 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
94 |
14428 | 95 static const char *guess_device(const char *suggestion, int inform) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
96 struct stat vstat; |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
97 int res; |
25810 | 98 static const char * const devs[] = { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
99 "/dev/video", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
100 "/dev/video0", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
101 "/dev/v4l/video0", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
102 "/dev/v4l0", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
103 "/dev/v4l", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
104 NULL |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
105 }; |
25810 | 106 const char * const *dev = devs; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
107 |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
108 if (suggestion) { |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
109 if (!*suggestion) { |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
110 ERROR("error: specified device name is empty string\n"); |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
111 return NULL; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
112 } |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
113 |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
114 res = stat(suggestion, &vstat); |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
115 if (res == 0 && S_ISCHR(vstat.st_mode)) { |
14428 | 116 if (inform) VERBOSE("using device %s\n", suggestion); |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
117 return suggestion; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
118 } else { |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
119 if (res != 0) ERROR("%s does not exist\n", suggestion); |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
120 else ERROR("%s is no character device\n", suggestion); |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
121 /* don't try to be smarter than the user, just exit */ |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
122 return NULL; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
123 } |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
124 } |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
125 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
126 while (*(++dev) != NULL) { |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
127 if (stat(*dev, &vstat) == 0 && S_ISCHR(vstat.st_mode)) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
128 VERBOSE("guessed video device %s\n", *dev); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
129 return *dev; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
130 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
131 dev++; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
132 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
133 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
134 ERROR("unable to find video device\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
135 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
136 return NULL; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
137 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
138 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
139 static int query_format(uint32_t format) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
140 if (format==IMGFMT_ZRMJPEGNI || |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
141 format==IMGFMT_ZRMJPEGIT || |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
142 format==IMGFMT_ZRMJPEGIB) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
143 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
144 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
145 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
146 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
147 static uint32_t draw_image(mp_image_t *mpi) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
148 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
149 int size = (int)mpi->planes[1]; |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
150 if (size > (int)p->zrq.size) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
151 ERROR("incoming JPEG image (size=%d) doesn't fit in buffer\n", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
152 size); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
153 return VO_FALSE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
154 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
155 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
156 /* looking for free buffer */ |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
157 if (p->queue - p->sync < (int)p->zrq.count) p->frame = p->queue; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
158 else { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
159 if (ioctl(p->vdes, MJPIOC_SYNC, &p->zs) < 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
160 ERROR("error waiting for buffer to become free\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
161 return VO_FALSE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
162 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
163 p->frame = p->zs.frame; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
164 p->sync++; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
165 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
166 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
167 /* copy the jpeg image to the buffer which we acquired */ |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
16171
diff
changeset
|
168 fast_memcpy(p->buf + p->zrq.size*p->frame, mpi->planes[0], size); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
169 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
170 return VO_TRUE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
171 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
172 |
14428 | 173 static const char *normstring(int norm) { |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
174 switch (norm) { |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
175 case VIDEO_MODE_PAL: |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
176 return "PAL"; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
177 case VIDEO_MODE_NTSC: |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
178 return "NTSC"; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
179 case VIDEO_MODE_SECAM: |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
180 return "SECAM"; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
181 case VIDEO_MODE_AUTO: |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
182 return "auto"; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
183 } |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
184 return "undefined"; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
185 } |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
186 |
14594 | 187 static int get_norm(const char *n) { |
188 if (!strcmp(n, "PAL")) return VIDEO_MODE_PAL; | |
189 if (!strcmp(n, "NTSC")) return VIDEO_MODE_NTSC; | |
190 if (!strcmp(n, "SECAM")) return VIDEO_MODE_SECAM; | |
191 if (!strcmp(n, "auto")) return VIDEO_MODE_AUTO; | |
14428 | 192 return -1; /* invalid */ |
193 } | |
194 | |
30122
1772a5171ac7
Fix function declarations to avoid casting function pointers.
reimar
parents:
29263
diff
changeset
|
195 static int nc(void *normp) { |
1772a5171ac7
Fix function declarations to avoid casting function pointers.
reimar
parents:
29263
diff
changeset
|
196 const char **norm = normp; |
14594 | 197 if (get_norm(*norm) == -1) { |
198 ERROR("norm \"%s\" is not supported, choose from PAL, NTSC, SECAM and auto\n", *norm); | |
14428 | 199 return 0; |
200 } else return 1; | |
201 } | |
202 | |
30122
1772a5171ac7
Fix function declarations to avoid casting function pointers.
reimar
parents:
29263
diff
changeset
|
203 static int pbc(void *prebufp) { |
1772a5171ac7
Fix function declarations to avoid casting function pointers.
reimar
parents:
29263
diff
changeset
|
204 int *prebuf = prebufp; |
14428 | 205 if (*prebuf) WARNING("prebuffering is not yet supported\n"); |
206 return 1; | |
207 } | |
208 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
209 static int preinit(const char *arg) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
210 vo_zr2_priv_t *p = &priv; |
14428 | 211 const char *dev = NULL; |
14594 | 212 char *dev_arg = NULL, *norm_arg = NULL; |
14428 | 213 int norm = VIDEO_MODE_AUTO, prebuf = 0; |
28828
56eee6ffba9b
Make data related to suboption parsing const in libvo
reimar
parents:
27509
diff
changeset
|
214 const opt_t subopts[] = { /* don't want warnings with -Wall... */ |
28922
9dd905e52639
Remove obsolete extra elements from opt_t struct initialization.
diego
parents:
28828
diff
changeset
|
215 { "dev", OPT_ARG_MSTRZ, &dev_arg, NULL }, |
30122
1772a5171ac7
Fix function declarations to avoid casting function pointers.
reimar
parents:
29263
diff
changeset
|
216 { "prebuf", OPT_ARG_BOOL, &prebuf, pbc }, |
1772a5171ac7
Fix function declarations to avoid casting function pointers.
reimar
parents:
29263
diff
changeset
|
217 { "norm", OPT_ARG_MSTRZ, &norm_arg, nc }, |
28922
9dd905e52639
Remove obsolete extra elements from opt_t struct initialization.
diego
parents:
28828
diff
changeset
|
218 { NULL, 0, NULL, NULL } |
14428 | 219 }; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
220 |
14428 | 221 VERBOSE("preinit() called with arg: %s\n", arg); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
222 memset(p, 0, sizeof(*p)); /* set defaults */ |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
223 p->vdes = -1; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
224 |
14428 | 225 if (subopt_parse(arg, subopts)) { |
226 mp_msg(MSGT_VO, MSGL_FATAL, | |
227 "Allowed suboptions for -vo zr2 are:\n" | |
228 "- dev=DEVICE (default: %s)\n" | |
229 "- norm=PAL|NTSC|SECAM|auto (default: auto)\n" | |
230 "- prebuf/noprebuf (default:" | |
231 " noprebuf)\n" | |
232 "\n" | |
233 "Example: mplayer -vo zr2:dev=/dev/video1:" | |
234 "norm=PAL movie.avi\n\n" | |
235 , guess_device(NULL, 0)); | |
14595 | 236 free(norm_arg); |
237 free(dev_arg); | |
14428 | 238 return -1; |
239 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
240 |
14428 | 241 /* interpret the strings we got from subopt_parse */ |
14594 | 242 if (norm_arg) { |
243 norm = get_norm(norm_arg); | |
244 free(norm_arg); | |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
245 } |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
246 |
14594 | 247 if (dev_arg) dev = dev_arg; |
248 | |
14428 | 249 dev = guess_device(dev, 1); |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
250 if (!dev) { |
14594 | 251 free(dev_arg); |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
252 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
253 return 1; |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
254 } |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
255 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
256 p->vdes = open(dev, O_RDWR); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
257 if (p->vdes < 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
258 ERROR("error opening %s: %s\n", dev, strerror(errno)); |
14594 | 259 free(dev_arg); |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
260 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
261 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
262 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
263 |
14594 | 264 free(dev_arg); |
265 | |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
266 /* check if we really are dealing with a zoran card */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
267 if (ioctl(p->vdes, MJPIOC_G_PARAMS, &p->zp) < 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
268 ERROR("%s probably is not a DC10(+)/buz/lml33\n", dev); |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
269 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
270 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
271 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
272 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
273 VERBOSE("kernel driver version %d.%d, current norm is %s\n", |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
274 p->zp.major_version, p->zp.minor_version, |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
275 normstring(p->zp.norm)); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
276 |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
277 /* changing the norm in the zoran_params and MJPIOC_S_PARAMS |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
278 * does nothing the last time I tried, so bail out if the norm |
11417 | 279 * is not correct */ |
280 if (norm != VIDEO_MODE_AUTO && p->zp.norm != norm) { | |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
281 ERROR("mplayer currently can't change the video norm, " |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
282 "change it with (eg.) XawTV and retry.\n"); |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
283 uninit(); |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
284 return 1; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
285 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
286 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
287 /* gather useful information */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
288 if (ioctl(p->vdes, VIDIOCGCAP, &p->vc) < 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
289 ERROR("error getting video capabilities from %s\n", dev); |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
290 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
291 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
292 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
293 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
294 VERBOSE("card reports maxwidth=%d, maxheight=%d\n", |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
295 p->vc.maxwidth, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
296 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
297 /* according to the mjpegtools source, some cards return a bogus |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
298 * vc.maxwidth, correct it here. If a new zoran card appears with a |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
299 * maxwidth different 640, 720 or 768 this code may lead to problems */ |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
300 if (p->vc.maxwidth != 640 && p->vc.maxwidth != 768) { |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
301 VERBOSE("card probably reported bogus width (%d), " |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
302 "changing to 720\n", p->vc.maxwidth); |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
303 p->vc.maxwidth = 720; |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
304 } |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
305 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
306 p->zrq.count = ZR2_MJPEG_NBUFFERS; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
307 p->zrq.size = ZR2_MJPEG_SIZE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
308 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
309 if (ioctl(p->vdes, MJPIOC_REQBUFS, &p->zrq)) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
310 ERROR("error requesting %d buffers of size %d\n", |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
311 ZR2_MJPEG_NBUFFERS, ZR2_MJPEG_NBUFFERS); |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
312 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
313 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
314 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
315 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
316 VERBOSE("got %ld buffers of size %ld (wanted %d buffers of size %d)\n", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
317 p->zrq.count, p->zrq.size, ZR2_MJPEG_NBUFFERS, |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
318 ZR2_MJPEG_SIZE); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
319 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
320 p->buf = (unsigned char*)mmap(0, p->zrq.count*p->zrq.size, |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
321 PROT_READ|PROT_WRITE, MAP_SHARED, p->vdes, 0); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
322 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
323 if (p->buf == MAP_FAILED) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
324 ERROR("error mapping requested buffers: %s", strerror(errno)); |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
325 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
326 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
327 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
328 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
329 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
330 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
331 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
332 static int config(uint32_t width, uint32_t height, uint32_t d_width, |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
333 uint32_t d_height, uint32_t flags, char *title, uint32_t format) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
334 int fields = 1, top_first = 1, err = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
335 int stretchx = 1, stretchy = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
336 struct mjpeg_params zptmp; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
337 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
338 VERBOSE("config() called\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
339 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
340 /* paranoia check */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
341 if (!query_format(format)) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
342 ERROR("called with wrong format, should be impossible\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
343 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
344 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
345 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
346 if ((int)height > p->vc.maxheight) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
347 ERROR("input height %d is too large, maxheight=%d\n", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
348 height, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
349 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
350 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
351 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
352 if (format != IMGFMT_ZRMJPEGNI) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
353 fields = 2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
354 if (format == IMGFMT_ZRMJPEGIB) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
355 top_first = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
356 } else if ((int)height > p->vc.maxheight/2) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
357 ERROR("input is too high (%d) for non-interlaced playback" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
358 "max=%d\n", height, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
359 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
360 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
361 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
362 if (width%16 != 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
363 ERROR("input width=%d, must be multiple of 16\n", width); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
364 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
365 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
366 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
367 if (height%(fields*8) != 0) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
368 ERROR("input height=%d, must be multiple of %d\n", |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
369 height, 2*fields); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
370 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
371 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
372 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
373 /* we assume sample_aspect = 1 */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
374 if (fields == 1) { |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
375 if (2*d_width <= (uint32_t)p->vc.maxwidth) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
376 VERBOSE("stretching x direction to preserve aspect\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
377 d_width *= 2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
378 } else VERBOSE("unable to preserve aspect, screen width " |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
379 "too small\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
380 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
381 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
382 if (d_width == width) stretchx = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
383 else if (d_width == 2*width) stretchx = 2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
384 #if 0 /* do minimal stretching for now */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
385 else if (d_width == 4*width) stretchx = 4; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
386 else WARNING("d_width must be {1,2,4}*width, using defaults\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
387 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
388 if (d_height == height) stretchy = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
389 else if (d_height == 2*height) stretchy = 2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
390 else if (d_height == 4*height) stretchy = 4; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
391 else WARNING("d_height must be {1,2,4}*height, using defaults\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
392 #endif |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
393 |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
394 if (stretchx*width > (uint32_t)p->vc.maxwidth) { |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
395 ERROR("movie to be played is too wide, width=%d>maxwidth=%d\n", |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
396 width*stretchx, p->vc.maxwidth); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
397 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
398 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
399 |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
400 if (stretchy*height > (uint32_t)p->vc.maxheight) { |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
401 ERROR("movie to be played is too heigh, height=%d>maxheight" |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
402 "=%d\n", height*stretchy, p->vc.maxheight); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
403 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
404 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
405 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
406 if (err == 1) return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
407 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
408 /* some video files (eg. concatenated MPEG files), make MPlayer |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
409 * call config() during playback while no parameters have changed. |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
410 * We make configuration changes to a temporary params structure, |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
411 * compare it with the old params structure and only apply the new |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
412 * config if it is different from the old one. */ |
23458
973e53dc7df5
Do not use fast_memcpy for small size copy, esp. when the size is constant
reimar
parents:
23457
diff
changeset
|
413 memcpy(&zptmp, &p->zp, sizeof(zptmp)); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
414 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
415 /* translate the configuration to zoran understandable format */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
416 zptmp.decimation = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
417 zptmp.HorDcm = stretchx; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
418 zptmp.VerDcm = stretchy; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
419 zptmp.TmpDcm = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
420 zptmp.field_per_buff = fields; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
421 zptmp.odd_even = top_first; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
422 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
423 /* center the image on screen */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
424 zptmp.img_x = (p->vc.maxwidth - width*stretchx)/2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
425 zptmp.img_y = (p->vc.maxheight - height*stretchy*(3-fields))/4; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
426 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
427 zptmp.img_width = stretchx*width; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
428 zptmp.img_height = stretchy*height/fields; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
429 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
430 VERBOSE("tv: %dx%d, out: %dx%d+%d+%d, in: %ux%u %s%s%s\n", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
431 p->vc.maxwidth, p->vc.maxheight, |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
432 zptmp.img_width, 2*zptmp.img_height, |
11660 | 433 zptmp.img_x, 2*zptmp.img_y, |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
434 width, height, (fields == 1) ? "non-interlaced" : "", |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
435 (fields == 2 && top_first == 1) |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
436 ? "interlaced top first" : "", |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
437 (fields == 2 && top_first == 0) |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
438 ? "interlaced bottom first" : ""); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
439 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
440 if (memcmp(&zptmp, &p->zp, sizeof(zptmp))) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
441 /* config differs, we must update */ |
23458
973e53dc7df5
Do not use fast_memcpy for small size copy, esp. when the size is constant
reimar
parents:
23457
diff
changeset
|
442 memcpy(&p->zp, &zptmp, sizeof(zptmp)); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
443 stop_playing(p); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
444 if (ioctl(p->vdes, MJPIOC_S_PARAMS, &p->zp) < 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
445 ERROR("error writing display params to card\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
446 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
447 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
448 VERBOSE("successfully written display parameters to card\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
449 } else VERBOSE("config didn't change, no need to write it to card\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
450 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
451 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
452 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
453 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
454 static int control(uint32_t request, void *data, ...) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
455 switch (request) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
456 case VOCTRL_QUERY_FORMAT: |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
457 return query_format(*((uint32_t*)data)); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
458 case VOCTRL_DRAW_IMAGE: |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
459 return draw_image(data); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
460 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
461 return VO_NOTIMPL; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
462 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
463 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
464 static int draw_frame(uint8_t *src[]) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
465 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
466 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
467 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
468 static int draw_slice(uint8_t *image[], int stride[], |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
469 int w, int h, int x, int y) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
470 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
471 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
472 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
473 static void draw_osd(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
474 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
475 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
476 static void flip_page(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
477 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
478 /* queueing the buffer for playback */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
479 /* queueing the first buffer automatically starts playback */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
480 if (p->playing == 0) p->playing = 1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
481 if (ioctl(p->vdes, MJPIOC_QBUF_PLAY, &p->frame) < 0) |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
482 ERROR("error queueing buffer for playback\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
483 else p->queue++; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
484 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
485 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
486 static void check_events(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
487 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
488 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
489 static void uninit(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
490 vo_zr2_priv_t *p = &priv; |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
491 VERBOSE("uninit() called (may be called from preinit() on error)\n"); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
492 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
493 stop_playing(p); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
494 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
495 if (p->buf && munmap(p->buf, p->zrq.size*p->zrq.count)) |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
496 ERROR("error munmapping buffer: %s\n", strerror(errno)); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
497 |
11416
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
498 if (p->vdes >= 0) close(p->vdes); |
af8c66f215cf
added subdevice options, SECAM support (for what's it worth...), added \n to some verbose messages, tended to compiler warnings (signed/unsigned comparison)
rik
parents:
11390
diff
changeset
|
499 free(p->subdevice); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
500 } |