update ffmpeg to 4.1, add sketcher plugin, crikey tweaks, titler colorpicker, keyfram...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / devicev4l2input.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 DEVICEV4L2INPUT_H
23 #define DEVICEV4L2INPUT_H
24
25 #ifdef HAVE_VIDEO4LINUX2
26
27 #include "devicev4l2base.h"
28 #include "devicev4l2input.inc"
29 #include "devicempeginput.h"
30 #include "condition.h"
31 #include "audiodevice.h"
32 #include "videodevice.h"
33
34 #include <stdint.h>
35 #include "thread.h"
36 #include "libzmpeg3.h"
37
38 // stubs
39 class VDeviceV4L2;
40 class AudioV4L2;
41
42 class DeviceV4L2Status : public Thread
43 {
44         int done;
45         DeviceV4L2Input *in_v4l2;
46 public:
47         DeviceV4L2Status(DeviceV4L2Input *in_v4l2);
48         ~DeviceV4L2Status();
49         void run();
50 };
51
52 class DeviceV4L2Input : public DeviceV4L2Base, public DeviceMPEGInput
53 {
54         friend class DeviceV4L2Status;
55         DeviceV4L2Status *status_v4l2;
56         Channel *device_channel;
57 public:
58         DeviceV4L2Input(const char *name, int no);
59         static DeviceMPEGInput *NewV4L2Input(const char *name, int no);
60         ~DeviceV4L2Input();
61
62         static DeviceMPEGInput* get_mpeg_input(VideoDevice *device);
63         static DeviceMPEGInput* get_mpeg_input(AudioDevice *device);
64         void put_v4l2_video() { put_mpeg_video(); }
65         void put_v4l2_audio() { put_mpeg_audio(); }
66
67         int mpeg_fd();
68         int open_dev(int color_model);
69         void close_dev();
70         int status_dev();
71         int start_dev();
72         int stop_dev();
73
74         VideoDevice *v4l2_device();
75
76         VDeviceV4L2 *v4l2_video() {
77                 return video_device ? (VDeviceV4L2 *)video_device->input_base : 0;
78         }
79         AudioV4L2 *v4l2_audio() {
80                 return audio_device ? (AudioV4L2 *)audio_device->lowlevel_in : 0;
81         }
82 };
83
84 #endif
85 #endif