r793: Small API addon, so plugins can 'see' camera and projector automation
[cinelerra_cv/mob.git] / cinelerra / playbackengine.h
blob85212f2c3506f90d0cbd5fd7e3e8267b59c7cd2c
1 #ifndef PLAYBACKENGINE_H
2 #define PLAYBACKENGINE_H
4 #include "arraylist.h"
5 #include "audiodevice.inc"
6 #include "cache.inc"
7 #include "canvas.inc"
8 #include "channeldb.inc"
9 #include "condition.inc"
10 #include "defaults.inc"
11 #include "edl.inc"
12 #include "mwindow.inc"
13 #include "maxchannels.h"
14 #include "mutex.inc"
15 #include "tracking.inc"
16 #include "preferences.inc"
17 #include "renderengine.inc"
18 #include "thread.h"
19 #include "bctimer.h"
20 #include "transportque.inc"
21 #include "videodevice.inc"
23 class PlaybackEngine : public Thread
25 public:
26 PlaybackEngine(MWindow *mwindow, Canvas *output);
27 virtual ~PlaybackEngine();
29 int create_objects();
30 virtual int create_render_engine();
31 void delete_render_engine();
32 void arm_render_engine();
33 void start_render_engine();
34 void wait_render_engine();
35 void create_cache();
36 void perform_change();
37 void sync_parameters(EDL *edl);
38 // Set wait_tracking for events that change the cursor location but
39 // be sure to unlock the windows
40 void interrupt_playback(int wait_tracking = 0);
41 // Get levels for tracking. Return 0 if no audio.
42 int get_output_levels(double *levels, long position);
43 int get_module_levels(ArrayList<double> *module_levels, long position);
44 // The MWindow starts the playback cursor loop
45 // The other windows start a slider loop
46 // For pausing only the cursor is run
47 virtual void init_cursor();
48 virtual void stop_cursor();
49 virtual int brender_available(long position);
50 // For normal playback tracking and the cursor are started
51 virtual void init_tracking();
52 virtual void stop_tracking();
53 // The playback cursor calls this to calculate the current tracking position
54 virtual double get_tracking_position();
55 // Reset the transport after completion
56 virtual void update_transport(int command, int paused);
57 // The render engines call this to update tracking variables in the playback engine.
58 void update_tracking(double position);
59 // Get the output channel table for the current device or 0 if none exists.
60 ChannelDB* get_channeldb();
62 void run();
64 // Maintain caches through console changes
65 CICache *audio_cache, *video_cache;
66 // Maintain playback cursor on GUI
67 int tracking_active;
68 // Tracking variables updated by render engines
69 double tracking_position;
70 // Not accurate until the first update_tracking, at which time
71 // tracking_active is incremented to 2.
72 Timer tracking_timer;
73 // Lock access to tracking data
74 Mutex *tracking_lock;
75 // Block returns until tracking loop is finished
76 Condition *tracking_done;
77 // Pause the main loop for the PAUSE command
78 Condition *pause_lock;
79 // Wait until thread has started
80 Condition *start_lock;
82 MWindow *mwindow;
83 Canvas *output;
84 // Copy of main preferences
85 Preferences *preferences;
86 // Next command
87 TransportQue *que;
88 // Currently executing command
89 TransportCommand *command;
90 // Last command which affected transport
91 int last_command;
92 int done;
93 int do_cwindow;
94 // Render engine
95 RenderEngine *render_engine;
97 // Used by label commands to get current position
98 int is_playing_back;
100 // General purpose debugging register
101 int debug;
108 #endif