annotate vidix/ivtv_vid.c @ 24500:dcb02dadd06c

Get rid of bloated ty_extension function
author reimar
date Sat, 15 Sep 2007 11:03:38 +0000
parents 17fcd644f32e
children 334d55a31174
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
24
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
25 **/
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
26
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
27 #include <errno.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
28 #include <stdio.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
29 #include <stdlib.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
30 #include <string.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
31 #include <unistd.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
32 #include <math.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
33 #include <inttypes.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
34 #include <fcntl.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
35 #include <sys/ioctl.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
36 #include <linux/types.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
37 #include <linux/ivtv.h>
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
38
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
39 #include "vidix.h"
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
40 #include "vidixlib.h"
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
41 #include "fourcc.h"
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
42 #include "dha.h"
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
43 #include "pci_ids.h"
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
44 #include "pci_names.h"
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
45
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
46 #define VIDIX_STATIC ivtv_
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
47
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
48 #define IVTV_MSG "[ivtv-vid] "
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
49 #define MAXLINE 128
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
50 #define IVTVMAXWIDTH 720
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
51 #define IVTVMAXHEIGHT 576
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
52
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
53 static int yuvdev = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
54 static void *memBase = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
55 static int frameSize = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
56 static int probed = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
57 static int ivtv_verbose;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
58 static vidix_rect_t destVideo;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
59 static vidix_rect_t srcVideo;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
60 static unsigned char *outbuf = NULL;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
61
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
62 /* VIDIX exports */
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
63
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
64 static vidix_capability_t ivtv_cap =
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
65 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
66 "Hauppauge PVR 350 YUV Video",
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
67 "Lutz Koschorreck",
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
68 TYPE_OUTPUT,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
69 { 0, 0, 0, 0 },
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
70 IVTVMAXHEIGHT,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
71 IVTVMAXWIDTH,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
72 4,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
73 4,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
74 -1,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
75 FLAG_UPSCALER|FLAG_DOWNSCALER,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
76 -1,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
77 -1,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
78 { 0, 0, 0, 0 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
79 };
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
80
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
81 static void de_macro_y (unsigned char *src, unsigned char *dst,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
82 unsigned int w, unsigned int h,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
83 int src_x, int src_y,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
84 int height __attribute__ ((unused)), int width)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
85 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
86 unsigned int x, y, i;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
87 unsigned char *dst_2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
88 unsigned int h_tail, w_tail;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
89 unsigned int h_size, w_size;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
90
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
91 // Always round the origin, but compensate by increasing the size
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
92 if (src_x & 15)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
93 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
94 w += src_x & 15;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
95 src_x &= ~15;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
96 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
97
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
98 if (src_y & 15)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
99 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
100 h += src_y & 15;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
101 src_y &= ~15;
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
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
104 // The right / bottom edge might not be a multiple of 16
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
105 h_tail = h & 15;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
106 w_tail = w & 15;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
107
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
108 // One block is 16 pixels high
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
109 h_size = 16;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
110
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
111 // descramble Y plane
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
112 for (y = 0; y < h; y += 16)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
113 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
114 // Clip if we've reached the bottom & the size isn't a multiple of 16
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
115 if (y + 16 > h) h_size = h_tail;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
116
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
117 for (x = 0; x < w; x += 16)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
118 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
119 if (x + 16 > w)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
120 w_size = w_tail;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
121 else
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
122 w_size = 16;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
123
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
124 dst_2 = dst + (720 * y) + (720 * src_y) + (256 * (src_x>>4)) + (x * 16);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
125
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
126 for (i = 0; i < h_size; i++)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
127 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
128 memcpy (dst_2, src + src_x + x + (y + i) * width + (src_y * width),
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
129 w_size);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
130 dst_2 += 16;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
131 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
132 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
133 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
134 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
135
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
136 static void de_macro_uv (unsigned char *srcu, unsigned char *srcv,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
137 unsigned char *dst, unsigned int w, unsigned int h,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
138 int src_x, int src_y, int height, int width)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
139 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
140 unsigned int x, y, i, f;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
141 unsigned char *dst_2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
142 unsigned int h_tail, w_tail;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
143 unsigned int h_size;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
144
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
145 /* The uv plane is half the size of the y plane,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
146 so 'correct' all dimensions. */
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
147 w /= 2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
148 h /= 2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
149 src_x /= 2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
150 src_y /= 2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
151 height /= 2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
152 width /= 2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
153
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
154 // Always round the origin, but compensate by increasing the size
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
155 if (src_x & 7)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
156 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
157 w += src_x & 7;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
158 src_x &= ~7;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
159 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
160
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
161 if (src_y & 15)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
162 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
163 h += src_y & 15;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
164 src_y &= ~15;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
165 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
166
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
167 // The right / bottom edge may not be a multiple of 16
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
168 h_tail = h & 15;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
169 w_tail = w & 7;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
170
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
171 h_size = 16;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
172
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
173 // descramble U/V plane
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
174 for (y = 0; y < h; y += 16)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
175 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
176 if (y + 16 > h)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
177 h_size = h_tail;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
178
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
179 for (x = 0; x < w; x += 8)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
180 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
181 dst_2 = dst + (720 * y) + (720 * src_y) + (256 * (src_x>>3)) + (x * 32);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
182 if (x + 8 <= w)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
183 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
184 for (i = 0; i < h_size; i++)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
185 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
186 int idx = src_x + x + ((y + i) * width) + (src_y * width);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
187 dst_2[0] = srcu[idx + 0];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
188 dst_2[1] = srcv[idx + 0];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
189 dst_2[2] = srcu[idx + 1];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
190 dst_2[3] = srcv[idx + 1];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
191 dst_2[4] = srcu[idx + 2];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
192 dst_2[5] = srcv[idx + 2];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
193 dst_2[6] = srcu[idx + 3];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
194 dst_2[7] = srcv[idx + 3];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
195 dst_2[8] = srcu[idx + 4];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
196 dst_2[9] = srcv[idx + 4];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
197 dst_2[10] = srcu[idx + 5];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
198 dst_2[11] = srcv[idx + 5];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
199 dst_2[12] = srcu[idx + 6];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
200 dst_2[13] = srcv[idx + 6];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
201 dst_2[14] = srcu[idx + 7];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
202 dst_2[15] = srcv[idx + 7];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
203 dst_2 += 16;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
204 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
205 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
206 else
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
207 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
208 for (i = 0; i < h_size; i ++)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
209 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
210 int idx = src_x + x + ((y + i) * width) + (src_y * width);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
211 for (f = 0; f < w_tail; f++)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
212 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
213 dst_2[0] = srcu[idx + f];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
214 dst_2[1] = srcv[idx + f];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
215 dst_2 += 2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
216 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
217
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
218 dst_2 += 16 - (w_tail << 1);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
219 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
220 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
221 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
222 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
223 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
224
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
225 static int ivtv_probe (int verbose, int force __attribute__ ((unused)))
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
226 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
227 pciinfo_t lst[MAX_PCI_DEVICES];
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
228 unsigned int i, num_pci;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
229 int err;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
230 FILE *procFb;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
231 unsigned char fb_number = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
232 unsigned char yuv_device_number, yuv_device;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
233 char yuv_device_name[] = "/dev/videoXXX\0";
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 if (verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
236 printf (IVTV_MSG"probe\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
237
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
238 ivtv_verbose = verbose;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
239
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
240 err = pci_scan (lst, &num_pci);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
241 if (err)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
242 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
243 printf (IVTV_MSG"Error occured during pci scan: %s\n", strerror (err));
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
244 return err;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
245 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
246
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
247 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
248 printf (IVTV_MSG"Found %d pci devices\n", num_pci);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
249
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
250 for (i = 0; i < num_pci; i++)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
251 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
252 if (ivtv_verbose == 2)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
253 printf (IVTV_MSG"Found chip [%04X:%04X] '%s' '%s'\n",
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
254 lst[i].vendor, lst[i].device, pci_vendor_name (lst[i].vendor),
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
255 pci_device_name(lst[i].vendor,lst[i].device));
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
256
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
257 if (VENDOR_INTERNEXT == lst[i].vendor)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
258 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
259 switch (lst[i].device)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
260 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
261 case DEVICE_INTERNEXT_ITVC15_MPEG_2_ENCODER:
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
262 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
263 printf (IVTV_MSG"Found PVR 350\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
264 goto card_found;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
265 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
266 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
267 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
268
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
269 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
270 printf (IVTV_MSG"Can't find chip\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
271
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
272 return (ENXIO);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
273
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
274 card_found:
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
275
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
276 /* Try to find framebuffer device */
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
277 procFb = fopen ("/proc/fb", "r");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
278 if (procFb)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
279 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
280 char procEntry[MAXLINE] = {0};
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
281 while (NULL != fgets(procEntry, MAXLINE, procFb))
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
282 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
283 char *pos = NULL;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
284 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
285 printf (IVTV_MSG" %s", procEntry);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
286
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
287 if (NULL != (pos = strstr(procEntry, " cx23415 TV out")))
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
288 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
289 *pos = '\0';
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
290 fb_number = atoi (procEntry);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
291 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
292 printf (IVTV_MSG"Framebuffer found #%u\n", fb_number);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
293 goto fb_found;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
294 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
295 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
296 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
297 else
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
298 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
299 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
300 printf (IVTV_MSG"Framebuffer device not found\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
301 return (ENXIO);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
302 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
303
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
304 fb_found:
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
305 fclose (procFb);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
306
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
307 /* Try to find YUV device */
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
308 yuv_device_number = 48;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
309 yuv_device = 48 + fb_number;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
310
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
311 do {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
312 sprintf (yuv_device_name, "/dev/video%u", yuv_device);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
313 yuvdev = open (yuv_device_name, O_RDWR);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
314 if (-1 != yuvdev)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
315 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
316 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
317 printf (IVTV_MSG"YUV device found /dev/video%u\n", yuv_device);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
318 goto yuv_found;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
319 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
320 else
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
321 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
322 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
323 printf (IVTV_MSG"YUV device not found: /dev/video%u\n", yuv_device);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
324 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
325 } while (yuv_device-- > yuv_device_number);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
326
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
327 return (ENXIO);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
328
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
329 yuv_found:
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
330 probed = 1;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
331 return 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
332 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
333
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
334 static int ivtv_init (void)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
335 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
336 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
337 printf (IVTV_MSG"init\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
338
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
339 if (!probed)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
340 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
341 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
342 printf (IVTV_MSG"Driver was not probed but is being initialized\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
343
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
344 return (EINTR);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
345 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
346
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
347 outbuf = malloc ((IVTVMAXHEIGHT * IVTVMAXWIDTH)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
348 + (IVTVMAXHEIGHT * IVTVMAXWIDTH / 2));
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
349
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
350 if (!outbuf)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
351 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
352 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
353 printf (IVTV_MSG"Not enough memory availabe!\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
354 return (EINTR);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
355 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
356
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
357 return 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
358 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
359
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
360 static void ivtv_destroy (void)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
361 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
362 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
363 printf (IVTV_MSG"destory\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
364 close (yuvdev);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
365 free (outbuf);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
366 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
367
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
368 static int ivtv_get_caps (vidix_capability_t *to)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
369 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
370 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
371 printf (IVTV_MSG"GetCap\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
372 memcpy (to, &ivtv_cap, sizeof (vidix_capability_t));
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
373
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
374 return 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
375 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
376
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
377 static int ivtv_query_fourcc (vidix_fourcc_t *to)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
378 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
379 int supports = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
380
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
381 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
382 printf (IVTV_MSG"query fourcc (%x)\n", to->fourcc);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
383
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
384 switch (to->fourcc)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
385 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
386 case IMGFMT_YV12:
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
387 supports = 1;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
388 break;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
389 default:
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
390 supports = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
391 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
392
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
393 if (!supports)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
394 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
395 to->depth = to->flags = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
396 return (ENOTSUP);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
397 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
398
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
399 to->depth = VID_DEPTH_12BPP |
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
400 VID_DEPTH_15BPP | VID_DEPTH_16BPP |
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
401 VID_DEPTH_24BPP | VID_DEPTH_32BPP;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
402 to->flags = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
403
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
404 return 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
405 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
406
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
407 static int ivtv_config_playback (vidix_playback_t *info)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
408 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
409 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
410 printf (IVTV_MSG"config playback\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
411
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
412 if (2 == ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
413 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
414 printf (IVTV_MSG"src : x:%d y:%d w:%d h:%d\n",
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
415 info->src.x, info->src.y, info->src.w, info->src.h);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
416 printf (IVTV_MSG"dest: x:%d y:%d w:%d h:%d\n",
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
417 info->dest.x, info->dest.y, info->dest.w, info->dest.h);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
418 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
419
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
420 memcpy (&destVideo, &info->dest, sizeof (vidix_rect_t));
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
421 memcpy (&srcVideo, &info->src, sizeof (vidix_rect_t));
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
422
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
423 info->num_frames = 2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
424 info->frame_size = frameSize =
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
425 info->src.w*info->src.h+(info->src.w*info->src.h)/2;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
426 info->dest.pitch.y = 16;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
427 info->dest.pitch.u = info->dest.pitch.v = 16;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
428 info->offsets[0] = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
429 info->offsets[1] = info->frame_size;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
430 info->offset.y = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
431 info->offset.u = IVTVMAXWIDTH * IVTVMAXHEIGHT;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
432 info->offset.v = IVTVMAXWIDTH * IVTVMAXHEIGHT
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
433 + (IVTVMAXWIDTH / 2) * (IVTVMAXHEIGHT / 2);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
434
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
435 info->dga_addr = memBase = malloc (info->num_frames*info->frame_size);
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 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
438 printf (IVTV_MSG"frame_size: %d, dga_addr: %p\n",
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
439 info->frame_size, info->dga_addr);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
440
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
441 return 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
442 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
443
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
444 static int ivtv_playback_on (void)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
445 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
446 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
447 printf (IVTV_MSG"playback on\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
448
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
449 return 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
450 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
451
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
452 static int ivtv_playback_off (void)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
453 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
454 if (ivtv_verbose)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
455 printf (IVTV_MSG"playback off\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
456
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
457 return 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
458 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
459
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
460 static int ivtv_frame_sel (unsigned int frame)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
461 {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
462 struct ivtvyuv_ioctl_dma_host_to_ivtv_args args;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
463
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
464 de_macro_y ((memBase + (frame * frameSize)),
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
465 outbuf, srcVideo.w, srcVideo.h,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
466 srcVideo.x, srcVideo.y, destVideo.h, destVideo.w);
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 de_macro_uv ((memBase + (frame * frameSize))
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
469 + (srcVideo.w * srcVideo.h) + srcVideo.w * srcVideo.h / 4,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
470 (memBase + (frame * frameSize)) + (srcVideo.w * srcVideo.h),
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
471 outbuf + IVTVMAXWIDTH * IVTVMAXHEIGHT,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
472 srcVideo.w, srcVideo.h, srcVideo.x, srcVideo.y,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
473 destVideo.h, destVideo.w);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
474
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
475 args.y_source = outbuf;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
476 args.uv_source = outbuf + (IVTVMAXWIDTH * IVTVMAXHEIGHT);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
477 args.src_x = srcVideo.x;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
478 args.src_y = srcVideo.y;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
479 args.dst_x = destVideo.x;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
480 args.dst_y = destVideo.y;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
481 args.src_w = srcVideo.w;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
482 args.dst_w = destVideo.w;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
483 args.srcBuf_width = srcVideo.w;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
484 args.src_h = srcVideo.h;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
485 args.dst_h = destVideo.h;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
486 args.srcBuf_height = srcVideo.h;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
487 args.yuv_type = 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
488
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
489 if(ioctl(yuvdev, IVTV_IOC_PREP_FRAME_YUV, &args) == -1)
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
490 printf ("Ioctl IVTV_IOC_PREP_FRAME_YUV returned failed Error\n");
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
491
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
492 return 0;
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
493 }
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
494
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
495 VDXDriver ivtv_drv = {
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
496 "ivtv",
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
497 NULL,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
498 .probe = ivtv_probe,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
499 .get_caps = ivtv_get_caps,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
500 .query_fourcc = ivtv_query_fourcc,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
501 .init = ivtv_init,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
502 .destroy = ivtv_destroy,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
503 .config_playback = ivtv_config_playback,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
504 .playback_on = ivtv_playback_on,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
505 .playback_off = ivtv_playback_off,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
506 .frame_sel = ivtv_frame_sel,
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents:
diff changeset
507 };