00001 #ifndef INDEXTHREAD_H 00002 #define INDEXTHREAD_H 00003 00004 #include "asset.inc" 00005 #include "condition.inc" 00006 #include "indexfile.inc" 00007 #include "mwindow.inc" 00008 #include "thread.h" 00009 00010 #define TOTAL_BUFFERS 2 00011 00012 // Recieves buffers from Indexfile and calculates the index. 00013 00014 class IndexThread : public Thread 00015 { 00016 public: 00017 IndexThread(MWindow *mwindow, 00018 IndexFile *index_file, 00019 Asset *asset, 00020 char *index_filename, 00021 int64_t buffer_size, 00022 int64_t length_source); 00023 ~IndexThread(); 00024 00025 friend class IndexFile; 00026 00027 int start_build(); 00028 int stop_build(); 00029 void run(); 00030 00031 IndexFile *index_file; 00032 MWindow *mwindow; 00033 Asset *asset; 00034 char *index_filename; 00035 int64_t buffer_size, length_source; 00036 int current_buffer; 00037 00038 private: 00039 int interrupt_flag; 00040 double **buffer_in[TOTAL_BUFFERS]; 00041 Condition *input_lock[TOTAL_BUFFERS], *output_lock[TOTAL_BUFFERS]; 00042 int last_buffer[TOTAL_BUFFERS]; 00043 int64_t input_len[TOTAL_BUFFERS]; 00044 }; 00045 00046 00047 00048 #endif
1.4.4