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;
90 class RecordMonitorGUI : public BC_Window
93 RecordMonitorGUI(MWindow *mwindow, Record *record,
94 RecordMonitor *thread, int min_w);
97 void create_objects();
98 int cursor_leave_event();
99 int cursor_enter_event();
100 int button_release_event();
101 int cursor_motion_event();
103 void display_video_text(int x, int y, const char *text, int font,
104 int bg_color, int color, int alpha, double secs, double scale);
105 void enable_signal_status(int enable);
109 // RecordTransport *record_transport;
111 AVC1394Transport *avc1394_transport;
112 AVC1394TransportThread *avc1394transport_thread;
114 RecordChannelPicker *channel_picker;
115 ScopeEnable *scope_toggle;
116 ReverseInterlace *reverse_interlace;
117 int cursor_x_origin, cursor_y_origin;
118 int translate_x_origin, translate_y_origin;
119 BC_PopupMenu *monitor_menu;
120 int current_operation;
123 int translation_event();
124 int button_press_event();
125 int resize_event(int w, int h);
130 int keypress_event();
133 BC_SubWindow *mbuttons;
135 RecordMonitor *thread;
139 BC_Title *avc1394transport_title;
140 BC_Title *avc1394transport_timecode;
142 SignalStatus *signal_status;
146 class RecVideoMJPGThread;
147 class RecVideoDVThread;
148 class RecVideoOverlay;
150 class RecordMonitorThread : public Thread
152 void show_output_frame();
153 void render_uncompressed();
156 void process_scope();
159 int ready; // Ready to recieve the next frame
161 RecVideoMJPGThread *jpeg_engine;
162 RecVideoDVThread *dv_engine;
164 RecordMonitorThread(MWindow *mwindow,
166 RecordMonitor *record_monitor);
167 ~RecordMonitorThread();
169 void reset_parameters();
171 // Calculate the best output format based on input drivers
172 void init_output_format();
173 int start_playback();
175 int write_frame(VFrame *new_frame);
179 void new_output_frame();
180 void display_vframe(VFrame *in, int x, int y,
181 int alpha, double secs, double scale);
182 void undisplay_vframe();
183 int finished() { return done; }
185 // Input frame being rendered
187 // Frames for the rendered output
188 VFrame *output_frame;
189 // Best color model given by device
190 int output_colormodel;
191 // Block until new input data
192 Condition *output_lock;
193 Condition *input_lock;
195 RecordMonitor *record_monitor;
197 // If the input frame is the same data that the file handle uses
200 RecVideoOverlay *ovly;
203 class RecordMonitorFullsize : public BC_MenuItem
206 RecordMonitorFullsize(MWindow *mwindow, RecordMonitorGUI *window);
210 RecordMonitorGUI *window;
213 class RecordMonitorCanvas : public Canvas
216 RecordMonitorCanvas(MWindow *mwindow, RecordMonitorGUI *window,
217 Record *record, int x, int y, int w, int h);
218 ~RecordMonitorCanvas();
220 void zoom_resize_window(float percentage);
221 int button_press_event();
222 int button_release_event();
223 int cursor_motion_event();
224 int cursor_enter_event();
225 void reset_translation();
226 int keypress_event();
229 int get_fullscreen();
230 void set_fullscreen(int value);
233 RecordMonitorGUI *window;
238 class ReverseInterlace : public BC_CheckBox
241 ReverseInterlace(Record *record, int x, int y);
247 class RecVideoMJPGThread
250 RecVideoMJPGThread(Record *record,
251 RecordMonitorThread *thread,
253 ~RecVideoMJPGThread();
255 int render_frame(VFrame *frame, long size);
256 int start_rendering();
257 int stop_rendering();
259 RecordMonitorThread *thread;
267 class RecVideoDVThread
270 RecVideoDVThread(Record *record, RecordMonitorThread *thread);
273 int start_rendering();
274 int stop_rendering();
275 int render_frame(VFrame *frame, long size);
277 RecordMonitorThread *thread;
281 // Don't want theme to need libdv to compile
285 class RecVideoOverlay
291 RecVideoOverlay(VFrame *vframe, int x, int y, int ticks, float scale, float alpha);
294 int overlay(VFrame *out);