initial commit
[goodguy/history.git] / cinelerra-5.0 / cinelerra / commonrender.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * 
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  * 
20  */
21
22 #ifndef COMMONRENDER_H
23 #define COMMONRENDER_H
24
25 #include "cache.inc"
26 #include "condition.inc"
27 #include "virtualconsole.inc"
28 #include "module.inc"
29 #include "mwindow.inc"
30 #include "renderengine.inc"
31 #include "thread.h"
32 #include "track.inc"
33
34 #include <stdint.h>
35
36 class CommonRender : public Thread
37 {
38 public:
39         CommonRender(RenderEngine *renderengine);
40         virtual ~CommonRender();
41
42         virtual void arm_command();
43         virtual int get_total_tracks() { return 0; };
44         virtual Module* new_module(Track *track) { return 0; };
45         void delete_vconsole();
46         void create_modules();
47         void reset_parameters();
48 // Build the virtual console at the current position
49         virtual void build_virtual_console();
50         virtual VirtualConsole* new_vconsole_object() { return 0; };
51         virtual void init_output_buffers() {};
52         void start_plugins();
53         void stop_plugins();
54         virtual void interrupt_playback();
55         int test_reconfigure(int64_t position, int64_t &length);
56
57         void evaluate_current_position();
58         void start_command();
59         virtual int restart_playback();
60         virtual void run();
61
62 // convert to and from the native units of the render engine
63         virtual int64_t tounits(double position, int round);
64         virtual double fromunits(int64_t position);
65 // test region against loop boundaries
66         int get_boundaries(int64_t &current_render_length);
67 // advance the buffer position depending on the loop status
68         int advance_position(int64_t current_render_length);
69
70         RenderEngine *renderengine;
71 // Virtual console
72         VirtualConsole *vconsole;
73 // Native units position in project used for all functions
74         int64_t current_position;       
75         Condition *start_lock;
76 // flag for normally completed playback
77         int done;       
78 // Flag for interrupted playback
79         int interrupt;
80 // if this media type is being rendered asynchronously by threads
81         int asynchronous;     
82 // Module for every track to dispatch plugins in whether the track is
83 // playable or not.
84 // Maintain module structures here instead of reusing the EDL so 
85 // plugins persist if the EDL is replaced.
86 // Modules can persist after vconsole is restarted.
87         int total_modules;
88         Module **modules;
89         int data_type;
90 // If a VirtualConsole was created need to start plugins
91         int restart_plugins;
92
93         
94
95 };
96
97
98 #endif