Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / cinelerra / record.h
blob04a4a7baf9404bfd20db20679b77d63a0c6ee914
1 #ifndef RECORD_H
2 #define RECORD_H
4 #include "asset.inc"
5 #include "assets.inc"
6 #include "audiodevice.inc"
7 #include "batch.inc"
8 #include "channeldb.inc"
9 #include "guicast.h"
10 #include "bitspopup.h"
11 #include "browsebutton.h"
12 #include "channel.inc"
13 #include "bchash.inc"
14 #include "edl.inc"
15 #include "file.inc"
16 #include "filexml.inc"
17 #include "filethread.inc"
18 #include "formatpopup.h"
19 #include "formattools.inc"
20 #include "loadmode.inc"
21 #include "mwindow.inc"
22 #include "maxchannels.h"
23 #include "picture.inc"
24 #include "playbackengine.inc"
25 #include "record.inc"
26 #include "recordengine.inc"
27 #include "recordgui.inc"
28 #include "recordmonitor.inc"
29 #include "recordthread.inc"
30 #include "recordwindow.inc"
31 #include "videodevice.inc"
33 class Record;
35 class RecordMenuItem : public BC_MenuItem
37 public:
38 RecordMenuItem(MWindow *mwindow);
39 ~RecordMenuItem();
41 int handle_event();
43 Record *thread;
44 MWindow *mwindow;
45 // State of recording dialog
46 int current_state;
49 class Record : public Thread
51 public:
52 Record(MWindow *mwindow, RecordMenuItem *menu_item);
53 ~Record();
55 void run();
56 int load_defaults();
57 int save_defaults();
58 Batch* new_batch();
59 void delete_batch();
60 void activate_batch(int number, int stop_operation);
61 void change_editing_batch(int number);
62 void close_output_file();
63 void delete_batch(int number);
64 void swap_batches(int number1, int number2);
65 void get_audio_write_length(int &buffer_size,
66 int &fragment_size);
67 int open_input_devices(int duplex, int context);
68 // is_monitor - set by caller to make sure the caller is the same one
69 // that opened the device.
70 int close_input_devices(int is_monitor);
71 void start_file_threads();
72 int start_recording(int duplex,
73 int context /* = CONTEXT_INTERACTIVE */);
74 int record_frame();
75 int start_monitor();
76 int pause_monitor();
77 int resume_monitor();
78 // no_monitor causes the monitor not to be resumed after the operation
79 int stop_operation(int resume_monitor);
80 int stop_duplex();
81 void stop_file_threads();
82 int stop_monitor();
83 int get_in_length();
84 int set_video_picture();
85 // Set screencapture translation
86 void set_translation(int x, int y);
88 // Set the channel in the current batch and the picture controls
89 int set_channel(int channel);
90 void set_channel(Channel *channel);
91 int has_signal();
93 void toggle_label();
94 // Set values in batch structures
95 void configure_batches();
96 void source_to_text(char *string, Batch *batch);
97 // Create first file in batch
98 int open_output_file();
99 // Delete the output file for overwrite if it exists.
100 int delete_output_file();
101 // Create next file in batch
102 int init_next_file();
103 void rewind_file();
104 // Get the inputs supported by the device
105 ArrayList<Channel*>* get_video_inputs();
107 // Copied to each batch for the files
108 Asset_GC default_asset;
109 ArrayList<Batch*> batches;
110 // How to combine the batches with the project
111 int load_mode;
112 int do_audio;
113 int do_video;
114 int monitor_audio;
115 int monitor_video;
116 int video_window_open;
117 // Prompt before cancel
118 int prompt_cancel;
119 // Compression is fixed by the driver
120 int fixed_compression;
121 // Current batch being recorded to
122 int current_batch;
123 // Current batch being edited. Don't want to interrupt recording to edit a different batch.
124 int editing_batch;
125 // Get next batch using activation or -1
126 int get_next_batch();
127 // Information about the current batch.
128 Batch* get_current_batch();
129 // Information about the batch being edited
130 Batch* get_editing_batch();
131 char* current_mode();
132 char* current_source();
133 int get_current_channel();
134 int get_editing_channel();
135 void get_current_time(double &seconds, int &day);
136 Channel* get_current_channel_struct();
137 char* current_news();
138 double* current_start();
139 double* current_duration();
140 Asset_GC current_asset();
141 int* current_offset_type();
142 // Total number of samples since record sequence started
143 int64_t sync_position();
144 // Current position for GUI relative to batch
145 double current_display_position();
146 int64_t current_audio_position();
147 int64_t current_duration_samples();
148 int64_t current_video_position();
149 int64_t current_duration_frames();
150 // Number of frames between the current file and the start of the batch
151 int64_t batch_video_offset();
152 // Rewind the current file in the current batch
153 void start_over();
156 // User defined TV stations and inputs to record from.
157 ChannelDB *channeldb;
158 // Structure which stores what parameters the device supports
159 Channel *master_channel;
162 LoadMode *loadmode;
163 MWindow *mwindow;
164 RecordGUI *record_gui;
165 RecordMonitor *record_monitor;
166 RecordThread *monitor_engine;
167 RecordThread *record_engine;
168 AudioDevice *adevice;
169 VideoDevice *vdevice;
170 // File handle of last asset.in current batch
171 File *file;
173 PlaybackEngine *duplex_engine;
174 RecordWindow *record_window;
175 // Table for LML conversion
176 // unsigned char _601_to_rgb_table[256];
177 // For video synchronization when no audio thread
178 Timer monitor_timer;
179 // State of the capturing operation
180 int capture_state;
181 // Translation of screencapture input
182 int video_x;
183 int video_y;
184 float video_zoom;
185 // Reverse the interlace in the video window display only
186 int reverse_interlace;
187 // Color model for uncompressed device interface
188 int color_model;
189 // Picture quality and parameters the device supports
190 PictureConfig *picture;
191 // Fill dropped frames with duplicates
192 int fill_frames;
193 // Parameters for video monitor
194 EDL *edl;
195 Mutex *window_lock;
213 // Number of channeldb entry
214 int current_channel;
216 FileXML *script;
217 RecordMenuItem *menu_item;
219 int set_script(FileXML *script);
220 int run_script(Asset_GC asset, int &do_audio, int &do_video);
221 int save_engine_defaults();
223 float get_min_db();
224 int get_samplerate();
225 float get_framerate();
226 int get_everyframe();
227 int get_time_format();
228 int get_realtime();
229 float get_frame_rate();
230 char* get_in_path();
231 char* get_video_inpath();
232 int get_video_driver();
233 int get_vu_format();
234 int get_rec_mode();
235 int set_rec_mode(int value);
236 int set_loop_duration(int64_t value);
237 int use_floatingpoint();
239 int get_out_length(); // Length to write during playback
240 int64_t get_out_buffersize(); // Same as get_out_length
241 int get_software_positioning();
242 int64_t get_in_buffersize(); // Length to write to disk at a time
243 int get_video_buffersize(); // Number of frames to write to disk at a time
244 int get_video_capturesize(); // Number of frames to read from device at a time
245 int get_meter_over_hold(int divisions);
246 int get_meter_peak_hold(int divisions);
247 int get_meter_speed();
249 int64_t get_playback_buffer();
250 int enable_duplex();
252 int realtime;
253 int to_tracks;
254 int64_t loop_duration;
255 int64_t startsource_sample; // start in source file of this recording
256 int64_t endsource_sample;
257 int64_t startsource_frame;
258 int64_t endsource_frame;
259 int64_t dc_offset[MAXCHANNELS];
260 int append_to_file;
261 int record_mode;
262 int frame_w;
263 int frame_h;
264 int video_window_w; // Width of record video window
265 int cpus;
269 #endif
271 // Local Variables:
272 // mode: C++
273 // c-file-style: "linux"
274 // End: