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