00001 #ifndef COMMONRENDER_H 00002 #define COMMONRENDER_H 00003 00004 #include "cache.inc" 00005 #include "condition.inc" 00006 #include "virtualconsole.inc" 00007 #include "module.inc" 00008 #include "mwindow.inc" 00009 #include "renderengine.inc" 00010 #include "thread.h" 00011 #include "track.inc" 00012 00013 #include <stdint.h> 00014 00015 class CommonRender : public Thread 00016 { 00017 public: 00018 CommonRender(RenderEngine *renderengine); 00019 virtual ~CommonRender(); 00020 00021 virtual void arm_command(); 00022 virtual int get_total_tracks() { return 0; }; 00023 virtual Module* new_module(Track *track) { return 0; }; 00024 void delete_vconsole(); 00025 void create_modules(); 00026 void reset_parameters(); 00027 // Build the virtual console at the current position 00028 virtual void build_virtual_console(); 00029 virtual VirtualConsole* new_vconsole_object() { return 0; }; 00030 virtual void init_output_buffers() {}; 00031 void start_plugins(); 00032 void stop_plugins(); 00033 int test_reconfigure(int64_t position, int64_t &length); 00034 00035 void evaluate_current_position(); 00036 void start_command(); 00037 virtual int restart_playback(); 00038 virtual void run(); 00039 00040 RenderEngine *renderengine; 00041 // Virtual console 00042 VirtualConsole *vconsole; 00043 // Native units position in project used for all functions 00044 int64_t current_position; 00045 Condition *start_lock; 00046 // flag for normally completed playback 00047 int done; 00048 // Flag for interrupted playback 00049 int interrupt; 00050 // flag for last buffer to be played back 00051 int last_playback; 00052 // if this media type is being rendered asynchronously by threads 00053 int asynchronous; 00054 // Module for every track to dispatch plugins in whether the track is 00055 // playable or not. 00056 // Maintain module structures here instead of reusing the EDL so 00057 // plugins persist if the EDL is replaced. 00058 // Modules can persist after vconsole is restarted. 00059 int total_modules; 00060 Module **modules; 00061 int data_type; 00062 // If a VirtualConsole was created need to start plugins 00063 int restart_plugins; 00064 00065 00066 00067 00068 00069 00070 00071 00072 CommonRender(MWindow *mwindow, RenderEngine *renderengine); 00073 00074 // clean up rendering 00075 int virtual stop_rendering() {}; 00076 int wait_for_completion(); 00077 virtual int wait_device_completion() {}; 00078 // renders to a device when there's a device 00079 virtual int process_buffer(int64_t input_len, int64_t input_position) {}; 00080 00081 virtual int get_datatype() {}; 00082 // test region against loop boundaries 00083 int get_boundaries(int64_t ¤t_render_length); 00084 // test region for playback automation changes 00085 int get_automation(int64_t ¤t_render_length, int data_type); 00086 // advance the buffer position depending on the loop status 00087 int advance_position(int64_t current_render_length); 00088 00089 // convert to and from the native units of the render engine 00090 virtual int64_t tounits(double position, int round); 00091 virtual double fromunits(int64_t position); 00092 virtual int64_t get_render_length(int64_t current_render_length) {}; 00093 00094 MWindow *mwindow; 00095 00096 int64_t input_length; // frames/samples to read from disk at a time 00097 00098 protected: 00099 // make sure automation agrees with playable tracks 00100 // automatically tests direction of playback 00101 // return 1 if it doesn't 00102 int test_automation_before(int64_t ¤t_render_length, int data_type); 00103 int test_automation_after(int64_t ¤t_render_length, int data_type); 00104 }; 00105 00106 00107 #endif
1.5.5