4 * Copyright (C) 2011 Adam Williams <broadcast at earthling dot net>
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.
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.
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
22 #ifndef RECORDMONITOR_H
23 #define RECORDMONITOR_H
26 #include "avc1394transport.h"
30 #include "channelpicker.inc"
31 #include "condition.inc"
33 #include "channelpicker.inc"
35 #include "meterpanel.inc"
36 #include "preferences.inc"
38 #include "recordgui.inc"
39 #include "recordscopes.inc"
40 #include "recordtransport.inc"
41 #include "recordmonitor.inc"
42 #include "signalstatus.inc"
43 #include "videodevice.inc"
45 class RecordMonitorThread;
47 class RecordMonitor : public Thread
50 RecordMonitor(MWindow *mwindow, Record *record);
54 int update(VFrame *vframe);
55 // Update channel textbox
56 void update_channel(char *text);
60 // Thread for slippery monitoring
61 RecordMonitorThread *thread;
62 RecordMonitorGUI *window;
64 // Fake config for monitoring
65 VideoOutConfig *config;
67 RecordScopeThread *scope_thread;
70 void close_threads(); // Stop all the child threads on exit
71 void create_objects();
72 void fix_size(int &w, int &h, int width_given, float aspect_ratio);
73 float get_scale(int w);
74 int get_mbuttons_height();
75 int get_canvas_height();
80 void start_playback();
82 void display_vframe(VFrame *in, int x, int y,
83 int alpha, double secs, double scale);
84 void undisplay_vframe();
87 class ReverseInterlace;
88 class RecordMonitorCanvas;
92 class RecordMonitorGUI : public BC_Window
95 RecordMonitorGUI(MWindow *mwindow, Record *record,
96 RecordMonitor *thread, int min_w);
99 void create_objects();
100 int cursor_leave_event();
101 int cursor_enter_event();
102 int button_release_event();
103 int cursor_motion_event();
105 void display_video_text(int x, int y, const char *text, int font,
106 int bg_color, int color, int alpha, double secs, double scale);
107 void enable_signal_status(int enable);
110 RecordMonitorCanvas *canvas;
111 // RecordTransport *record_transport;
113 AVC1394Transport *avc1394_transport;
114 AVC1394TransportThread *avc1394transport_thread;
116 RecordChannelPicker *channel_picker;
117 ScopeEnable *scope_toggle;
118 DoCursor *cursor_toggle;
119 DoBigCursor *big_cursor_toggle;
120 ReverseInterlace *reverse_interlace;
121 int cursor_x_origin, cursor_y_origin;
122 int translate_x_origin, translate_y_origin;
123 BC_PopupMenu *monitor_menu;
124 int current_operation;
127 int translation_event();
128 int button_press_event();
129 int resize_event(int w, int h);
134 int keypress_event();
137 BC_SubWindow *mbuttons;
139 RecordMonitor *thread;
143 BC_Title *avc1394transport_title;
144 BC_Title *avc1394transport_timecode;
146 SignalStatus *signal_status;
150 class RecVideoMJPGThread;
151 class RecVideoDVThread;
152 class RecVideoOverlay;
154 class RecordMonitorThread : public Thread
156 void show_output_frame();
157 void render_uncompressed();
160 void process_scope();
163 int ready; // Ready to receive the next frame
165 RecVideoMJPGThread *jpeg_engine;
166 RecVideoDVThread *dv_engine;
168 RecordMonitorThread(MWindow *mwindow,
170 RecordMonitor *record_monitor);
171 ~RecordMonitorThread();
173 void reset_parameters();
175 // Calculate the best output format based on input drivers
176 void init_output_format();
177 int start_playback();
179 int write_frame(VFrame *new_frame);
183 void new_output_frame();
184 void display_vframe(VFrame *in, int x, int y,
185 int alpha, double secs, double scale);
186 void undisplay_vframe();
187 int finished() { return done; }
189 // Input frame being rendered
191 // Frames for the rendered output
192 VFrame *output_frame;
193 // Best color model given by device
194 int output_colormodel;
195 // Block until new input data
196 Condition *output_lock;
197 Condition *input_lock;
199 RecordMonitor *record_monitor;
201 // If the input frame is the same data that the file handle uses
204 RecVideoOverlay *ovly;
207 class RecordMonitorFullsize : public BC_MenuItem
210 RecordMonitorFullsize(MWindow *mwindow, RecordMonitorGUI *window);
214 RecordMonitorGUI *window;
217 class RecordMonitorCanvas : public Canvas
220 RecordMonitorCanvas(MWindow *mwindow, RecordMonitorGUI *window,
221 Record *record, int x, int y, int w, int h);
222 ~RecordMonitorCanvas();
224 void create_objects(EDL *edl);
225 void zoom_resize_window(float percentage);
226 int button_press_event();
227 int button_release_event();
228 int cursor_motion_event();
229 int cursor_enter_event();
230 void reset_translation();
231 int keypress_event();
232 int keypress_event(RecordMonitorGUI *window);
236 RecordMonitorGUI *window;
241 class DoCursor : public BC_CheckBox
244 DoCursor(Record *record, int x, int y);
250 class DoBigCursor : public BC_CheckBox
253 DoBigCursor(Record *record, int x, int y);
259 class ReverseInterlace : public BC_CheckBox
262 ReverseInterlace(Record *record, int x, int y);
268 class RecVideoMJPGThread
271 RecVideoMJPGThread(Record *record,
272 RecordMonitorThread *thread,
274 ~RecVideoMJPGThread();
276 int render_frame(VFrame *frame, long size);
277 int start_rendering();
278 int stop_rendering();
280 RecordMonitorThread *thread;
288 class RecVideoDVThread
291 RecVideoDVThread(Record *record, RecordMonitorThread *thread);
294 int start_rendering();
295 int stop_rendering();
296 int render_frame(VFrame *frame, long size);
298 RecordMonitorThread *thread;
302 // Don't want theme to need libdv to compile
306 class RecVideoOverlay
312 RecVideoOverlay(VFrame *vframe, int x, int y, int ticks, float scale, float alpha);
315 int overlay(VFrame *out);