initial commit
[goodguy/history.git] / cinelerra-5.0 / cinelerra / vrender.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 VRENDER_H
23 #define VRENDER_H
24
25 #include "commonrender.h"
26 #include "edit.inc"
27 #include "guicast.h"
28 #include "mwindow.inc"
29 #include "overlayframe.inc"
30 #include "renderengine.inc"
31 #include "vframe.inc"
32
33
34 class VRender : public CommonRender
35 {
36 public:
37         VRender(RenderEngine *renderengine);
38         ~VRender();
39
40         VirtualConsole* new_vconsole_object();
41         int get_total_tracks();
42         Module* new_module(Track *track);
43
44 // set up and start thread
45         int arm_playback(int64_t current_position,
46                                 int64_t input_length, 
47                                 int64_t module_render_fragment, 
48                                 int64_t playback_buffer, 
49                                 int track_w,
50                                 int track_h,
51                                 int output_w,
52                                 int output_h);
53
54         void run();
55         int wait_for_startup();
56
57         int start_playback();     // start the thread
58
59
60 // process frames to put in buffer_out
61 // use_opengl - used by nested render engines
62         int process_buffer(VFrame *video_out, 
63                 int64_t input_position,
64                 int use_opengl);
65 // load an array of buffers for each track to send to the thread
66         int process_buffer(int64_t input_position,
67                 int use_opengl);
68 // Flash the output on the display
69         int flash_output();
70 // Determine if data can be copied directly from the file to the output device.
71         void get_render_strategy(Edit* &playable_edit, 
72                 int &colormodel, 
73                 int &use_vconsole,
74                 int64_t position);
75
76
77         int get_use_vconsole(VEdit* *playable_edit, 
78                 int64_t position,
79                 int &use_brender);
80         int get_colormodel(VEdit *playable_edit, 
81                 int use_vconsole,
82                 int use_brender);
83
84         int64_t tounits(double position, int round);
85         double fromunits(int64_t position);
86
87 // frames since start of playback
88         int64_t session_frame;           
89
90 // console dimensions
91         int track_w, track_h;    
92 // video device dimensions
93         int output_w, output_h;    
94 // frames to send to console fragment
95         int64_t vmodule_render_fragment;    
96 // frames to send to video device (1)
97         int64_t playback_buffer;            
98 // Output frame
99         VFrame *video_out;
100 // Byte offset of video_out
101         int64_t output_offset;
102
103 // Temp frame for VModule loading
104         VFrame *input_temp;
105 // Temp frame for VModule transitions
106         VFrame *transition_temp;
107 // Engine for camera and projector automation
108         OverlayFrame *overlayer;
109
110
111         
112 // Total number of frames to render for transitions
113         int64_t source_length;  
114
115 // Flag first frame to unlock audio
116         int first_frame;
117
118 private:
119         int init_device_buffers();
120         Timer timer;
121
122 // for getting actual framerate
123         int64_t framerate_counter;
124         Timer framerate_timer;
125         int render_strategy;
126 };
127
128
129
130
131 #endif