Merge CV, ver=5.1; ops/methods from HV, and interface from CV where possible
[goodguy/history.git] / cinelerra-5.1 / cinelerra / vdevicev4l.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * 
20  */
21
22 #ifndef VDEVICEV4L_H
23 #define VDEVICEV4L_H
24
25 #ifdef HAVE_VIDEO4LINUX
26
27
28
29 #include "vdevicebase.h"
30 #include <linux/videodev.h>
31 #include "videodevice.inc"
32
33 class VDeviceV4L : public VDeviceBase
34 {
35 public:
36         VDeviceV4L(VideoDevice *device);
37         ~VDeviceV4L();
38
39         int initialize();
40         int open_input();
41         int close_all();
42         int read_buffer(VFrame *frame);
43         int get_best_colormodel(Asset *asset);
44         int set_channel(Channel *channel);
45         int set_picture(PictureConfig *picture);
46
47 private:
48         int set_cloexec_flag(int desc, int value);
49         int set_mute(int muted);
50         int v4l1_get_inputs();
51         int v4l1_set_mute(int muted);
52         unsigned long translate_colormodel(int colormodel);
53         int v4l1_set_channel(Channel *channel);
54         int v4l1_get_norm(int norm);
55         int v4l1_set_picture(PictureConfig *picture);
56         void v4l1_start_capture();
57         int capture_frame(int capture_frame_number);
58         int wait_v4l_frame();
59         int read_v4l_frame(VFrame *frame);
60         int frame_to_vframe(VFrame *frame, unsigned char *input);
61         int next_frame(int previous_frame);
62         int close_v4l();
63         int unmap_v4l_shmem();
64         int v4l_init();
65
66         int input_fd, output_fd;
67 // FourCC Colormodel for device
68         unsigned long device_colormodel;
69 // BC colormodel for device
70         int colormodel;
71
72 // Video4Linux
73         struct video_capability cap1;
74         struct video_window window_params;
75         struct video_picture picture_params;
76         struct video_mbuf capture_params;  // Capture for Video4Linux
77
78 // Common
79         char *capture_buffer;      // sequentual capture buffers for v4l1 or read buffer for v4l2
80         int capture_frame_number;    // number of frame to capture into
81         int read_frame_number;       // number of the captured frame to read
82         int shared_memory;   // Capturing directly to memory
83         int initialization_complete;
84         int got_first_frame;
85 };
86
87
88 #endif // HAVE_VIDEO4LINUX
89
90
91 #endif
92
93
94