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
25 #include "avc1394transport.h"
28 #include "channelpicker.inc"
29 #include "condition.inc"
31 #include "channelpicker.inc"
33 #include "meterpanel.inc"
34 #include "preferences.inc"
36 #include "recordgui.inc"
37 #include "recordscopes.inc"
38 #include "recordtransport.inc"
39 #include "recordmonitor.inc"
40 #include "signalstatus.inc"
41 #include "videodevice.inc"
43 class RecordMonitorThread;
45 class RecordMonitor : public Thread
48 RecordMonitor(MWindow *mwindow, Record *record);
52 int update(VFrame *vframe);
53 // Update channel textbox
54 void update_channel(char *text);
58 // Thread for slippery monitoring
59 RecordMonitorThread *thread;
60 RecordMonitorGUI *window;
62 // Fake config for monitoring
63 VideoOutConfig *config;
65 RecordScopeThread *scope_thread;
68 int close_threads(); // Stop all the child threads on exit
69 void create_objects();
70 int fix_size(int &w, int &h, int width_given, float aspect_ratio);
71 float get_scale(int w);
72 int get_mbuttons_height();
73 int get_canvas_height();
78 void start_playback();
80 void display_vframe(VFrame *in, int x, int y,
81 int alpha, double secs, double scale);
82 void undisplay_vframe();
85 class ReverseInterlace;
86 class RecordMonitorCanvas;
88 class RecordMonitorGUI : public BC_Window
91 RecordMonitorGUI(MWindow *mwindow, Record *record,
92 RecordMonitor *thread, int min_w);
95 void create_objects();
96 int cursor_leave_event();
97 int cursor_enter_event();
98 int button_release_event();
99 int cursor_motion_event();
101 void display_video_text(int x, int y, const char *text, int font,
102 int bg_color, int color, int alpha, double secs, double scale);
103 void enable_signal_status(int enable);
107 // RecordTransport *record_transport;
108 AVC1394Transport *avc1394_transport;
109 AVC1394TransportThread *avc1394transport_thread;
110 RecordChannelPicker *channel_picker;
111 ScopeEnable *scope_toggle;
112 ReverseInterlace *reverse_interlace;
113 int cursor_x_origin, cursor_y_origin;
114 int translate_x_origin, translate_y_origin;
115 BC_PopupMenu *monitor_menu;
116 int current_operation;
119 int translation_event();
120 int button_press_event();
121 int resize_event(int w, int h);
126 int keypress_event();
129 BC_SubWindow *mbuttons;
131 RecordMonitor *thread;
134 BC_Title *avc1394transport_title;
135 BC_Title *avc1394transport_timecode;
136 SignalStatus *signal_status;
140 class RecVideoMJPGThread;
141 class RecVideoDVThread;
142 class RecVideoOverlay;
144 class RecordMonitorThread : public Thread
146 void show_output_frame();
147 void render_uncompressed();
150 void process_scope();
153 int ready; // Ready to recieve the next frame
155 RecVideoMJPGThread *jpeg_engine;
156 RecVideoDVThread *dv_engine;
158 RecordMonitorThread(MWindow *mwindow,
160 RecordMonitor *record_monitor);
161 ~RecordMonitorThread();
163 void reset_parameters();
165 // Calculate the best output format based on input drivers
166 void init_output_format();
167 int start_playback();
169 int write_frame(VFrame *new_frame);
173 void new_output_frame();
174 void display_vframe(VFrame *in, int x, int y,
175 int alpha, double secs, double scale);
176 void undisplay_vframe();
177 int finished() { return done; }
179 // Input frame being rendered
181 // Frames for the rendered output
182 VFrame *output_frame;
183 // Best color model given by device
184 int output_colormodel;
185 // Block until new input data
186 Condition *output_lock;
187 Condition *input_lock;
189 RecordMonitor *record_monitor;
191 // If the input frame is the same data that the file handle uses
194 RecVideoOverlay *ovly;
197 class RecordMonitorFullsize : public BC_MenuItem
200 RecordMonitorFullsize(MWindow *mwindow, RecordMonitorGUI *window);
204 RecordMonitorGUI *window;
207 class RecordMonitorCanvas : public Canvas
210 RecordMonitorCanvas(MWindow *mwindow, RecordMonitorGUI *window,
211 Record *record, int x, int y, int w, int h);
212 ~RecordMonitorCanvas();
214 void zoom_resize_window(float percentage);
215 int button_press_event();
216 int button_release_event();
217 int cursor_motion_event();
218 int cursor_enter_event();
219 void reset_translation();
220 int keypress_event();
223 int get_fullscreen();
224 void set_fullscreen(int value);
227 RecordMonitorGUI *window;
232 class ReverseInterlace : public BC_CheckBox
235 ReverseInterlace(Record *record, int x, int y);
241 class RecVideoMJPGThread
244 RecVideoMJPGThread(Record *record,
245 RecordMonitorThread *thread,
247 ~RecVideoMJPGThread();
249 int render_frame(VFrame *frame, long size);
250 int start_rendering();
251 int stop_rendering();
253 RecordMonitorThread *thread;
261 class RecVideoDVThread
264 RecVideoDVThread(Record *record, RecordMonitorThread *thread);
267 int start_rendering();
268 int stop_rendering();
269 int render_frame(VFrame *frame, long size);
271 RecordMonitorThread *thread;
275 // Don't want theme to need libdv to compile
279 class RecVideoOverlay
285 RecVideoOverlay(VFrame *vframe, int x, int y, int ticks, float scale, float alpha);
288 int overlay(VFrame *out);