r999: maintainers added to README_en.
[cinelerra_cv/mob.git] / cinelerra / playbackengine.h
blobf13fc8d71617886b91c6deb5275e68d95cbe244a
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 "bchash.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"
22 class PlaybackEngine : public Thread
24 public:
25 PlaybackEngine(MWindow *mwindow, Canvas *output);
26 virtual ~PlaybackEngine();
28 int create_objects();
29 virtual int create_render_engine();
30 void delete_render_engine();
31 void arm_render_engine();
32 void start_render_engine();
33 void wait_render_engine();
34 void create_cache();
35 void perform_change();
36 void sync_parameters(EDL *edl);
37 // Set wait_tracking for events that change the cursor location but
38 // be sure to unlock the windows
39 void interrupt_playback(int wait_tracking = 0);
40 // Get levels for tracking. Return 0 if no audio.
41 int get_output_levels(double *levels, long position);
42 int get_module_levels(ArrayList<double> *module_levels, long position);
43 // The MWindow starts the playback cursor loop
44 // The other windows start a slider loop
45 // For pausing only the cursor is run
46 virtual void init_cursor();
47 virtual void stop_cursor();
48 virtual int brender_available(long position);
49 // For normal playback tracking and the cursor are started
50 virtual void init_tracking();
51 virtual void stop_tracking();
52 // The playback cursor calls this to calculate the current tracking position
53 virtual double get_tracking_position();
54 // Reset the transport after completion
55 virtual void update_transport(int command, int paused);
56 // The render engines call this to update tracking variables in the playback engine.
57 void update_tracking(double position);
58 // Get the output channel table for the current device or 0 if none exists.
59 ChannelDB* get_channeldb();
61 void run();
63 // Maintain caches through console changes
64 CICache *audio_cache, *video_cache;
65 // Maintain playback cursor on GUI
66 int tracking_active;
67 // Tracking variables updated by render engines
68 double tracking_position;
69 // Not accurate until the first update_tracking, at which time
70 // tracking_active is incremented to 2.
71 Timer tracking_timer;
72 // Lock access to tracking data
73 Mutex *tracking_lock;
74 // Block returns until tracking loop is finished
75 Condition *tracking_done;
76 // Pause the main loop for the PAUSE command
77 Condition *pause_lock;
78 // Wait until thread has started
79 Condition *start_lock;
81 MWindow *mwindow;
82 Canvas *output;
83 // Copy of main preferences
84 Preferences *preferences;
85 // Next command
86 TransportQue *que;
87 // Currently executing command
88 TransportCommand *command;
89 // Last command which affected transport
90 int last_command;
91 int done;
92 int do_cwindow;
93 // Render engine
94 RenderEngine *render_engine;
96 // Used by label commands to get current position
97 int is_playing_back;
99 // General purpose debugging register
100 int debug;
107 #endif