4 * Copyright (C) 2011 Adam Williams <broadcast at earthling dot net>
5 * Copyright (C) 2003-2016 Cinelerra CV contributors
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef RECORDMONITOR_H
24 #define RECORDMONITOR_H
27 #include "avc1394transport.h"
31 #include "channelpicker.inc"
32 #include "condition.inc"
34 #include "channelpicker.inc"
36 #include "meterpanel.inc"
37 #include "preferences.inc"
39 #include "recordgui.inc"
40 #include "recordscopes.inc"
41 #include "recordtransport.inc"
42 #include "recordmonitor.inc"
43 #include "signalstatus.inc"
44 #include "videodevice.inc"
46 class RecordMonitorThread;
48 class RecordMonitor : public Thread
51 RecordMonitor(MWindow *mwindow, Record *record);
55 int update(VFrame *vframe);
56 // Update channel textbox
57 void update_channel(char *text);
61 // Thread for slippery monitoring
62 RecordMonitorThread *thread;
63 RecordMonitorGUI *window;
65 // Fake config for monitoring
66 VideoOutConfig *config;
68 RecordScopeThread *scope_thread;
71 void close_threads(); // Stop all the child threads on exit
72 void create_objects();
73 void fix_size(int &w, int &h, int width_given, float aspect_ratio);
74 float get_scale(int w);
75 int get_mbuttons_height();
76 int get_canvas_height();
81 void start_playback();
83 void display_vframe(VFrame *in, int x, int y,
84 int alpha, double secs, double scale);
85 void undisplay_vframe();
88 class ReverseInterlace;
89 class RecordMonitorCanvas;
93 class RecordMonitorGUI : public BC_Window
96 RecordMonitorGUI(MWindow *mwindow, Record *record,
97 RecordMonitor *thread, int min_w);
100 void create_objects();
101 int cursor_leave_event();
102 int cursor_enter_event();
103 int button_release_event();
104 int cursor_motion_event();
106 void display_video_text(int x, int y, const char *text, int font,
107 int bg_color, int color, int alpha, double secs, double scale);
108 void enable_signal_status(int enable);
111 RecordMonitorCanvas *canvas;
112 // RecordTransport *record_transport;
114 AVC1394Transport *avc1394_transport;
115 AVC1394TransportThread *avc1394transport_thread;
117 RecordChannelPicker *channel_picker;
118 ScopeEnable *scope_toggle;
119 DoCursor *cursor_toggle;
120 DoBigCursor *big_cursor_toggle;
121 ReverseInterlace *reverse_interlace;
122 int cursor_x_origin, cursor_y_origin;
123 int translate_x_origin, translate_y_origin;
124 BC_PopupMenu *monitor_menu;
125 int current_operation;
128 int translation_event();
129 int button_press_event();
130 int resize_event(int w, int h);
135 int keypress_event();
138 BC_SubWindow *mbuttons;
140 RecordMonitor *thread;
144 BC_Title *avc1394transport_title;
145 BC_Title *avc1394transport_timecode;
147 SignalStatus *signal_status;
151 class RecVideoMJPGThread;
152 class RecVideoDVThread;
153 class RecVideoOverlay;
155 class RecordMonitorThread : public Thread
157 void show_output_frame();
158 void render_uncompressed();
161 void process_scope();
164 int ready; // Ready to receive the next frame
166 RecVideoMJPGThread *jpeg_engine;
167 RecVideoDVThread *dv_engine;
169 RecordMonitorThread(MWindow *mwindow,
171 RecordMonitor *record_monitor);
172 ~RecordMonitorThread();
174 void reset_parameters();
176 // Calculate the best output format based on input drivers
177 void init_output_format();
178 int start_playback();
180 int write_frame(VFrame *new_frame);
184 void new_output_frame();
185 void display_vframe(VFrame *in, int x, int y,
186 int alpha, double secs, double scale);
187 void undisplay_vframe();
188 int finished() { return done; }
190 // Input frame being rendered
192 // Frames for the rendered output
193 VFrame *output_frame;
194 // Best color model given by device
195 int output_colormodel;
196 // Block until new input data
197 Condition *output_lock;
198 Condition *input_lock;
200 RecordMonitor *record_monitor;
202 // If the input frame is the same data that the file handle uses
205 RecVideoOverlay *ovly;
208 class RecordMonitorFullsize : public BC_MenuItem
211 RecordMonitorFullsize(MWindow *mwindow, RecordMonitorGUI *window);
215 RecordMonitorGUI *window;
218 class RecordMonitorCanvas : public Canvas
221 RecordMonitorCanvas(MWindow *mwindow, RecordMonitorGUI *window,
222 Record *record, int x, int y, int w, int h);
223 ~RecordMonitorCanvas();
225 void create_objects(EDL *edl);
226 void zoom_resize_window(float percentage);
227 int button_press_event();
228 int button_release_event();
229 int cursor_motion_event();
230 int cursor_enter_event();
231 void reset_translation();
232 int keypress_event();
233 int keypress_event(RecordMonitorGUI *window);
237 RecordMonitorGUI *window;
242 class DoCursor : public BC_CheckBox
245 DoCursor(Record *record, int x, int y);
251 class DoBigCursor : public BC_CheckBox
254 DoBigCursor(Record *record, int x, int y);
260 class ReverseInterlace : public BC_CheckBox
263 ReverseInterlace(Record *record, int x, int y);
269 class RecVideoMJPGThread
272 RecVideoMJPGThread(Record *record,
273 RecordMonitorThread *thread,
275 ~RecVideoMJPGThread();
277 int render_frame(VFrame *frame, long size);
278 int start_rendering();
279 int stop_rendering();
281 RecordMonitorThread *thread;
289 class RecVideoDVThread
292 RecVideoDVThread(Record *record, RecordMonitorThread *thread);
295 int start_rendering();
296 int stop_rendering();
297 int render_frame(VFrame *frame, long size);
299 RecordMonitorThread *thread;
303 // Don't want theme to need libdv to compile
307 class RecVideoOverlay
313 RecVideoOverlay(VFrame *vframe, int x, int y, int ticks, float scale, float alpha);
316 int overlay(VFrame *out);