00001 #ifndef FILETHREAD_H 00002 #define FILETHREAD_H 00003 00004 #include "condition.inc" 00005 #include "file.inc" 00006 #include "mutex.inc" 00007 #include "thread.h" 00008 #include "vframe.inc" 00009 00010 00011 class FileThread : public Thread 00012 { 00013 public: 00014 FileThread(File *file, int do_audio, int do_video); 00015 ~FileThread(); 00016 00017 void create_objects(File *file, 00018 int do_audio, 00019 int do_video); 00020 void delete_objects(); 00021 void reset(); 00022 int start_writing(); 00023 // Allocate the buffers and start loop. 00024 // compressed - if 1 write_compressed_frames is called in the file 00025 // - if 0 write_frames is called 00026 int start_writing(long buffer_size, 00027 int color_model, 00028 int ring_buffers, 00029 int compressed); 00030 int stop_writing(); 00031 // write data into next available buffer 00032 int write_buffer(long size); 00033 // get pointer to next buffer to be written and lock it 00034 double** get_audio_buffer(); 00035 // get pointer to next frame to be written and lock it 00036 VFrame*** get_video_buffer(); 00037 00038 void run(); 00039 int swap_buffer(); 00040 00041 double ***audio_buffer; 00042 // (VFrame*)(VFrame array *)(Track *)[ring buffer] 00043 VFrame ****video_buffer; 00044 long *output_size; // Number of frames or samples to write 00045 // Not used 00046 int *is_compressed; // Whether to use the compressed data in the frame 00047 Condition **output_lock, **input_lock; 00048 // Lock access to the file to allow it to be changed without stopping the loop 00049 Mutex *file_lock; 00050 int current_buffer; 00051 int local_buffer; 00052 int *last_buffer; // last_buffer[ring buffer] 00053 int return_value; 00054 int do_audio; 00055 int do_video; 00056 File *file; 00057 int ring_buffers; 00058 int buffer_size; // Frames or samples per ring buffer 00059 // Color model of frames 00060 int color_model; 00061 // Whether to use the compressed data in the frame 00062 int compressed; 00063 }; 00064 00065 00066 00067 #endif
1.4.4