00001 #ifndef RECORDTHREAD_H 00002 #define RECORDTHREAD_H 00003 00004 #include "condition.inc" 00005 #include "drivesync.inc" 00006 #include "file.inc" 00007 #include "mutex.inc" 00008 #include "record.inc" 00009 #include "recordaudio.inc" 00010 #include "recordvideo.inc" 00011 #include "thread.h" 00012 #include "bctimer.inc" 00013 00014 // Synchronously handle recording and monitoring 00015 00016 class RecordThread : public Thread 00017 { 00018 public: 00019 RecordThread(MWindow *mwindow, Record *record); 00020 ~RecordThread(); 00021 00022 int create_objects(); 00023 int start_recording(int monitor, int context); 00024 int stop_recording(int resume_monitor); 00025 int pause_recording(); 00026 int resume_recording(); 00027 int64_t sync_position(); 00028 void do_cron(); 00029 00030 void run(); 00031 00032 int quit_when_completed; 00033 RecordAudio *record_audio; 00034 RecordVideo *record_video; 00035 // Whether to write data to disk 00036 int monitor; 00037 // Whether to open audio device or record single frame 00038 int single_frame; 00039 // CONTEXT_INTERACTIVE, CONTEXT_BATCH, CONTEXT_SINGLEFRAME 00040 int context; 00041 Timer *record_timer; 00042 int engine_done; 00043 int resume_monitor; 00044 // Cron behavior 00045 double last_seconds; 00046 int last_day; 00047 00048 private: 00049 MWindow *mwindow; 00050 Record *record; 00051 File *file; 00052 Condition *pause_lock, *startup_lock, *loop_lock; 00053 // Lock termination variables to positions where batches aren't being started. 00054 Mutex *state_lock; 00055 // Override the operating system 00056 DriveSync *drivesync; 00057 }; 00058 00059 00060 #endif
1.4.4