]> gitweb @ CieloNegro.org - pkgsrc-cinelerra-cv.git/blob - patches/patch-vdevicev4l_C
wip...
[pkgsrc-cinelerra-cv.git] / patches / patch-vdevicev4l_C
1 $NetBSD$
2
3 --- cinelerra/vdevicev4l.C.orig 2010-01-29 08:22:11.000000000 +0000
4 +++ cinelerra/vdevicev4l.C
5 @@ -25,6 +25,7 @@
6  #undef _LARGEFILE_SOURCE
7  #undef _LARGEFILE64_SOURCE
8  
9 +#include "config.h"
10  
11  #include "assets.h"
12  #include "bcsignals.h"
13 @@ -108,6 +109,7 @@ int VDeviceV4L::close_v4l()
14  
15  int VDeviceV4L::unmap_v4l_shmem()
16  {
17 +#if defined(HAVE_LINUX_VIDEODEV_H)
18         if(capture_buffer)
19         {
20                 if(shared_memory)
21 @@ -116,9 +118,11 @@ int VDeviceV4L::unmap_v4l_shmem()
22                         delete capture_buffer;
23                 capture_buffer = 0;
24         }
25 +#endif
26         return 0;
27  }
28  
29 +#if defined(HAVE_LINUX_VIDEODEV_H)
30  int VDeviceV4L::v4l_init()
31  {
32         int i;
33 @@ -179,11 +183,20 @@ int VDeviceV4L::v4l_init()
34         got_first_frame = 0;
35         return 0;
36  }
37 +#else
38 +int VDeviceV4L::v4l_init() {
39 +    fprintf(stderr, "VDeviceV4L::v4l_init (Warning: unavailble feature on this platform)\n");
40 +    input_fd = 0;
41 +    return 0;
42 +}
43 +#endif
44  
45  void VDeviceV4L::v4l1_start_capture()
46  {
47 +#if defined(HAVE_LINUX_VIDEODEV_H)
48         for(int i = 0; i < MIN(capture_params.frames, device->in_config->capture_length); i++)
49                 capture_frame(i);
50 +#endif
51  }
52  
53  
54 @@ -195,6 +208,7 @@ void VDeviceV4L::v4l1_start_capture()
55  
56  int VDeviceV4L::v4l1_get_inputs()
57  {
58 +#if defined(HAVE_LINUX_VIDEODEV_H)
59         struct video_channel channel_struct;
60         int i = 0, done = 0;
61         char *new_source;
62 @@ -215,6 +229,7 @@ int VDeviceV4L::v4l1_get_inputs()
63                 }
64                 i++;
65         }
66 +#endif
67         return 0;
68  }
69  
70 @@ -227,6 +242,7 @@ int VDeviceV4L::set_mute(int muted)
71  
72  int VDeviceV4L::v4l1_set_mute(int muted)
73  {
74 +#if defined(HAVE_LINUX_VIDEODEV_H)
75         struct video_audio audio;
76  
77      if(ioctl(input_fd, VIDIOCGAUDIO, &audio))
78 @@ -244,6 +260,7 @@ int VDeviceV4L::v4l1_set_mute(int muted)
79      if(ioctl(input_fd, VIDIOCSAUDIO, &audio) < 0)
80                 perror("VDeviceV4L::ioctl VIDIOCSAUDIO");
81         return 0;
82 +#endif
83  }
84  
85  
86 @@ -288,6 +305,7 @@ int VDeviceV4L::get_best_colormodel(Asse
87         return result;
88  }
89  
90 +#if defined(HAVE_LINUX_VIDEODEV_H)
91  unsigned long VDeviceV4L::translate_colormodel(int colormodel)
92  {
93         unsigned long result = 0;
94 @@ -303,12 +321,18 @@ unsigned long VDeviceV4L::translate_colo
95  //printf("VDeviceV4L::translate_colormodel %d\n", result);
96         return result;
97  }
98 +#else
99 +unsigned long VDeviceV4L::translate_colormodel(int) {
100 +    return 0;
101 +}
102 +#endif
103  
104  int VDeviceV4L::set_channel(Channel *channel)
105  {
106         return v4l1_set_channel(channel);
107  }
108  
109 +#if defined(HAVE_LINUX_VIDEODEV_H)
110  int VDeviceV4L::v4l1_set_channel(Channel *channel)
111  {
112         struct video_channel channel_struct;
113 @@ -352,7 +376,13 @@ int VDeviceV4L::v4l1_set_channel(Channel
114  //     set_mute(0);
115         return 0;
116  }
117 +#else
118 +int VDeviceV4L::v4l1_set_channel(Channel*) {
119 +    return 0;
120 +}
121 +#endif
122  
123 +#if defined(HAVE_LINUX_VIDEODEV_H)
124  int VDeviceV4L::v4l1_get_norm(int norm)
125  {
126         switch(norm)
127 @@ -363,13 +393,18 @@ int VDeviceV4L::v4l1_get_norm(int norm)
128         }
129         return 0;
130  }
131 +#else
132 +int VDeviceV4L::v4l1_get_norm(int) {
133 +    return 0;
134 +}
135 +#endif
136  
137  int VDeviceV4L::set_picture(PictureConfig *picture)
138  {
139         v4l1_set_picture(picture);
140  }
141  
142 -
143 +#if defined(HAVE_LINUX_VIDEODEV_H)
144  int VDeviceV4L::v4l1_set_picture(PictureConfig *picture)
145  {
146         int brightness = (int)((float)picture->brightness / 100 * 32767 + 32768);
147 @@ -394,8 +429,13 @@ int VDeviceV4L::v4l1_set_picture(Picture
148                 perror("VDeviceV4L::v4l1_set_picture VIDIOCGPICT");
149         return 0;
150  }
151 +#else
152 +int VDeviceV4L::v4l1_set_picture(PictureConfig*) {
153 +    return 0;
154 +}
155 +#endif
156  
157 -
158 +#if defined(HAVE_LINUX_VIDEODEV_H)
159  int VDeviceV4L::capture_frame(int capture_frame_number)
160  {
161         struct video_mmap params;
162 @@ -409,7 +449,13 @@ int VDeviceV4L::capture_frame(int captur
163                 perror("VDeviceV4L::capture_frame VIDIOCMCAPTURE");
164         return 0;
165  }
166 +#else
167 +int VDeviceV4L::capture_frame(int) {
168 +    return 0;
169 +}
170 +#endif
171  
172 +#if defined(HAVE_LINUX_VIDEODEV_H)
173  int VDeviceV4L::wait_v4l_frame()
174  {
175  //printf("VDeviceV4L::wait_v4l_frame 1 %d\n", capture_frame_number);
176 @@ -418,17 +464,29 @@ int VDeviceV4L::wait_v4l_frame()
177  //printf("VDeviceV4L::wait_v4l_frame 2 %d\n", capture_frame_number);
178         return 0;
179  }
180 +#else
181 +int VDeviceV4L::wait_v4l_frame() {
182 +    return 0;
183 +}
184 +#endif
185  
186 +#if defined(HAVE_LINUX_VIDEODEV_H)
187  int VDeviceV4L::read_v4l_frame(VFrame *frame)
188  {
189         frame_to_vframe(frame, (unsigned char*)capture_buffer + capture_params.offsets[capture_frame_number]);
190         return 0;
191  }
192 +#else
193 +int VDeviceV4L::read_v4l_frame(VFrame *) {
194 +    return 0;
195 +}
196 +#endif
197  
198  #ifndef MIN
199  #define MIN(x, y) ((x) < (y) ? (x) : (y))
200  #endif
201  
202 +#if defined(HAVE_LINUX_VIDEODEV_H)
203  int VDeviceV4L::frame_to_vframe(VFrame *frame, unsigned char *input)
204  {
205         int inwidth, inheight;
206 @@ -525,9 +583,13 @@ int VDeviceV4L::frame_to_vframe(VFrame *
207         }
208         return 0;
209  }
210 +#else
211 +int VDeviceV4L::frame_to_vframe(VFrame *, unsigned char *) {
212 +    return 0;
213 +}
214 +#endif
215  
216 -
217 -
218 +#if defined(HAVE_LINUX_VIDEODEV_H)
219  int VDeviceV4L::next_frame(int previous_frame)
220  {
221         int result = previous_frame + 1;
222 @@ -535,7 +597,13 @@ int VDeviceV4L::next_frame(int previous_
223         if(result >= MIN(capture_params.frames, device->in_config->capture_length)) result = 0;
224         return result;
225  }
226 +#else
227 +int VDeviceV4L::next_frame(int) {
228 +    return 0;
229 +}
230 +#endif
231  
232 +#if defined(HAVE_LINUX_VIDEODEV_H)
233  int VDeviceV4L::read_buffer(VFrame *frame)
234  {
235         int result = 0;
236 @@ -561,7 +629,11 @@ SET_TRACE
237  
238         return 0;
239  }
240 -
241 +#else
242 +int VDeviceV4L::read_buffer(VFrame *) {
243 +    return 0;
244 +}
245 +#endif
246  
247  
248