Mercurial > mplayer.hg
annotate libvo/vo_zr2.c @ 25194:e816d546c4fe
ao_null: Make duration of "buffered" audio constant
Choose the "buffer size" for the amount of audio the driver accepts so
that it corresponds to about 0.2 seconds of playback based on the
number of channels, sample size and samplerate.
author | uau |
---|---|
date | Sat, 01 Dec 2007 01:39:39 +0000 |
parents | 973e53dc7df5 |
children | 3aee342be929 |
rev | line source |
---|---|
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
1 /* |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
2 * vo_zr2.c - playback on zoran cards |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
3 * Based on vo_zr.c,v 1.27 |
14428 | 4 * Copyright (C) Rik Snel 2001-2005, License GNU GPL v2 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
5 */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
6 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
7 /* $Id$ */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
8 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
9 #include <stdio.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
10 #include <stdlib.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
11 #include <string.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
12 #include <unistd.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
13 #include <fcntl.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
14 #include <errno.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
15 #include <sys/stat.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
16 #include <sys/types.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
17 #include <sys/time.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
18 #include <sys/mman.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
19 #include <sys/ioctl.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
20 #include <linux/types.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
21 #include <linux/videodev.h> |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
22 #include "videodev_mjpeg.h" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
23 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
24 #include "config.h" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
25 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
26 #include "video_out.h" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
27 #include "video_out_internal.h" |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
11660
diff
changeset
|
28 #include "mp_msg.h" |
14428 | 29 #include "subopt-helper.h" |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
30 #include "fastmemcpy.h" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
31 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
32 static vo_info_t info = { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
33 "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
|
34 "zr2", |
14429
90b4a1345b96
replace almost obsolete email address: snel@phys.uu.nl -> rsnel@cube.dyndns.org
rik
parents:
14428
diff
changeset
|
35 "Rik Snel <rsnel@cube.dyndns.org>", |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
36 "" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
37 }; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
38 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
39 LIBVO_EXTERN(zr2) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
40 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
41 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
|
42 /* 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
|
43 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
|
44 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
45 /* information for (and about) the zoran card */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
46 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
47 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
|
48 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
|
49 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
50 int vdes; /* file descriptor of card */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
51 int playing; /* 0 or 1 */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
52 int frame, sync, queue; /* buffer management */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
53 struct mjpeg_sync zs; /* state information */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
54 struct mjpeg_params zp; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
55 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
|
56 } vo_zr2_priv_t; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
57 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
58 static vo_zr2_priv_t priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
59 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
60 #define ZR2_MJPEG_NBUFFERS 2 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
61 #define ZR2_MJPEG_SIZE 1024*256 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
62 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
63 /* 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
|
64 #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
|
65 #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
|
66 #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
|
67 #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
|
68 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
69 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
|
70 if (p->playing) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
71 p->frame = -1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
72 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
|
73 ERROR("error stopping playback\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
74 p->playing = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
75 p->sync = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
76 p->queue = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
77 p->frame = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
78 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
79 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
80 |
14428 | 81 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
|
82 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
|
83 int res; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
84 char *devs[] = { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
85 "/dev/video", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
86 "/dev/video0", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
87 "/dev/v4l/video0", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
88 "/dev/v4l0", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
89 "/dev/v4l", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
90 NULL |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
91 }; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
92 char **dev = devs; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
93 |
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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 } |
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
|
99 |
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
|
100 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
|
101 if (res == 0 && S_ISCHR(vstat.st_mode)) { |
14428 | 102 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
|
103 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
|
104 } 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
|
105 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
|
106 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
|
107 /* 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
|
108 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
|
109 } |
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 } |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
111 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
112 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
|
113 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
|
114 VERBOSE("guessed video device %s\n", *dev); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
115 return *dev; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
116 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
117 dev++; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
118 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
119 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
120 ERROR("unable to find video device\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
121 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
122 return NULL; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
123 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
124 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
125 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
|
126 if (format==IMGFMT_ZRMJPEGNI || |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
127 format==IMGFMT_ZRMJPEGIT || |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
128 format==IMGFMT_ZRMJPEGIB) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
129 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
|
130 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
131 } |
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 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
|
134 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
135 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
|
136 if (size > (int)p->zrq.size) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
137 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
|
138 size); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
139 return VO_FALSE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
140 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
141 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
142 /* 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
|
143 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
|
144 else { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
145 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
|
146 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
|
147 return VO_FALSE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
148 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
149 p->frame = p->zs.frame; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
150 p->sync++; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
151 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
152 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
153 /* 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
|
154 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
|
155 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
156 return VO_TRUE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
157 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
158 |
14428 | 159 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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 } |
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
|
170 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
|
171 } |
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
|
172 |
14594 | 173 static int get_norm(const char *n) { |
174 if (!strcmp(n, "PAL")) return VIDEO_MODE_PAL; | |
175 if (!strcmp(n, "NTSC")) return VIDEO_MODE_NTSC; | |
176 if (!strcmp(n, "SECAM")) return VIDEO_MODE_SECAM; | |
177 if (!strcmp(n, "auto")) return VIDEO_MODE_AUTO; | |
14428 | 178 return -1; /* invalid */ |
179 } | |
180 | |
14594 | 181 static int nc(const char **norm) { |
182 if (get_norm(*norm) == -1) { | |
183 ERROR("norm \"%s\" is not supported, choose from PAL, NTSC, SECAM and auto\n", *norm); | |
14428 | 184 return 0; |
185 } else return 1; | |
186 } | |
187 | |
188 static int pbc(int *prebuf) { | |
189 if (*prebuf) WARNING("prebuffering is not yet supported\n"); | |
190 return 1; | |
191 } | |
192 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
193 static int preinit(const char *arg) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
194 vo_zr2_priv_t *p = &priv; |
14428 | 195 const char *dev = NULL; |
14594 | 196 char *dev_arg = NULL, *norm_arg = NULL; |
14428 | 197 int norm = VIDEO_MODE_AUTO, prebuf = 0; |
198 opt_t subopts[] = { /* don't want warnings with -Wall... */ | |
14594 | 199 { "dev", OPT_ARG_MSTRZ, &dev_arg, NULL, 0 }, |
200 { "prebuf", OPT_ARG_BOOL, &prebuf, (opt_test_f)pbc, 0 }, | |
201 { "norm", OPT_ARG_MSTRZ, &norm_arg, (opt_test_f)nc, 0 }, | |
202 { NULL, 0, NULL, NULL, 0 } | |
14428 | 203 }; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
204 |
14428 | 205 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
|
206 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
|
207 p->vdes = -1; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
208 |
14428 | 209 if (subopt_parse(arg, subopts)) { |
210 mp_msg(MSGT_VO, MSGL_FATAL, | |
211 "Allowed suboptions for -vo zr2 are:\n" | |
212 "- dev=DEVICE (default: %s)\n" | |
213 "- norm=PAL|NTSC|SECAM|auto (default: auto)\n" | |
214 "- prebuf/noprebuf (default:" | |
215 " noprebuf)\n" | |
216 "\n" | |
217 "Example: mplayer -vo zr2:dev=/dev/video1:" | |
218 "norm=PAL movie.avi\n\n" | |
219 , guess_device(NULL, 0)); | |
14595 | 220 free(norm_arg); |
221 free(dev_arg); | |
14428 | 222 return -1; |
223 } | |
224 | |
225 /* interpret the strings we got from subopt_parse */ | |
14594 | 226 if (norm_arg) { |
227 norm = get_norm(norm_arg); | |
228 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
|
229 } |
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
|
230 |
14594 | 231 if (dev_arg) dev = dev_arg; |
232 | |
14428 | 233 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
|
234 if (!dev) { |
14594 | 235 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
|
236 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
237 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
|
238 } |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
239 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
240 p->vdes = open(dev, O_RDWR); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
241 if (p->vdes < 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
242 ERROR("error opening %s: %s\n", dev, strerror(errno)); |
14594 | 243 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
|
244 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
245 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
246 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
247 |
14594 | 248 free(dev_arg); |
249 | |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
250 /* 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
|
251 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
|
252 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
|
253 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
254 return 1; |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
257 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
|
258 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
|
259 normstring(p->zp.norm)); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
260 |
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
|
261 /* changing the norm in the zoran_params and MJPIOC_S_PARAMS |
11417 | 262 * does nothing the last time I tried, so bail out if the norm |
263 * is not correct */ | |
264 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
|
265 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
|
266 "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
|
267 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
|
268 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
|
269 } |
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
|
270 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
271 /* gather useful information */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
272 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
|
273 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
|
274 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
275 return 1; |
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 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
278 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
|
279 p->vc.maxwidth, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
280 |
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 /* 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
|
282 * 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
|
283 * 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
|
284 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
|
285 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
|
286 "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
|
287 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
|
288 } |
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
|
289 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
290 p->zrq.count = ZR2_MJPEG_NBUFFERS; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
291 p->zrq.size = ZR2_MJPEG_SIZE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
292 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
293 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
|
294 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
|
295 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
|
296 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
297 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
298 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
299 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
300 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
|
301 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
|
302 ZR2_MJPEG_SIZE); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
303 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
304 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
|
305 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
|
306 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
307 if (p->buf == MAP_FAILED) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
308 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
|
309 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
310 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
311 } |
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 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
314 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
315 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
316 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
|
317 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
|
318 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
|
319 int stretchx = 1, stretchy = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
320 struct mjpeg_params zptmp; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
321 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
322 VERBOSE("config() called\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
323 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
324 /* paranoia check */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
325 if (!query_format(format)) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
326 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
|
327 return 1; |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
330 if ((int)height > p->vc.maxheight) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
331 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
|
332 height, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
333 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
334 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
335 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
336 if (format != IMGFMT_ZRMJPEGNI) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
337 fields = 2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
338 if (format == IMGFMT_ZRMJPEGIB) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
339 top_first = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
340 } 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
|
341 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
|
342 "max=%d\n", height, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
343 err = 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 (width%16 != 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
347 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
|
348 err = 1; |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
351 if (height%(fields*8) != 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
352 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
|
353 height, 2*fields); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
354 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
355 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
356 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
357 /* we assume sample_aspect = 1 */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
358 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
|
359 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
|
360 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
|
361 d_width *= 2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
362 } 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
|
363 "too small\n"); |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
366 if (d_width == width) stretchx = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
367 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
|
368 #if 0 /* do minimal stretching for now */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
369 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
|
370 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
|
371 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
372 if (d_height == height) stretchy = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
373 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
|
374 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
|
375 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
|
376 #endif |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
377 |
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
|
378 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
|
379 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
|
380 width*stretchx, p->vc.maxwidth); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
381 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
382 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
383 |
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
|
384 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
|
385 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
|
386 "=%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
|
387 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
388 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
389 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
390 if (err == 1) return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
391 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
392 /* 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
|
393 * 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
|
394 * 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
|
395 * 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
|
396 * 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
|
397 memcpy(&zptmp, &p->zp, sizeof(zptmp)); |
11390
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 /* translate the configuration to zoran understandable format */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
400 zptmp.decimation = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
401 zptmp.HorDcm = stretchx; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
402 zptmp.VerDcm = stretchy; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
403 zptmp.TmpDcm = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
404 zptmp.field_per_buff = fields; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
405 zptmp.odd_even = top_first; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
406 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
407 /* center the image on screen */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
408 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
|
409 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
|
410 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
411 zptmp.img_width = stretchx*width; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
412 zptmp.img_height = stretchy*height/fields; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
413 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
414 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
|
415 p->vc.maxwidth, p->vc.maxheight, |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
416 zptmp.img_width, 2*zptmp.img_height, |
11660 | 417 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
|
418 width, height, (fields == 1) ? "non-interlaced" : "", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
419 (fields == 2 && top_first == 1) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
420 ? "interlaced top first" : "", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
421 (fields == 2 && top_first == 0) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
422 ? "interlaced bottom first" : ""); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
423 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
424 if (memcmp(&zptmp, &p->zp, sizeof(zptmp))) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
425 /* 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
|
426 memcpy(&p->zp, &zptmp, sizeof(zptmp)); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
427 stop_playing(p); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
428 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
|
429 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
|
430 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
431 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
432 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
|
433 } 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
|
434 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
435 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
436 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
437 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
438 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
|
439 switch (request) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
440 case VOCTRL_QUERY_FORMAT: |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
441 return query_format(*((uint32_t*)data)); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
442 case VOCTRL_DRAW_IMAGE: |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
443 return draw_image(data); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
444 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
445 return VO_NOTIMPL; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
446 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
447 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
14595
diff
changeset
|
448 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
|
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 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
|
453 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
|
454 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
455 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
456 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
457 static void draw_osd(void) { |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
460 static void flip_page(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
461 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
462 /* queueing the buffer for playback */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
463 /* queueing the first buffer automatically starts playback */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
464 if (p->playing == 0) p->playing = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
465 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
|
466 ERROR("error queueing buffer for playback\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
467 else p->queue++; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
468 } |
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 static void check_events(void) { |
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 uninit(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
474 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
|
475 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
|
476 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
477 stop_playing(p); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
478 |
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
|
479 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
|
480 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
|
481 |
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
|
482 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
|
483 free(p->subdevice); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
484 } |