Mercurial > vloopback
annotate example/feed.c @ 7:2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
| author | AngelCarpintero |
|---|---|
| date | Sun, 24 Aug 2008 02:20:51 +0000 |
| parents | 5f21a4dddc0c |
| children |
| rev | line source |
|---|---|
| 0 | 1 /* feed.c |
| 2 * | |
| 3 * Example program for videoloopback device. | |
| 4 * Copyright 2006 by Angel Carpintero (ack@telefonica.net) | |
| 5 * This software is distributed under the GNU public license version 2 | |
| 6 * See also the file 'COPYING'. | |
| 7 * | |
| 8 */ | |
| 9 | |
| 10 #include <unistd.h> | |
| 11 #include <stdlib.h> | |
| 12 #include <stdio.h> | |
| 13 #include <fcntl.h> | |
| 14 #include <string.h> | |
| 15 #include <errno.h> | |
| 16 #include <sys/ioctl.h> | |
| 17 #include <sys/mman.h> | |
| 18 #include <signal.h> | |
| 19 #include <sys/wait.h> | |
| 20 #include <linux/videodev.h> | |
| 21 | |
| 22 | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
23 int fmt = 0; |
| 0 | 24 int noexit = 1; |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
25 int read_img = 0; |
| 0 | 26 |
| 27 char *start_capture (int dev, int width, int height) | |
| 28 { | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
29 struct video_capability vid_caps; |
| 0 | 30 struct video_window vid_win; |
| 31 struct video_mbuf vid_buf; | |
| 32 char *map; | |
| 33 | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
34 if (ioctl(dev, VIDIOCGCAP, &vid_caps) == -1) { |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
35 printf ("ioctl (VIDIOCGCAP)\nError[%s]\n", strerror(errno)); |
| 0 | 36 return (NULL); |
| 37 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
38 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
39 if (vid_caps.type & VID_TYPE_MONOCHROME) |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
40 fmt=VIDEO_PALETTE_GREY; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
41 |
| 0 | 42 if (ioctl (dev, VIDIOCGMBUF, &vid_buf) == -1) { |
| 43 fprintf(stderr, "no mmap falling back on read\n"); | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
44 |
| 0 | 45 if (ioctl (dev, VIDIOCGWIN, &vid_win)== -1) { |
| 46 printf ("ioctl VIDIOCGWIN\nError[%s]\n",strerror(errno)); | |
| 47 return (NULL); | |
| 48 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
49 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
50 vid_win.width = width; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
51 vid_win.height = height; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
52 |
| 0 | 53 if (ioctl (dev, VIDIOCSWIN, &vid_win)== -1) { |
| 54 printf ("ioctl VIDIOCSWIN\nError[%s]\n",strerror(errno)); | |
| 55 return (NULL); | |
| 56 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
57 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
58 read_img = 1; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
59 map = malloc(width * height * 3); |
| 0 | 60 return (map); |
| 61 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
62 |
| 0 | 63 /* If we are going to capture greyscale we need room to blow the image up */ |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
64 if (fmt == VIDEO_PALETTE_GREY) |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
65 map = mmap(0, vid_buf.size * 3, PROT_READ|PROT_WRITE, MAP_SHARED, dev, 0); |
| 0 | 66 else |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
67 map = mmap(0, vid_buf.size, PROT_READ|PROT_WRITE, MAP_SHARED, dev, 0); |
| 0 | 68 |
| 69 if ((unsigned char *)-1 == (unsigned char *)map) | |
| 70 return (NULL); | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
71 |
| 0 | 72 return map; |
| 73 } | |
| 74 | |
| 75 int start_pipe (int dev, int width, int height) | |
| 76 { | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
77 struct video_capability vid_caps; |
| 0 | 78 struct video_window vid_win; |
| 79 struct video_picture vid_pic; | |
| 80 | |
| 81 if (ioctl (dev, VIDIOCGCAP, &vid_caps) == -1) { | |
| 82 printf ("ioctl (VIDIOCGCAP)\nError[%s]\n",strerror(errno)); | |
| 83 return (1); | |
| 84 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
85 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
86 if (ioctl(dev, VIDIOCGPICT, &vid_pic) == -1) { |
| 0 | 87 printf ("ioctl VIDIOCGPICT\nError[%s]\n",strerror(errno)); |
| 88 return (1); | |
| 89 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
90 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
91 vid_pic.palette = fmt; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
92 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
93 if (ioctl (dev, VIDIOCSPICT, &vid_pic) == -1) { |
| 0 | 94 printf ("ioctl VIDIOCSPICT\nError[%s]\n",strerror(errno)); |
| 95 return (1); | |
| 96 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
97 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
98 if (ioctl (dev, VIDIOCGWIN, &vid_win) == -1) { |
| 0 | 99 printf ("ioctl VIDIOCGWIN"); |
| 100 return (1); | |
| 101 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
102 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
103 vid_win.width = width; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
104 vid_win.height = height; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
105 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
106 if (ioctl (dev, VIDIOCSWIN, &vid_win) == -1) { |
| 0 | 107 printf ("ioctl VIDIOCSWIN"); |
| 108 return (1); | |
| 109 } | |
| 110 return 0; | |
| 111 } | |
| 112 | |
| 113 char *next_capture (int dev, char *map, int width, int height) | |
| 114 { | |
| 115 int i; | |
| 116 char *grey, *rgb; | |
| 117 struct video_mmap vid_mmap; | |
| 118 | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
119 sigset_t set, old; |
| 0 | 120 |
| 121 if (read_img) { | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
122 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
123 if (fmt == VIDEO_PALETTE_GREY) { |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
124 size_t size = width * height; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
125 if (read(dev, map, size) != size) |
| 0 | 126 return NULL; |
| 127 } else { | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
128 size_t size = width * height * 3; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
129 if (read(dev, map, size) != size) |
| 0 | 130 return NULL; |
| 131 } | |
| 132 } else { | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
133 vid_mmap.format = fmt; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
134 vid_mmap.frame = 0; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
135 vid_mmap.width = width; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
136 vid_mmap.height = height; |
| 0 | 137 |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
138 sigemptyset (&set); //BTTV hates signals during IOCTL |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
139 sigaddset (&set, SIGCHLD); //block SIGCHLD & SIGALRM |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
140 sigaddset (&set, SIGALRM); //for the time of ioctls |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
141 sigprocmask (SIG_BLOCK, &set, &old); |
| 0 | 142 |
| 143 if (ioctl(dev, VIDIOCMCAPTURE, &vid_mmap) == -1) { | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
144 sigprocmask (SIG_UNBLOCK, &old, NULL); |
| 0 | 145 return (NULL); |
| 146 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
147 |
| 0 | 148 if (ioctl(dev, VIDIOCSYNC, &vid_mmap) == -1) { |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
149 sigprocmask (SIG_UNBLOCK, &old, NULL); |
| 0 | 150 return (NULL); |
| 151 } | |
| 152 | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
153 sigprocmask(SIG_UNBLOCK, &old, NULL); //undo the signal blocking |
| 0 | 154 } |
| 155 /* Blow up a grey */ | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
156 if (fmt == VIDEO_PALETTE_GREY) { |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
157 i= width * height; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
158 grey=map + i - 1; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
159 rgb=map + i * 3; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
160 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
161 for (; i >= 0; i--, grey--) { |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
162 *(rgb--) =*grey; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
163 *(rgb--) =*grey; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
164 *(rgb--) =*grey; |
| 0 | 165 } |
| 166 } | |
| 167 return map; | |
| 168 } | |
| 169 | |
| 170 int put_image(int dev, char *image, int width, int height) | |
| 171 { | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
172 size_t size = width * height * 3; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
173 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
174 if (write(dev, image, size) != size) { |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
175 printf("Error writing image to pipe!\nError[%s]\n", strerror(errno)); |
| 0 | 176 return 0; |
| 177 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
178 |
| 0 | 179 return 1; |
| 180 } | |
| 181 | |
| 182 void sig_handler(int signo) | |
| 183 { | |
| 184 noexit = 0; | |
| 185 } | |
| 186 | |
| 187 | |
| 188 int main (int argc, char **argv) | |
| 189 { | |
| 190 int devin, devout; | |
| 191 int width; | |
| 192 int height; | |
| 193 char *image_new; | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
194 char palette[10] = {'\0'}; |
| 0 | 195 |
| 196 if (argc != 5) { | |
| 197 printf("Usage:\n\n"); | |
| 198 printf("feed input output widthxheight(in) rgb24|yuv420p\n\n"); | |
| 199 printf("example: feed /dev/video0 /dev/video1 352x288 yuv420p\n\n"); | |
| 200 exit(1); | |
| 201 } | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
202 |
| 0 | 203 sscanf(argv[3], "%dx%d", &width, &height); |
| 204 sscanf(argv[4], "%s", palette); | |
| 205 | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
206 if (!strcmp(palette,"rgb24")) |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
207 fmt = VIDEO_PALETTE_RGB24; |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
208 else if (!strcmp(palette,"yuv420p")) |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
209 fmt = VIDEO_PALETTE_YUV420P; |
| 0 | 210 else fmt = VIDEO_PALETTE_RGB24; |
| 211 | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
212 devin = open (argv[1], O_RDWR); |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
213 |
| 0 | 214 if (devin < 0) { |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
215 printf ("Failed to open video device %s\nError[%s]\n", argv[1], strerror(errno)); |
| 0 | 216 exit(1); |
| 217 } | |
| 218 | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
219 devout = open (argv[2], O_RDWR); |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
220 |
| 0 | 221 if (devout < 0) { |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
222 printf ("Failed to open video device%s \nError[%s]\n", argv[2], strerror(errno)); |
| 0 | 223 exit(1); |
| 224 } | |
| 225 | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
226 image_new = start_capture(devin, width, height); |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
227 |
| 0 | 228 if (!image_new) { |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
229 printf("Capture error\nError[%s]\n", strerror(errno)); |
| 0 | 230 exit(1); |
| 231 } | |
| 232 | |
| 233 start_pipe(devout, width, height); | |
| 234 | |
| 235 signal(SIGTERM, sig_handler); | |
| 236 | |
| 237 printf("Starting video stream.\n"); | |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
238 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
239 while ((next_capture(devin, image_new, width, height)) && (noexit)) { |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
240 if (put_image(devout, image_new, width, height) == 0) |
| 0 | 241 exit(1); |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
242 |
| 0 | 243 } |
|
7
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
244 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
245 printf("You bought vaporware!\nError[%s]\n", strerror(errno)); |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
246 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
247 close(devin); |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
248 close(devout); |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
249 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
250 if ((read_img) && (image_new)) |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
251 free(image_new); |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
252 else if (fmt == VIDEO_PALETTE_GREY) |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
253 munmap(image_new, width * height * 3); |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
254 else |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
255 munmap(image_new, width * height); |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
256 |
|
2fce9e157b8d
Added some work around to work with kernel 2.6.27-rc3, added debug param.
AngelCarpintero
parents:
0
diff
changeset
|
257 |
| 0 | 258 exit(0); |
| 259 } |
