remove auto kfrm for gang, btn2 select kfrm pos
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / recordvideo.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 RECORDVIDEO_H
23 #define RECORDVIDEO_H
24
25 #include "condition.inc"
26 #include "file.inc"
27 #include "mutex.inc"
28 #include "mwindow.inc"
29 #include "record.inc"
30 #include "recordgui.inc"
31 #include "thread.h"
32 #include "videodevice.inc"
33
34 // Default behavior is to read frames and flash to display.
35 // Optionally writes to disk.
36
37 class RecordVideo : public Thread
38 {
39 public:
40         RecordVideo(MWindow *mwindow, Record *record);
41         ~RecordVideo();
42
43         void reset_parameters();
44         void run();
45 // Do all initialization
46         void arm_recording();
47 // Trigger the loop to start
48         void start_recording();
49         void stop_recording();
50         void pause_recording();
51         void resume_recording();
52         int flush_buffer();
53         int write_buffer();
54         void delete_buffer();
55         void config_update();
56         VFrame *get_buffer();
57         int read_buffer(VFrame *frame);
58         void decompress_buffer(VFrame *frame);
59         void wait_startup();
60
61 private:
62         MWindow *mwindow;
63         Record *record;
64         RecordGUI *gui;
65         int writing_file, buffer_frames;
66         int64_t buffer_position;   // Position in output buffer being captured
67         VFrame *buffer_frame;
68         int write_result, grab_result;
69 // Capture frame
70         VFrame ***frame_ptr;
71         long current_frame;
72 // Frame start of this recording in the file
73         long record_start;
74 // Want one thread to dictate the other during shared device recording.
75         int done, recording_paused;
76         Condition *trigger_lock;
77         Condition *pause_record_lock;
78         Condition *record_paused_lock;
79 };
80
81
82 #endif