version update, bld tweaks, resize track booby, 10fps for images
[goodguy/cinelerra.git] / cinelerra-5.1 / 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         void 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         int insert_timecode(Edit *playable_edit,
84                 int64_t position,
85                 VFrame *output);
86
87         int64_t tounits(double position, int round);
88         double fromunits(int64_t position);
89
90 // frames since start of playback
91         int64_t session_frame;
92
93 // console dimensions
94         int track_w, track_h;
95 // video device dimensions
96         int output_w, output_h;
97 // frames to send to console fragment
98         int64_t vmodule_render_fragment;
99 // frames to send to video device (1)
100         int64_t playback_buffer;
101 // Output frame
102         VFrame *video_out;
103 // Byte offset of video_out
104         int64_t output_offset;
105
106 // Temp frame for VModule loading
107         VFrame *input_temp;
108 // Temp frame for VModule transitions
109         VFrame *transition_temp;
110 // Engine for camera and projector automation
111         OverlayFrame *overlayer;
112
113
114
115 // Total number of frames to render for transitions
116         int64_t source_length;
117
118 // Flag first frame to unlock audio
119         int first_frame;
120
121 private:
122         void init_device_buffers();
123         Timer timer;
124
125 // for getting actual framerate
126         int64_t framerate_counter;
127         Timer framerate_timer;
128         int render_strategy;
129 };
130
131
132
133
134 #endif