r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / commonrender.h
blobd2472f718d09abafafe0a9ca638014c2143dffff
1 #ifndef COMMONRENDER_H
2 #define COMMONRENDER_H
4 #include "cache.inc"
5 #include "virtualconsole.inc"
6 #include "module.inc"
7 #include "mutex.h"
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 int test_reconfigure(int64_t position, int64_t &length);
34 void evaluate_current_position();
35 void start_command();
36 virtual int restart_playback();
37 virtual void run();
39 RenderEngine *renderengine;
40 // Virtual console
41 VirtualConsole *vconsole;
42 // Native units position in project used for all functions
43 int64_t current_position;
44 Mutex start_lock;
45 // flag for normally completed playback
46 int done;
47 // Flag for interrupted playback
48 int interrupt;
49 // flag for last buffer to be played back
50 int last_playback;
51 // if this media type is being rendered asynchronously by threads
52 int asynchronous;
53 // Module for every track to dispatch plugins in
54 // Maintain module structures here instead of reusing the EDL so
55 // plugins persist if the EDL is replaced.
56 // Modules persist after vconsole is restarted
57 int total_modules;
58 Module **modules;
59 int data_type;
60 // If a VirtualConsole was created need to start plugins
61 int restart_plugins;
70 CommonRender(MWindow *mwindow, RenderEngine *renderengine);
72 // clean up rendering
73 int virtual stop_rendering() {};
74 int wait_for_completion();
75 virtual int wait_device_completion() {};
76 // renders to a device when there's a device
77 virtual int process_buffer(int64_t input_len, int64_t input_position) {};
79 virtual int get_datatype() {};
80 // test region against loop boundaries
81 int get_boundaries(int64_t &current_render_length);
82 // test region for playback automation changes
83 int get_automation(int64_t &current_render_length, int data_type);
84 // advance the buffer position depending on the loop status
85 int advance_position(int64_t current_render_length);
87 // convert to and from the native units of the render engine
88 virtual int64_t tounits(double position, int round);
89 virtual double fromunits(int64_t position);
90 virtual int64_t get_render_length(int64_t current_render_length) {};
92 MWindow *mwindow;
94 int64_t input_length; // frames/samples to read from disk at a time
96 protected:
97 // make sure automation agrees with playable tracks
98 // automatically tests direction of playback
99 // return 1 if it doesn't
100 int test_automation_before(int64_t &current_render_length, int data_type);
101 int test_automation_after(int64_t &current_render_length, int data_type);
105 #endif