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