license header for review
[cinelerra_cv/ct.git] / cinelerra / commonrender.h
blobb9eeaa32e9fffa725fa5eb73d0ea4835f0eee5ef
1 #ifndef COMMONRENDER_H
2 #define COMMONRENDER_H
4 #include "cache.inc"
5 #include "condition.inc"
6 #include "virtualconsole.inc"
7 #include "module.inc"
8 #include "mwindow.inc"
9 #include "renderengine.inc"
10 #include "thread.h"
11 #include "track.inc"
13 #include <stdint.h>
15 class CommonRender : public Thread
17 public:
18 CommonRender(RenderEngine *renderengine);
19 virtual ~CommonRender();
21 virtual void arm_command();
22 virtual int get_total_tracks() { return 0; };
23 virtual Module* new_module(Track *track) { return 0; };
24 void delete_vconsole();
25 void create_modules();
26 void reset_parameters();
27 // Build the virtual console at the current position
28 virtual void build_virtual_console();
29 virtual VirtualConsole* new_vconsole_object() { return 0; };
30 virtual void init_output_buffers() {};
31 void start_plugins();
32 void stop_plugins();
33 int test_reconfigure(int64_t position, int64_t &length);
35 void evaluate_current_position();
36 void start_command();
37 virtual int restart_playback();
38 virtual void run();
40 RenderEngine *renderengine;
41 // Virtual console
42 VirtualConsole *vconsole;
43 // Native units position in project used for all functions
44 int64_t current_position;
45 Condition *start_lock;
46 // flag for normally completed playback
47 int done;
48 // Flag for interrupted playback
49 int interrupt;
50 // flag for last buffer to be played back
51 int last_playback;
52 // if this media type is being rendered asynchronously by threads
53 int asynchronous;
54 // Module for every track to dispatch plugins in whether the track is
55 // playable or not.
56 // Maintain module structures here instead of reusing the EDL so
57 // plugins persist if the EDL is replaced.
58 // Modules can persist after vconsole is restarted.
59 int total_modules;
60 Module **modules;
61 int data_type;
62 // If a VirtualConsole was created need to start plugins
63 int restart_plugins;
72 CommonRender(MWindow *mwindow, RenderEngine *renderengine);
74 // clean up rendering
75 int virtual stop_rendering() {};
76 int wait_for_completion();
77 virtual int wait_device_completion() {};
78 // renders to a device when there's a device
79 virtual int process_buffer(int64_t input_len, int64_t input_position) {};
81 virtual int get_datatype() {};
82 // test region against loop boundaries
83 int get_boundaries(int64_t &current_render_length);
84 // test region for playback automation changes
85 int get_automation(int64_t &current_render_length, int data_type);
86 // advance the buffer position depending on the loop status
87 int advance_position(int64_t current_render_length);
89 // convert to and from the native units of the render engine
90 virtual int64_t tounits(double position, int round);
91 virtual double fromunits(int64_t position);
92 virtual int64_t get_render_length(int64_t current_render_length) {};
94 MWindow *mwindow;
96 int64_t input_length; // frames/samples to read from disk at a time
98 protected:
99 // make sure automation agrees with playable tracks
100 // automatically tests direction of playback
101 // return 1 if it doesn't
102 int test_automation_before(int64_t &current_render_length, int data_type);
103 int test_automation_after(int64_t &current_render_length, int data_type);
107 #endif
109 // Local Variables:
110 // mode: C++
111 // c-file-style: "linux"
112 // End: