Mercurial > mplayer.hg
annotate vidix/ivtv_vid.c @ 25504:48441c610249
typo in preprocessor condition
author | diego |
---|---|
date | Thu, 27 Dec 2007 12:27:10 +0000 |
parents | 334d55a31174 |
children | 9feba3abc178 |
rev | line source |
---|---|
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
1 /** |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
2 VIDIX driver for Hauppauge PVR 350. |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
3 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
4 Copyright 2007 Lutz Koschorreck. |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
5 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
6 Based on genfb_vid.c and ivtv_xv.c |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
7 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
8 This program is free software; you can redistribute it and/or modify |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
9 it under the terms of the GNU General Public License as published by |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
10 the Free Software Foundation; either version 2 of the License, or |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
11 (at your option) any later version. |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
12 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
13 This program is distributed in the hope that it will be useful, |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
16 GNU General Public License for more details. |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
17 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
19 along with this program; if not, write to the Free Software |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
21 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
22 09.05.2007 Lutz Koschorreck |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
23 First version: Tested with ivtv-0.10.1, xine-ui-0.99.5, xine-lib-1.1.6 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
24 20.05.2007 Lutz Koschorreck |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
25 Some Scaling and zooming problems fixed. By default the vidix driver now |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
26 controlls the setting of alphablending. So there is no need to use |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
27 ivtvfbctl anymore. To disable this feature set the following environment |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
28 variable:VIDIXIVTVALPHA=disable. Special thanx to Ian Armstrong. |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
29 23.07.2007 Lutz Koschorreck |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
30 Support for 2.6.22 kernel added. PCI scan added. |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
31 07.10.2007 Lutz Koschorreck |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
32 Restore old alpha value correctly. Fix capability struct values. |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
33 **/ |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
34 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
35 #include <errno.h> |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
36 #include <stdio.h> |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
37 #include <stdlib.h> |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
38 #include <string.h> |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
39 #include <unistd.h> |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
40 #include <math.h> |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
41 #include <inttypes.h> |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
42 #include <fcntl.h> |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
43 #include <sys/ioctl.h> |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
44 #include <linux/types.h> |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
45 #include <linux/version.h> |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
46 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
47 #include <linux/videodev2.h> |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
48 #endif |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
49 #include <linux/ivtv.h> |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
50 #include <linux/fb.h> |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
51 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
52 #include "vidix.h" |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
53 #include "vidixlib.h" |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
54 #include "fourcc.h" |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
55 #include "dha.h" |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
56 #include "pci_ids.h" |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
57 #include "pci_names.h" |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
58 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
59 #define VIDIX_STATIC ivtv_ |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
60 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
61 #define IVTV_MSG "[ivtv-vid] " |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
62 #define MAXLINE 128 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
63 #define IVTVMAXWIDTH 720 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
64 #define IVTVMAXHEIGHT 576 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
65 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
66 static int fbdev = -1; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
67 static int yuvdev = -1; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
68 static void *memBase = NULL; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
69 static int frameSize = 0; |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
70 static int probed = 0; |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
71 static int ivtv_verbose; |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
72 static vidix_rect_t destVideo; |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
73 static vidix_rect_t srcVideo; |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
74 static unsigned char *outbuf = NULL; |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
75 double fb_width; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
76 double fb_height; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
77 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
78 static struct ivtvfb_ioctl_state_info fb_state_old; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
79 static struct ivtvfb_ioctl_state_info fb_state_hide; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
80 #else |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
81 struct v4l2_format format_old, format_hide; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
82 #endif |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
83 int alpha_disable = 0; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
84 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
85 /* VIDIX exports */ |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
86 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
87 static vidix_capability_t ivtv_cap = |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
88 { |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
89 "Hauppauge PVR 350 YUV Video", |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
90 "Lutz Koschorreck", |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
91 TYPE_OUTPUT, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
92 { 0, 0, 0, 0 }, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
93 IVTVMAXWIDTH, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
94 IVTVMAXHEIGHT, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
95 4, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
96 4, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
97 -1, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
98 FLAG_UPSCALER|FLAG_DOWNSCALER, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
99 -1, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
100 -1, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
101 { 0, 0, 0, 0 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
102 }; |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
103 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
104 static void de_macro_y(unsigned char *src, unsigned char *dst, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
105 unsigned int w, unsigned int h, int src_x, int src_y, int height __attribute__ ((unused)), int width) |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
106 { |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
107 unsigned int x, y, i; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
108 unsigned char *dst_2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
109 unsigned int h_tail, w_tail; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
110 unsigned int h_size, w_size; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
111 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
112 // Always round the origin, but compensate by increasing the size |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
113 if (src_x & 15) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
114 w += src_x & 15; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
115 src_x &= ~15; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
116 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
117 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
118 if (src_y & 15) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
119 h += src_y & 15; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
120 src_y &= ~15; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
121 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
122 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
123 // The right / bottom edge might not be a multiple of 16 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
124 h_tail = h & 15; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
125 w_tail = w & 15; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
126 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
127 // One block is 16 pixels high |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
128 h_size = 16; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
129 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
130 // descramble Y plane |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
131 for (y = 0; y < h; y += 16) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
132 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
133 // Clip if we've reached the bottom & the size isn't a multiple of 16 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
134 if (y + 16 > h) h_size = h_tail; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
135 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
136 for (x = 0; x < w; x += 16) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
137 if (x + 16 > w) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
138 w_size = w_tail; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
139 else |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
140 w_size = 16; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
141 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
142 dst_2 = dst + (720 * y) + (720 * src_y) + (256 * (src_x>>4)) + (x * 16); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
143 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
144 for (i = 0; i < h_size; i++) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
145 memcpy(dst_2, src + src_x + x + (y + i) * width + (src_y * width), w_size); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
146 dst_2 += 16; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
147 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
148 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
149 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
150 } |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
151 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
152 static void de_macro_uv(unsigned char *srcu, unsigned char *srcv, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
153 unsigned char *dst, unsigned int w, unsigned int h, int src_x, int src_y, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
154 int height, int width) |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
155 { |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
156 unsigned int x, y, i, f; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
157 unsigned char *dst_2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
158 unsigned int h_tail, w_tail; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
159 unsigned int h_size; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
160 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
161 // The uv plane is half the size of the y plane, so 'correct' all dimensions. |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
162 w /= 2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
163 h /= 2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
164 src_x /= 2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
165 src_y /= 2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
166 height /= 2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
167 width /= 2; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
168 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
169 // Always round the origin, but compensate by increasing the size |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
170 if (src_x & 7) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
171 w += src_x & 7; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
172 src_x &= ~7; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
173 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
174 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
175 if (src_y & 15) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
176 h += src_y & 15; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
177 src_y &= ~15; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
178 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
179 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
180 // The right / bottom edge may not be a multiple of 16 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
181 h_tail = h & 15; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
182 w_tail = w & 7; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
183 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
184 h_size = 16; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
185 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
186 // descramble U/V plane |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
187 for (y = 0; y < h; y += 16) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
188 if ( y + 16 > h ) h_size = h_tail; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
189 for (x = 0; x < w; x += 8) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
190 dst_2 = dst + (720 * y) + (720 * src_y) + (256 * (src_x>>3)) + (x * 32); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
191 if (x + 8 <= w) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
192 for (i = 0; i < h_size; i++) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
193 int idx = src_x + x + ((y + i) * width) + (src_y * width); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
194 dst_2[0] = srcu[idx + 0]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
195 dst_2[1] = srcv[idx + 0]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
196 dst_2[2] = srcu[idx + 1]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
197 dst_2[3] = srcv[idx + 1]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
198 dst_2[4] = srcu[idx + 2]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
199 dst_2[5] = srcv[idx + 2]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
200 dst_2[6] = srcu[idx + 3]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
201 dst_2[7] = srcv[idx + 3]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
202 dst_2[8] = srcu[idx + 4]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
203 dst_2[9] = srcv[idx + 4]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
204 dst_2[10] = srcu[idx + 5]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
205 dst_2[11] = srcv[idx + 5]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
206 dst_2[12] = srcu[idx + 6]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
207 dst_2[13] = srcv[idx + 6]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
208 dst_2[14] = srcu[idx + 7]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
209 dst_2[15] = srcv[idx + 7]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
210 dst_2 += 16; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
211 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
212 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
213 else { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
214 for (i = 0; i < h_size; i ++) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
215 int idx = src_x + x + ((y + i) * width) + (src_y * width); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
216 for (f = 0; f < w_tail; f++) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
217 dst_2[0] = srcu[idx + f]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
218 dst_2[1] = srcv[idx + f]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
219 dst_2 += 2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
220 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
221 /* |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
222 // Used for testing edge cutoff. Sets colour to Green |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
223 for (f = w_tail;f < 8;f ++) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
224 dst_2[0] = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
225 dst_2[1] = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
226 dst_2 += 2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
227 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
228 */ |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
229 dst_2 += 16 - (w_tail << 1); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
230 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
231 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
232 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
233 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
234 } |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
235 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
236 int ivtv_probe(int verbose,int force __attribute__ ((unused))) |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
237 { |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
238 unsigned char fb_number = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
239 char *device_name = NULL; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
240 char *alpha = NULL; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
241 struct fb_var_screeninfo vinfo; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
242 char fb_dev_name[] = "/dev/fb0\0"; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
243 pciinfo_t lst[MAX_PCI_DEVICES]; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
244 int err = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
245 unsigned int i, num_pci = 0; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
246 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
247 if(verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
248 printf(IVTV_MSG"probe\n"); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
249 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
250 ivtv_verbose = verbose; |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
251 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
252 err = pci_scan(lst, &num_pci); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
253 if(err) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
254 printf(IVTV_MSG"Error occured during pci scan: %s\n", strerror(err)); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
255 return err; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
256 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
257 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
258 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
259 printf(IVTV_MSG"Found %d pci devices\n", num_pci); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
260 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
261 for(i = 0; i < num_pci; i++) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
262 if(2 == ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
263 printf(IVTV_MSG"Found chip [%04X:%04X] '%s' '%s'\n" |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
264 ,lst[i].vendor |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
265 ,lst[i].device |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
266 ,pci_vendor_name(lst[i].vendor) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
267 ,pci_device_name(lst[i].vendor,lst[i].device)); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
268 if(VENDOR_INTERNEXT == lst[i].vendor) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
269 switch(lst[i].device) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
270 { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
271 case DEVICE_INTERNEXT_ITVC15_MPEG_2_ENCODER: |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
272 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
273 printf(IVTV_MSG"Found PVR 350\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
274 goto card_found; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
275 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
276 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
277 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
278 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
279 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
280 printf(IVTV_MSG"Can't find chip\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
281 return(ENXIO); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
282 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
283 card_found: |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
284 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
285 device_name = getenv("FRAMEBUFFER"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
286 if(NULL == device_name) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
287 device_name = fb_dev_name; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
288 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
289 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
290 fb_number = atoi(device_name+strlen("/dev/fb")); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
291 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
292 fbdev = open(device_name, O_RDWR); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
293 if(-1 != fbdev) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
294 if(ioctl(fbdev, FBIOGET_VSCREENINFO, &vinfo) < 0) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
295 printf(IVTV_MSG"Unable to read screen info\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
296 close(fbdev); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
297 return(ENXIO); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
298 } else { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
299 fb_width = vinfo.xres; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
300 fb_height = vinfo.yres; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
301 if(2 == ivtv_verbose) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
302 printf(IVTV_MSG"framebuffer width : %3.0f\n",fb_width); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
303 printf(IVTV_MSG"framebuffer height: %3.0f\n",fb_height); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
304 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
305 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
306 if(NULL != (alpha = getenv("VIDIXIVTVALPHA"))) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
307 if(0 == strcmp(alpha, "disable")) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
308 alpha_disable = 1; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
309 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
310 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
311 } else { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
312 printf(IVTV_MSG"Failed to open /dev/fb%u\n", fb_number); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
313 return(ENXIO); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
314 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
315 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
316 /* Try to find YUV device */ |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
317 unsigned char yuv_device_number = 48, yuv_device = 48 + fb_number; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
318 char yuv_device_name[] = "/dev/videoXXX\0"; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
319 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
320 do { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
321 sprintf(yuv_device_name, "/dev/video%u", yuv_device); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
322 yuvdev = open(yuv_device_name, O_RDWR); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
323 if(-1 != yuvdev) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
324 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
325 printf(IVTV_MSG"YUV device found /dev/video%u\n", yuv_device); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
326 goto yuv_found; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
327 } else { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
328 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
329 printf(IVTV_MSG"YUV device not found: /dev/video%u\n", yuv_device); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
330 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
331 } while(yuv_device-- > yuv_device_number); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
332 return(ENXIO); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
333 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
334 yuv_found: |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
335 if(0 == alpha_disable) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
336 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
337 if(ioctl(fbdev, IVTVFB_IOCTL_GET_STATE, &fb_state_old) < 0) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
338 printf(IVTV_MSG"Unable to read fb state\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
339 close(yuvdev); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
340 close(fbdev); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
341 return(ENXIO); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
342 } else { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
343 if(ivtv_verbose) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
344 printf(IVTV_MSG"old alpha : %ld\n",fb_state_old.alpha); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
345 printf(IVTV_MSG"old status: 0x%lx\n",fb_state_old.status); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
346 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
347 fb_state_hide.alpha = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
348 fb_state_hide.status = fb_state_old.status | IVTVFB_STATUS_GLOBAL_ALPHA; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
349 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
350 #else |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
351 memset(&format_old, 0, sizeof(format_old)); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
352 format_old.type = format_hide.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
353 if(ioctl(yuvdev, VIDIOC_G_FMT , &format_old) < 0) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
354 printf(IVTV_MSG"Unable to read fb state\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
355 close(yuvdev); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
356 close(fbdev); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
357 return(ENXIO); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
358 } else { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
359 if(ivtv_verbose) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
360 printf(IVTV_MSG"old alpha : %d\n",format_old.fmt.win.global_alpha); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
361 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
362 memcpy(&format_hide, &format_old, sizeof(format_old)); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
363 format_hide.fmt.win.global_alpha = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
364 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
365 #endif |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
366 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
367 probed = 1; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
368 return(0); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
369 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
370 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
371 int ivtv_init(const char *args __attribute__ ((unused))) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
372 { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
373 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
374 printf(IVTV_MSG"init\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
375 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
376 if (!probed) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
377 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
378 printf(IVTV_MSG"Driver was not probed but is being initialized\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
379 return(EINTR); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
380 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
381 outbuf = malloc((IVTVMAXHEIGHT * IVTVMAXWIDTH) + (IVTVMAXHEIGHT * IVTVMAXWIDTH / 2)); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
382 if(NULL == outbuf) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
383 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
384 printf(IVTV_MSG"Not enough memory availabe!\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
385 return(EINTR); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
386 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
387 return(0); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
388 } |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
389 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
390 void ivtv_destroy(void) |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
391 { |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
392 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
393 printf(IVTV_MSG"destroy\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
394 if(-1 != yuvdev) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
395 close(yuvdev); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
396 if(-1 != fbdev) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
397 close(fbdev); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
398 if(NULL != outbuf) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
399 free(outbuf); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
400 if(NULL != memBase) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
401 free(memBase); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
402 } |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
403 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
404 int ivtv_get_caps(vidix_capability_t *to) |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
405 { |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
406 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
407 printf(IVTV_MSG"GetCap\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
408 memcpy(to, &ivtv_cap, sizeof(vidix_capability_t)); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
409 return(0); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
410 } |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
411 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
412 int ivtv_query_fourcc(vidix_fourcc_t *to) |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
413 { |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
414 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
415 printf(IVTV_MSG"query fourcc (%x)\n", to->fourcc); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
416 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
417 int supports = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
418 switch(to->fourcc) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
419 { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
420 case IMGFMT_YV12: |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
421 supports = 1; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
422 break; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
423 default: |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
424 supports = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
425 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
426 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
427 if(!supports) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
428 to->depth = to->flags = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
429 return(ENOTSUP); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
430 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
431 to->depth = VID_DEPTH_12BPP | |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
432 VID_DEPTH_15BPP | VID_DEPTH_16BPP | |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
433 VID_DEPTH_24BPP | VID_DEPTH_32BPP; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
434 to->flags = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
435 return(0); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
436 } |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
437 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
438 int ivtv_config_playback(vidix_playback_t *info) |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
439 { |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
440 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
441 printf(IVTV_MSG"config playback\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
442 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
443 if(2 == ivtv_verbose){ |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
444 printf(IVTV_MSG"src : x:%d y:%d w:%d h:%d\n", |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
445 info->src.x, info->src.y, info->src.w, info->src.h); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
446 printf(IVTV_MSG"dest: x:%d y:%d w:%d h:%d\n", |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
447 info->dest.x, info->dest.y, info->dest.w, info->dest.h); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
448 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
449 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
450 memcpy(&destVideo, &info->dest, sizeof(vidix_rect_t)); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
451 memcpy(&srcVideo, &info->src, sizeof(vidix_rect_t)); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
452 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
453 info->num_frames = 2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
454 info->frame_size = frameSize = info->src.w*info->src.h+(info->src.w*info->src.h)/2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
455 info->dest.pitch.y = 1; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
456 info->dest.pitch.u = info->dest.pitch.v = 2; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
457 info->offsets[0] = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
458 info->offsets[1] = info->frame_size; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
459 info->offset.y = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
460 info->offset.u = info->src.w * info->src.h; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
461 info->offset.v = info->offset.u + ((info->src.w * info->src.h)/4); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
462 info->dga_addr = memBase = malloc(info->num_frames*info->frame_size); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
463 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
464 printf(IVTV_MSG"frame_size: %d, dga_addr: %p\n", |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
465 info->frame_size, info->dga_addr); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
466 return(0); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
467 } |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
468 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
469 int ivtv_playback_on(void) |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
470 { |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
471 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
472 printf(IVTV_MSG"playback on\n"); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
473 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
474 if(0 == alpha_disable) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
475 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
476 if (-1 != fbdev) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
477 if (ioctl(fbdev, IVTVFB_IOCTL_SET_STATE, &fb_state_hide) < 0) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
478 printf (IVTV_MSG"Failed to set fb state\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
479 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
480 #else |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
481 if (-1 != yuvdev) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
482 if (ioctl(yuvdev, VIDIOC_S_FMT, &format_hide) < 0) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
483 printf (IVTV_MSG"Failed to set fb state\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
484 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
485 #endif |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
486 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
487 return(0); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
488 } |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
489 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
490 int ivtv_playback_off(void) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
491 { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
492 if(ivtv_verbose) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
493 printf(IVTV_MSG"playback off\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
494 |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
495 if(0 == alpha_disable) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
496 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
497 if (-1 != fbdev) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
498 if (ioctl(fbdev, IVTVFB_IOCTL_SET_STATE, &fb_state_old) < 0) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
499 printf (IVTV_MSG"Failed to restore fb state\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
500 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
501 #else |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
502 if (-1 != yuvdev) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
503 if (ioctl(yuvdev, VIDIOC_S_FMT, &format_old) < 0) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
504 printf (IVTV_MSG"Failed to restore fb state\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
505 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
506 #endif |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
507 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
508 return(0); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
509 } |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
510 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
511 int ivtv_frame_sel(unsigned int frame) |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
512 { |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
513 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
514 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
515 struct ivtvyuv_ioctl_dma_host_to_ivtv_args args; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
516 #else |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
517 struct ivtv_dma_frame args; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
518 #endif |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
519 unsigned char *curMemBase = (unsigned char *)memBase + (frame * frameSize); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
520 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
521 de_macro_y(curMemBase, outbuf, srcVideo.w, srcVideo.h, srcVideo.x, srcVideo.y, srcVideo.h, srcVideo.w); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
522 de_macro_uv(curMemBase + (srcVideo.w * srcVideo.h) + srcVideo.w * srcVideo.h / 4, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
523 curMemBase + (srcVideo.w * srcVideo.h), outbuf + (IVTVMAXHEIGHT * IVTVMAXWIDTH), |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
524 srcVideo.w, srcVideo.h, srcVideo.x, srcVideo.y, srcVideo.h, srcVideo.w); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
525 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
526 args.y_source = outbuf; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
527 args.uv_source = outbuf + (IVTVMAXHEIGHT * IVTVMAXWIDTH); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
528 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
529 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
530 args.src_x = srcVideo.x; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
531 args.src_y = srcVideo.y; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
532 args.dst_x = destVideo.x; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
533 args.dst_y = destVideo.y; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
534 args.src_w = srcVideo.w; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
535 args.dst_w = destVideo.w; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
536 args.srcBuf_width = srcVideo.w; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
537 args.src_h = srcVideo.h; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
538 args.dst_h = destVideo.h; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
539 args.srcBuf_height = srcVideo.h; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
540 args.yuv_type = 0; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
541 #else |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
542 args.src.left = srcVideo.x; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
543 args.src.top = srcVideo.y; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
544 args.dst.left = destVideo.x; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
545 args.dst.top = destVideo.y; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
546 args.src.width = srcVideo.w; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
547 args.dst.width = destVideo.w; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
548 args.src_width = srcVideo.w; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
549 args.src.height = srcVideo.h; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
550 args.dst.height = destVideo.h; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
551 args.src_height = srcVideo.h; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
552 args.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
553 #endif |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
554 |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
555 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
556 if(ioctl(yuvdev, IVTV_IOC_PREP_FRAME_YUV, &args) == -1) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
557 #else |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
558 if(ioctl(yuvdev, IVTV_IOC_DMA_FRAME, &args) == -1) { |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
559 #endif |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
560 printf("Ioctl IVTV_IOC_DMA_FRAME returned failed Error\n"); |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
561 } |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
562 return(0); |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
563 } |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
564 |
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
565 VDXDriver ivtv_drv = { |
25276
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
566 "ivtv", |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
567 NULL, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
568 .probe = ivtv_probe, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
569 .get_caps = ivtv_get_caps, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
570 .query_fourcc = ivtv_query_fourcc, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
571 .init = ivtv_init, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
572 .destroy = ivtv_destroy, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
573 .config_playback = ivtv_config_playback, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
574 .playback_on = ivtv_playback_on, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
575 .playback_off = ivtv_playback_off, |
334d55a31174
sync ivtv driver with vidix.sf.net (multiple revisions)
ben
parents:
23275
diff
changeset
|
576 .frame_sel = ivtv_frame_sel, |
23275
17fcd644f32e
new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff
changeset
|
577 }; |