00001 #ifndef RECORDVIDEO_H 00002 #define RECORDVIDEO_H 00003 00004 #include "condition.inc" 00005 #include "file.inc" 00006 #include "mutex.inc" 00007 #include "mwindow.inc" 00008 #include "record.inc" 00009 #include "recordgui.inc" 00010 #include "thread.h" 00011 #include "videodevice.inc" 00012 00013 // Default behavior is to read frames and flash to display. 00014 // Optionally writes to disk. 00015 00016 class RecordVideo : public Thread 00017 { 00018 public: 00019 RecordVideo(MWindow *mwindow, 00020 Record *record, 00021 RecordThread *record_thread); 00022 ~RecordVideo(); 00023 00024 void reset_parameters(); 00025 void run(); 00026 // Do all initialization 00027 int arm_recording(); 00028 // Trigger the loop to start 00029 void start_recording(); 00030 int stop_recording(); 00031 int pause_recording(); 00032 int resume_recording(); 00033 int wait_for_completion(); // For recording to a file. 00034 int set_parameters(File *file, 00035 RecordGUI *gui, 00036 int buffer_size, // number of frames to write to disk at a time 00037 int realtime, 00038 int frames); 00039 void write_buffer(int skip_new = 0); 00040 void start_file_thread(); 00041 int unhang_thread(); 00042 void rewind_file(); 00043 void finish_timed(); 00044 void finish_loop(); 00045 void get_capture_frame(); 00046 void read_buffer(); 00047 00048 MWindow *mwindow; 00049 Record *record; 00050 00051 RecordThread *record_thread; 00052 RecordGUI *gui; 00053 int single_frame; 00054 int buffer_size; // number of frames to write to disk at a time 00055 int64_t buffer_position; // Position in output buffer being captured to 00056 VFrame *capture_frame; // Output frame for preview mode 00057 Timer delayer; 00058 // result of every disk write 00059 int write_result; 00060 // result of every frame grab 00061 int grab_result; 00062 // Capture frame 00063 VFrame ***frame_ptr; 00064 int64_t current_sample; // Sample in time of the start of the capture 00065 int64_t next_sample; // Sample of next frame 00066 int64_t total_dropped_frames; // Total number of frames behind 00067 int64_t dropped_frames; // Number of frames currently behind 00068 int64_t last_dropped_frames; // Number of dropped frames during the last calculation 00069 int64_t delay; 00070 // Frame start of this recording in the file 00071 int64_t record_start; 00072 // Want one thread to dictate the other during shared device recording. 00073 // Done with batch 00074 int batch_done; 00075 00076 00077 int is_recording; 00078 int is_paused; 00079 Mutex *unhang_lock; 00080 Condition *trigger_lock; 00081 private: 00082 int cleanup_recording(); 00083 }; 00084 00085 00086 #endif
1.5.5