00001 #ifndef PLAYBACKENGINE_H 00002 #define PLAYBACKENGINE_H 00003 00004 #include "arraylist.h" 00005 #include "audiodevice.inc" 00006 #include "cache.inc" 00007 #include "canvas.inc" 00008 #include "channeldb.inc" 00009 #include "condition.inc" 00010 #include "bchash.inc" 00011 #include "edl.inc" 00012 #include "mwindow.inc" 00013 #include "maxchannels.h" 00014 #include "mutex.inc" 00015 #include "tracking.inc" 00016 #include "preferences.inc" 00017 #include "renderengine.inc" 00018 #include "thread.h" 00019 #include "bctimer.h" 00020 #include "transportque.inc" 00021 00022 class PlaybackEngine : public Thread 00023 { 00024 public: 00025 PlaybackEngine(MWindow *mwindow, Canvas *output); 00026 virtual ~PlaybackEngine(); 00027 00028 int create_objects(); 00029 virtual int create_render_engine(); 00030 void delete_render_engine(); 00031 void arm_render_engine(); 00032 void start_render_engine(); 00033 void wait_render_engine(); 00034 void create_cache(); 00035 void perform_change(); 00036 void sync_parameters(EDL *edl); 00037 // Set wait_tracking for events that change the cursor location but 00038 // be sure to unlock the windows 00039 void interrupt_playback(int wait_tracking = 0); 00040 // Get levels for tracking. Return 0 if no audio. 00041 int get_output_levels(double *levels, long position); 00042 int get_module_levels(ArrayList<double> *module_levels, long position); 00043 // The MWindow starts the playback cursor loop 00044 // The other windows start a slider loop 00045 // For pausing only the cursor is run 00046 virtual void init_cursor(); 00047 virtual void stop_cursor(); 00048 virtual int brender_available(long position); 00049 // For normal playback tracking and the cursor are started 00050 virtual void init_tracking(); 00051 virtual void stop_tracking(); 00052 // The playback cursor calls this to calculate the current tracking position 00053 virtual double get_tracking_position(); 00054 // Reset the transport after completion 00055 virtual void update_transport(int command, int paused); 00056 // The render engines call this to update tracking variables in the playback engine. 00057 void update_tracking(double position); 00058 // Get the output channel table for the current device or 0 if none exists. 00059 ChannelDB* get_channeldb(); 00060 00061 void run(); 00062 00063 // Maintain caches through console changes 00064 CICache *audio_cache, *video_cache; 00065 // Maintain playback cursor on GUI 00066 int tracking_active; 00067 // Tracking variables updated by render engines 00068 double tracking_position; 00069 // Not accurate until the first update_tracking, at which time 00070 // tracking_active is incremented to 2. 00071 Timer tracking_timer; 00072 // Lock access to tracking data 00073 Mutex *tracking_lock; 00074 // Block returns until tracking loop is finished 00075 Condition *tracking_done; 00076 // Pause the main loop for the PAUSE command 00077 Condition *pause_lock; 00078 // Wait until thread has started 00079 Condition *start_lock; 00080 00081 MWindow *mwindow; 00082 Canvas *output; 00083 // Copy of main preferences 00084 Preferences *preferences; 00085 // Next command 00086 TransportQue *que; 00087 // Currently executing command 00088 TransportCommand *command; 00089 // Last command which affected transport 00090 int last_command; 00091 int done; 00092 int do_cwindow; 00093 // Render engine 00094 RenderEngine *render_engine; 00095 00096 // Used by label commands to get current position 00097 int is_playing_back; 00098 00099 // General purpose debugging register 00100 int debug; 00101 }; 00102 00103 00104 00105 00106 00107 #endif
1.5.5