r870: Merge 2.1:
[cinelerra_cv.git] / cinelerra / recordvideo.h
blob214ad9f5ff930255e7eb8c9bfa37a6bed25b7746
1 #ifndef RECORDVIDEO_H
2 #define RECORDVIDEO_H
4 #include "condition.inc"
5 #include "file.inc"
6 #include "mutex.inc"
7 #include "mwindow.inc"
8 #include "record.inc"
9 #include "recordgui.inc"
10 #include "thread.h"
11 #include "videodevice.inc"
13 // Default behavior is to read frames and flash to display.
14 // Optionally writes to disk.
16 class RecordVideo : public Thread
18 public:
19 RecordVideo(MWindow *mwindow,
20 Record *record,
21 RecordThread *record_thread);
22 ~RecordVideo();
24 void reset_parameters();
25 void run();
26 // Do all initialization
27 int arm_recording();
28 // Trigger the loop to start
29 void start_recording();
30 int stop_recording();
31 int pause_recording();
32 int resume_recording();
33 int wait_for_completion(); // For recording to a file.
34 int set_parameters(File *file,
35 RecordGUI *gui,
36 int buffer_size, // number of frames to write to disk at a time
37 int realtime,
38 int frames);
39 void write_buffer(int skip_new = 0);
40 void start_file_thread();
41 int unhang_thread();
42 void rewind_file();
43 void finish_timed();
44 void finish_loop();
45 void get_capture_frame();
46 void read_buffer();
48 MWindow *mwindow;
49 Record *record;
51 RecordThread *record_thread;
52 RecordGUI *gui;
53 int single_frame;
54 int buffer_size; // number of frames to write to disk at a time
55 int64_t buffer_position; // Position in output buffer being captured to
56 VFrame *capture_frame; // Output frame for preview mode
57 Timer delayer;
58 // result of every disk write
59 int write_result;
60 // result of every frame grab
61 int grab_result;
62 // Capture frame
63 VFrame ***frame_ptr;
64 int64_t current_sample; // Sample in time of the start of the capture
65 int64_t next_sample; // Sample of next frame
66 int64_t total_dropped_frames; // Total number of frames behind
67 int64_t dropped_frames; // Number of frames currently behind
68 int64_t last_dropped_frames; // Number of dropped frames during the last calculation
69 int64_t delay;
70 // Frame start of this recording in the file
71 int64_t record_start;
72 // Want one thread to dictate the other during shared device recording.
73 // Done with batch
74 int batch_done;
77 int is_recording;
78 int is_paused;
79 Mutex *unhang_lock;
80 Condition *trigger_lock;
81 private:
82 int cleanup_recording();
86 #endif