Mercurial > mplayer.hg
annotate libvo/vo_zr2.c @ 13255:3cc935e177d2
Sorry, typo
author | kraymer |
---|---|
date | Sun, 05 Sep 2004 22:01:23 +0000 |
parents | a55d0c2d72b5 |
children | e047e70a9767 |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
4 * Copyright (C) Rik Snel 2001-2003, License GNU GPL v2 |
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" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
28 #include "../mp_msg.h" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
29 #include "fastmemcpy.h" |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
30 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
31 static vo_info_t info = { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
32 "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
|
33 "zr2", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
34 "Rik Snel <snel@phys.uu.nl>", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
35 "" |
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 LIBVO_EXTERN(zr2) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
39 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
40 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
|
41 /* 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
|
42 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
|
43 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
44 /* information for (and about) the zoran card */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
45 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
46 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
|
47 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
|
48 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
49 int vdes; /* file descriptor of card */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
50 int playing; /* 0 or 1 */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
51 int frame, sync, queue; /* buffer management */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
52 struct mjpeg_sync zs; /* state information */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
53 struct mjpeg_params zp; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
54 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
|
55 } vo_zr2_priv_t; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
56 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
57 static vo_zr2_priv_t priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
58 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
59 #define ZR2_MJPEG_NBUFFERS 2 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
60 #define ZR2_MJPEG_SIZE 1024*256 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
61 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
62 /* 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
|
63 #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
|
64 #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
|
65 #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
|
66 #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
|
67 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
68 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
|
69 if (p->playing) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
70 p->frame = -1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
71 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
|
72 ERROR("error stopping playback\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
73 p->playing = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
74 p->sync = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
75 p->queue = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
76 p->frame = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
77 } |
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 static char *guess_device(char *suggestion) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
81 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
|
82 int res; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
83 char *devs[] = { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
84 "/dev/video", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
85 "/dev/video0", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
86 "/dev/v4l/video0", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
87 "/dev/v4l0", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
88 "/dev/v4l", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
89 NULL |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
90 }; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
91 char **dev = devs; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
92 |
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
|
93 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
|
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 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
|
96 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
|
97 } |
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 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
|
100 if (res == 0 && S_ISCHR(vstat.st_mode)) { |
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 VERBOSE("using device %s\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
|
102 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
|
103 } 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
|
104 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
|
105 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
|
106 /* 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
|
107 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
|
108 } |
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 } |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
110 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
111 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
|
112 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
|
113 VERBOSE("guessed video device %s\n", *dev); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
114 return *dev; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
115 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
116 dev++; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
117 } |
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 ERROR("unable to find video device\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
120 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
121 return NULL; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
122 } |
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 static uint32_t query_format(uint32_t format) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
125 if (format==IMGFMT_ZRMJPEGNI || |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
126 format==IMGFMT_ZRMJPEGIT || |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
127 format==IMGFMT_ZRMJPEGIB) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
128 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
|
129 return 0; |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
132 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
|
133 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
134 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
|
135 if (size > (int)p->zrq.size) { |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
136 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
|
137 size); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
138 return VO_FALSE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
139 } |
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 /* 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
|
142 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
|
143 else { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
144 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
|
145 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
|
146 return VO_FALSE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
147 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
148 p->frame = p->zs.frame; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
149 p->sync++; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
150 } |
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 /* copy the jpeg image to the buffer which we acquired */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
153 memcpy(p->buf + p->zrq.size*p->frame, mpi->planes[0], size); |
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 return VO_TRUE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
156 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
157 |
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
|
158 static char *normstring(int 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
|
159 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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 } |
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 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
|
170 } |
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 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
172 static uint32_t preinit(const char *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
|
173 char *dev = NULL, *ptr = NULL, *tmp; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
174 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
|
175 int last = 0, norm = VIDEO_MODE_AUTO; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
176 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
177 VERBOSE("preinit() called\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
178 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
|
179 p->vdes = -1; |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
180 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
181 if (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
|
182 /* save subdevice string */ |
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 p->subdevice = strdup(arg); |
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 if (!p->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
|
185 ERROR("out of memory, this is bad\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
|
186 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
|
187 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
|
188 } |
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
|
189 |
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
|
190 tmp = ptr = p->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
|
191 do { |
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
|
192 while (*tmp != ':' && *tmp) tmp++; |
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
|
193 if (*tmp == ':') *tmp++ = '\0'; |
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
|
194 else last = 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
|
195 DBG2("processing subdevice option \"%s\"\n", ptr); |
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
|
196 if (!strncmp("dev=", ptr, 4)) { |
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
|
197 dev = ptr + 4; |
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
|
198 VERBOSE("user specified device \"%s\"\n", dev); |
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
|
199 } else if (!strcasecmp("PAL", ptr)) { |
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
|
200 norm = 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
|
201 VERBOSE("user specified video norm PAL\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
|
202 } else if (!strcasecmp("SECAM", ptr)) { |
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
|
203 norm = 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
|
204 VERBOSE("user specified video norm SECAM\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
|
205 } else if (!strcasecmp("NTSC", ptr)) { |
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
|
206 norm = 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
|
207 VERBOSE("user specified video norm NTSC\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
|
208 } else if (!strcmp("prebuf", ptr)) { |
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
|
209 WARNING("prebuffering is not yet supported\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
|
210 } 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
|
211 WARNING("ignoring unknown subdevice option " |
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
|
212 "\"%s\", or missing argument\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
|
213 ptr); |
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
|
214 } |
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
|
215 ptr = tmp; |
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
|
216 } while (!last); |
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
|
217 } |
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
|
218 |
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
|
219 dev = guess_device(dev); |
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
|
220 if (!dev) { |
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 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
222 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
|
223 } |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
224 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
225 p->vdes = open(dev, O_RDWR); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
226 if (p->vdes < 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
227 ERROR("error opening %s: %s\n", dev, 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
|
228 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
229 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
230 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
231 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
232 /* 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
|
233 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
|
234 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
|
235 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
236 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
237 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
238 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
239 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
|
240 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
|
241 normstring(p->zp.norm)); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
242 |
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 /* changing the norm in the zoran_params and MJPIOC_S_PARAMS |
11417 | 244 * does nothing the last time I tried, so bail out if the norm |
245 * is not correct */ | |
246 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
|
247 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
|
248 "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
|
249 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
|
250 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
|
251 } |
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 /* gather useful information */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
254 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
|
255 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
|
256 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
257 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
258 } |
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 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
260 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
|
261 p->vc.maxwidth, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
262 |
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
|
263 /* 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
|
264 * 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
|
265 * 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
|
266 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
|
267 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
|
268 "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
|
269 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
|
270 } |
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
|
271 |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
272 p->zrq.count = ZR2_MJPEG_NBUFFERS; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
273 p->zrq.size = ZR2_MJPEG_SIZE; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
274 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
275 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
|
276 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
|
277 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
|
278 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
279 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
280 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
281 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
282 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
|
283 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
|
284 ZR2_MJPEG_SIZE); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
285 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
286 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
|
287 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
|
288 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
289 if (p->buf == MAP_FAILED) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
290 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
|
291 uninit(); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
292 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
293 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
294 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
295 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
296 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
297 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
298 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
299 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
|
300 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
|
301 int stretchx = 1, stretchy = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
302 struct mjpeg_params zptmp; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
303 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
304 VERBOSE("config() called\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
305 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
306 /* paranoia check */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
307 if (!query_format(format)) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
308 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
|
309 return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
310 } |
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 if ((int)height > p->vc.maxheight) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
313 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
|
314 height, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
315 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
316 } |
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 if (format != IMGFMT_ZRMJPEGNI) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
319 fields = 2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
320 if (format == IMGFMT_ZRMJPEGIB) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
321 top_first = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
322 } 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
|
323 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
|
324 "max=%d\n", height, p->vc.maxheight); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
325 err = 1; |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
328 if (width%16 != 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
329 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
|
330 err = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
331 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
332 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
333 if (height%(fields*8) != 0) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
334 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
|
335 height, 2*fields); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
336 err = 1; |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
339 /* we assume sample_aspect = 1 */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
340 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
|
341 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
|
342 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
|
343 d_width *= 2; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
344 } 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
|
345 "too small\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
346 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
347 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
348 if (d_width == width) stretchx = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
349 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
|
350 #if 0 /* do minimal stretching for now */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
351 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
|
352 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
|
353 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
354 if (d_height == height) stretchy = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
355 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
|
356 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
|
357 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
|
358 #endif |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
359 |
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
|
360 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
|
361 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
|
362 width*stretchx, p->vc.maxwidth); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
363 err = 1; |
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 |
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
|
366 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
|
367 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
|
368 "=%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
|
369 err = 1; |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
372 if (err == 1) return 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
373 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
374 /* 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
|
375 * 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
|
376 * 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
|
377 * 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
|
378 * config if it is different from the old one. */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
379 memcpy(&zptmp, &p->zp, sizeof(zptmp)); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
380 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
381 /* translate the configuration to zoran understandable format */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
382 zptmp.decimation = 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
383 zptmp.HorDcm = stretchx; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
384 zptmp.VerDcm = stretchy; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
385 zptmp.TmpDcm = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
386 zptmp.field_per_buff = fields; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
387 zptmp.odd_even = top_first; |
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 /* center the image on screen */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
390 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
|
391 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
|
392 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
393 zptmp.img_width = stretchx*width; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
394 zptmp.img_height = stretchy*height/fields; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
395 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
396 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
|
397 p->vc.maxwidth, p->vc.maxheight, |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
398 zptmp.img_width, 2*zptmp.img_height, |
11660 | 399 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
|
400 width, height, (fields == 1) ? "non-interlaced" : "", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
401 (fields == 2 && top_first == 1) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
402 ? "interlaced top first" : "", |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
403 (fields == 2 && top_first == 0) |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
404 ? "interlaced bottom first" : ""); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
405 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
406 if (memcmp(&zptmp, &p->zp, sizeof(zptmp))) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
407 /* config differs, we must update */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
408 memcpy(&p->zp, &zptmp, sizeof(zptmp)); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
409 stop_playing(p); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
410 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
|
411 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
|
412 return 1; |
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("successfully written display parameters to card\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
415 } 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
|
416 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
417 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
418 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
419 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
420 static uint32_t control(uint32_t request, void *data, ...) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
421 switch (request) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
422 case VOCTRL_QUERY_FORMAT: |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
423 return query_format(*((uint32_t*)data)); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
424 case VOCTRL_DRAW_IMAGE: |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
425 return draw_image(data); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
426 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
427 return VO_NOTIMPL; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
428 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
429 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
430 static uint32_t draw_frame(uint8_t *src[]) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
431 return 0; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
432 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
433 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
434 static uint32_t draw_slice(uint8_t *image[], int stride[], |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
435 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
|
436 return 0; |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
439 static void draw_osd(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
440 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
441 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
442 static void flip_page(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
443 vo_zr2_priv_t *p = &priv; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
444 /* queueing the buffer for playback */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
445 /* queueing the first buffer automatically starts playback */ |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
446 if (p->playing == 0) p->playing = 1; |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
447 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
|
448 ERROR("error queueing buffer for playback\n"); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
449 else p->queue++; |
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 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
452 static void check_events(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
453 } |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
454 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
455 static void uninit(void) { |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
456 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
|
457 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
|
458 |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
459 stop_playing(p); |
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
460 |
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
|
461 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
|
462 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
|
463 |
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
|
464 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
|
465 free(p->subdevice); |
11390
32eb3dfe44c9
new zoran driver as discussed on the CVS list. Hardware passthrough is
rik
parents:
diff
changeset
|
466 } |