Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

renderengine.h

Go to the documentation of this file.
00001 #ifndef RENDERENGINE_H
00002 #define RENDERENGINE_H
00003 
00004 
00005 class RenderEngine;
00006 
00007 #include "arender.inc"
00008 #include "audiodevice.inc"
00009 #include "cache.inc"
00010 #include "canvas.inc"
00011 #include "channel.inc"
00012 #include "channeldb.inc"
00013 #include "condition.inc"
00014 #include "mutex.inc"
00015 #include "mwindow.inc"
00016 #include "playbackengine.inc"
00017 #include "pluginserver.inc"
00018 #include "preferences.inc"
00019 #include "thread.h"
00020 #include "transportque.inc"
00021 #include "videodevice.inc"
00022 #include "vrender.inc"
00023 
00024 class RenderEngine : public Thread
00025 {
00026 public:
00027         RenderEngine(PlaybackEngine *playback_engine,
00028                 Preferences *preferences, 
00029                 TransportCommand *command, 
00030                 Canvas *output,
00031                 ArrayList<PluginServer*> *plugindb,
00032                 ChannelDB *channeldb);
00033         ~RenderEngine();
00034 
00035         int total_playable_channels();
00036 // Translate sequential to subscript for EDL array
00037         int playable_channel_number(int number);
00038         void get_duty();
00039         void create_render_threads();
00040         void arm_render_threads();
00041         void start_render_threads();
00042         void wait_render_threads();
00043         void interrupt_playback();
00044         int get_output_w();
00045         int get_output_h();
00046         int brender_available(int position, int direction);
00047 // Get current channel for the BUZ output
00048         Channel* get_current_channel();
00049         double get_tracking_position();
00050 // Find the plugin whose title matches title and return it
00051         PluginServer* scan_plugindb(char *title,
00052                 int data_type);
00053         CICache* get_acache();
00054         CICache* get_vcache();
00055         void set_acache(CICache *cache);
00056         void set_vcache(CICache *cache);
00057 // Get levels for tracking
00058         void get_output_levels(double *levels, int64_t position);
00059         void get_module_levels(ArrayList<double> *module_levels, int64_t position);
00060 
00061         void run();
00062 // Sends the command sequence, compensating for network latency
00063         int arm_command(TransportCommand *command,
00064                 int &current_vchannel, 
00065                 int &current_achannel);
00066 // Start the command
00067         int start_command();
00068 
00069         int open_output();
00070         int close_output();
00071 // return position to synchronize video against
00072         int64_t sync_position();
00073 // Called by VRender to reset the timers once the first frame is done.
00074         void reset_sync_position();
00075 // return samples since start of playback
00076         int64_t session_position();
00077 
00078 // Update preferences window
00079         void update_framerate(float framerate);
00080 
00081 // Copy of command
00082         TransportCommand *command;
00083 // EDL to be used by renderengine since not all commands involve an EDL change
00084         EDL *edl;
00085 // Pointer to playback config for one head
00086         PlaybackConfig *config;
00087 // Defined only for the master render engine
00088         PlaybackEngine *playback_engine;
00089 // Copy of preferences
00090         Preferences *preferences;
00091 // Canvas if being used for CWindow
00092         Canvas *output;
00093 
00094 
00095 // Lock out new commands until completion
00096         Condition *input_lock;
00097 // Lock out interrupts until started
00098         Condition *start_lock;
00099         Condition *output_lock;
00100 // Lock out audio and synchronization timers until first frame is done
00101         Condition *first_frame_lock;
00102 // Lock out interrupts before and after renderengine is active
00103         Mutex *interrupt_lock;
00104 
00105 // Show the timecode on the video
00106         int show_tc;
00107 
00108         int done;
00109         AudioDevice *audio;
00110         VideoDevice *video;
00111         ARender *arender;
00112         VRender *vrender;
00113         int do_audio;
00114         int do_video;
00115 // Timer for synchronization without audio
00116         Timer timer;
00117         float actual_frame_rate;
00118 // If the termination came from interrupt or end of selection
00119         int interrupted;
00120 
00121         ArrayList<PluginServer*> *plugindb;
00122 // Channels for the BUZ output
00123         ChannelDB *channeldb;
00124 
00125 // Samples in audio buffer to process
00126         int64_t fragment_len;
00127 // Samples to send to audio device after speed adjustment
00128         int64_t adjusted_fragment_len;              
00129 // CICaches for use if no playbackengine exists
00130         CICache *audio_cache, *video_cache;
00131 
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 
00145 
00146 
00147 // constructing with an audio device forces output buffer allocation
00148 // constructing without an audio device puts in one buffer at a time mode
00149         RenderEngine(MWindow *mwindow, 
00150                 AudioDevice *audio = 0, 
00151                 VideoDevice *video = 0,
00152                 PlaybackEngine *playbackengine = 0);
00153 
00154 // buffersize is in samples
00155         int reset_parameters();
00156 
00157         int arm_playback_audio(int64_t input_length, 
00158                         int64_t amodule_render_fragment, 
00159                         int64_t playback_buffer, 
00160                         int64_t output_length, 
00161                         int audio_channels);
00162 
00163         int arm_playback_video(int every_frame, 
00164                         int64_t read_length, 
00165                         int64_t output_length,
00166                         int track_w,
00167                         int track_h,
00168                         int output_w,
00169                         int output_h);
00170 
00171         int64_t get_correction_factor(int reset);     // calling it resets the correction factor
00172 
00173 // start video since vrender is the master
00174         int start_video();
00175 
00176 
00177 // information for playback
00178         int follow_loop;       // loop if mwindow is looped
00179         int infinite;          // don't stop rendering at the end of the range or loops
00180 
00181         int64_t start_position;      // lowest numbered sample in playback range
00182         int64_t end_position;        // highest numbered sample in playback range
00183         int64_t current_sample;
00184         int audio_channels;
00185         int every_frame;
00186 
00187         MWindow *mwindow;
00188 };
00189 
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 #endif

Generated on Sun Jan 8 13:39:00 2006 for Cinelerra-svn by  doxygen 1.4.4