Mercurial > mplayer.hg
annotate libvo/vo_zr2.c @ 27912:73c7a62c1d35
Remove a useless XGetGeometry call, the X11 event handling already
updates vo_dwidth/vo_dheight.
author | reimar |
---|---|
date | Mon, 17 Nov 2008 13:12:01 +0000 |
parents | d97a607821f1 |
children | 56eee6ffba9b |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
75 #define ZR2_MJPEG_SIZE 1024*256 |
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; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
86 if (ioctl(p->vdes, MJPIOC_QBUF_PLAY, &p->frame) < 0) |
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); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
169 |
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 | |
14594 | 195 static int nc(const char **norm) { |
196 if (get_norm(*norm) == -1) { | |
197 ERROR("norm \"%s\" is not supported, choose from PAL, NTSC, SECAM and auto\n", *norm); | |
14428 | 198 return 0; |
199 } else return 1; | |
200 } | |
201 | |
202 static int pbc(int *prebuf) { | |
203 if (*prebuf) WARNING("prebuffering is not yet supported\n"); | |
204 return 1; | |
205 } | |
206 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
207 static int preinit(const char *arg) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
208 vo_zr2_priv_t *p = &priv; |
14428 | 209 const char *dev = NULL; |
14594 | 210 char *dev_arg = NULL, *norm_arg = NULL; |
14428 | 211 int norm = VIDEO_MODE_AUTO, prebuf = 0; |
212 opt_t subopts[] = { /* don't want warnings with -Wall... */ | |
14594 | 213 { "dev", OPT_ARG_MSTRZ, &dev_arg, NULL, 0 }, |
214 { "prebuf", OPT_ARG_BOOL, &prebuf, (opt_test_f)pbc, 0 }, | |
215 { "norm", OPT_ARG_MSTRZ, &norm_arg, (opt_test_f)nc, 0 }, | |
216 { NULL, 0, NULL, NULL, 0 } | |
14428 | 217 }; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
218 |
14428 | 219 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
|
220 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
|
221 p->vdes = -1; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
222 |
14428 | 223 if (subopt_parse(arg, subopts)) { |
224 mp_msg(MSGT_VO, MSGL_FATAL, | |
225 "Allowed suboptions for -vo zr2 are:\n" | |
226 "- dev=DEVICE (default: %s)\n" | |
227 "- norm=PAL|NTSC|SECAM|auto (default: auto)\n" | |
228 "- prebuf/noprebuf (default:" | |
229 " noprebuf)\n" | |
230 "\n" | |
231 "Example: mplayer -vo zr2:dev=/dev/video1:" | |
232 "norm=PAL movie.avi\n\n" | |
233 , guess_device(NULL, 0)); | |
14595 | 234 free(norm_arg); |
235 free(dev_arg); | |
14428 | 236 return -1; |
237 } | |
238 | |
239 /* interpret the strings we got from subopt_parse */ | |
14594 | 240 if (norm_arg) { |
241 norm = get_norm(norm_arg); | |
242 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
|
243 } |
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
|
244 |
14594 | 245 if (dev_arg) dev = dev_arg; |
246 | |
14428 | 247 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
|
248 if (!dev) { |
14594 | 249 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
|
250 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
251 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
|
252 } |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
253 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
254 p->vdes = open(dev, O_RDWR); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
255 if (p->vdes < 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
256 ERROR("error opening %s: %s\n", dev, strerror(errno)); |
14594 | 257 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
|
258 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
259 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
260 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
261 |
14594 | 262 free(dev_arg); |
263 | |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
264 /* 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
|
265 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
|
266 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
|
267 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
268 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
269 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
270 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
271 VERBOSE("kernel driver version %d.%d, current norm is %s\n", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
272 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
|
273 normstring(p->zp.norm)); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
274 |
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 /* changing the norm in the zoran_params and MJPIOC_S_PARAMS |
11417 | 276 * does nothing the last time I tried, so bail out if the norm |
277 * is not correct */ | |
278 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
|
279 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
|
280 "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
|
281 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
|
282 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
|
283 } |
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 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
285 /* gather useful information */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
286 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
|
287 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
|
288 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
289 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
290 } |
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
|
291 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
292 VERBOSE("card reports maxwidth=%d, maxheight=%d\n", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
293 p->vc.maxwidth, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
294 |
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
|
295 /* according to the mjpegtools source, some cards return a bogus |
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
|
296 * vc.maxwidth, correct it here. If a new zoran card appears with a |
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
|
297 * 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
|
298 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
|
299 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
|
300 "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
|
301 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
|
302 } |
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 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
304 p->zrq.count = ZR2_MJPEG_NBUFFERS; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
305 p->zrq.size = ZR2_MJPEG_SIZE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
306 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
307 if (ioctl(p->vdes, MJPIOC_REQBUFS, &p->zrq)) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
308 ERROR("error requesting %d buffers of size %d\n", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
309 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
|
310 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
311 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
312 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
313 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
314 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
|
315 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
|
316 ZR2_MJPEG_SIZE); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
317 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
318 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
|
319 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
|
320 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
321 if (p->buf == MAP_FAILED) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
322 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
|
323 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
324 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
325 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
326 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
327 return 0; |
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 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
330 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
|
331 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
|
332 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
|
333 int stretchx = 1, stretchy = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
334 struct mjpeg_params zptmp; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
335 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
336 VERBOSE("config() called\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
337 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
338 /* paranoia check */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
339 if (!query_format(format)) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
340 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
|
341 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
342 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
343 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
344 if ((int)height > p->vc.maxheight) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
345 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
|
346 height, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
347 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
348 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
349 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
350 if (format != IMGFMT_ZRMJPEGNI) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
351 fields = 2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
352 if (format == IMGFMT_ZRMJPEGIB) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
353 top_first = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
354 } 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
|
355 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
|
356 "max=%d\n", height, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
357 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
358 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
359 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
360 if (width%16 != 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
361 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
|
362 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
363 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
364 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
365 if (height%(fields*8) != 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
366 ERROR("input height=%d, must be multiple of %d\n", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
367 height, 2*fields); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
368 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
369 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
370 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
371 /* we assume sample_aspect = 1 */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
372 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
|
373 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
|
374 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
|
375 d_width *= 2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
376 } 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
|
377 "too small\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
378 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
379 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
380 if (d_width == width) stretchx = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
381 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
|
382 #if 0 /* do minimal stretching for now */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
383 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
|
384 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
|
385 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
386 if (d_height == height) stretchy = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
387 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
|
388 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
|
389 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
|
390 #endif |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
391 |
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
|
392 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
|
393 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
|
394 width*stretchx, p->vc.maxwidth); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
395 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
396 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
397 |
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
|
398 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
|
399 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
|
400 "=%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
|
401 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
402 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
403 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
404 if (err == 1) return 1; |
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 /* 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
|
407 * 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
|
408 * 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
|
409 * 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
|
410 * 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
|
411 memcpy(&zptmp, &p->zp, sizeof(zptmp)); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
412 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
413 /* translate the configuration to zoran understandable format */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
414 zptmp.decimation = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
415 zptmp.HorDcm = stretchx; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
416 zptmp.VerDcm = stretchy; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
417 zptmp.TmpDcm = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
418 zptmp.field_per_buff = fields; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
419 zptmp.odd_even = top_first; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
420 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
421 /* center the image on screen */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
422 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
|
423 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
|
424 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
425 zptmp.img_width = stretchx*width; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
426 zptmp.img_height = stretchy*height/fields; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
427 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
428 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
|
429 p->vc.maxwidth, p->vc.maxheight, |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
430 zptmp.img_width, 2*zptmp.img_height, |
11660 | 431 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
|
432 width, height, (fields == 1) ? "non-interlaced" : "", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
433 (fields == 2 && top_first == 1) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
434 ? "interlaced top first" : "", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
435 (fields == 2 && top_first == 0) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
436 ? "interlaced bottom first" : ""); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
437 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
438 if (memcmp(&zptmp, &p->zp, sizeof(zptmp))) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
439 /* 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
|
440 memcpy(&p->zp, &zptmp, sizeof(zptmp)); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
441 stop_playing(p); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
442 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
|
443 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
|
444 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
445 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
446 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
|
447 } 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
|
448 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
449 return 0; |
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 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
452 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
|
453 switch (request) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
454 case VOCTRL_QUERY_FORMAT: |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
455 return query_format(*((uint32_t*)data)); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
456 case VOCTRL_DRAW_IMAGE: |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
457 return draw_image(data); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
458 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
459 return VO_NOTIMPL; |
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 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
462 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
|
463 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
464 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
465 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
466 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
|
467 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
|
468 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
469 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
470 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
471 static void draw_osd(void) { |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
474 static void flip_page(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
475 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
476 /* queueing the buffer for playback */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
477 /* queueing the first buffer automatically starts playback */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
478 if (p->playing == 0) p->playing = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
479 if (ioctl(p->vdes, MJPIOC_QBUF_PLAY, &p->frame) < 0) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
480 ERROR("error queueing buffer for playback\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
481 else p->queue++; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
482 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
483 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
484 static void check_events(void) { |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
487 static void uninit(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
488 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
|
489 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
|
490 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
491 stop_playing(p); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
492 |
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
|
493 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
|
494 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
|
495 |
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
|
496 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
|
497 free(p->subdevice); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
498 } |