Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / cinelerra / recordmonitor.h
blob9c2ba830eec0382806c769a95c53187bd5025965
1 #ifndef RECORDMONITOR_H
2 #define RECORDMONITOR_H
4 #ifdef HAVE_FIREWIRE
5 #include "avc1394transport.h"
6 #endif
7 #include "canvas.h"
8 #include "channelpicker.inc"
9 #include "condition.inc"
10 #include "guicast.h"
11 #include "channelpicker.inc"
12 #include "libmjpeg.h"
13 #include "meterpanel.inc"
14 #include "preferences.inc"
15 #include "record.inc"
16 #include "recordgui.inc"
17 #include "recordtransport.inc"
18 #include "recordmonitor.inc"
19 #include "videodevice.inc"
21 class RecordMonitorThread;
24 class RecordMonitor : public Thread
26 public:
27 RecordMonitor(MWindow *mwindow, Record *record);
28 ~RecordMonitor();
30 // Show a frame
31 int update(VFrame *vframe);
32 // Update channel textbox
33 void update_channel(char *text);
35 MWindow *mwindow;
36 Record *record;
37 // Thread for slippery monitoring
38 RecordMonitorThread *thread;
39 RecordMonitorGUI *window;
40 VideoDevice *device;
41 // Fake config for monitoring
42 VideoOutConfig *config;
52 void run();
54 int close_threads(); // Stop all the child threads on exit
55 int create_objects();
56 int fix_size(int &w, int &h, int width_given, float aspect_ratio);
57 float get_scale(int w);
58 int get_mbuttons_height();
59 int get_canvas_height();
60 int get_channel_x();
61 int get_channel_y();
64 class ReverseInterlace;
65 class RecordMonitorCanvas;
67 class RecordMonitorGUI : public BC_Window
69 public:
70 RecordMonitorGUI(MWindow *mwindow,
71 Record *record,
72 RecordMonitor *thread,
73 int min_w);
74 ~RecordMonitorGUI();
76 int create_objects();
77 int cursor_leave_event();
78 int cursor_enter_event();
79 int button_release_event();
80 int cursor_motion_event();
82 MeterPanel *meters;
83 Canvas *canvas;
84 // RecordTransport *record_transport;
85 #ifdef HAVE_FIREWIRE
86 AVC1394Transport *avc1394_transport;
87 AVC1394TransportThread *avc1394transport_thread;
88 #endif
89 RecordChannelPicker *channel_picker;
90 ReverseInterlace *reverse_interlace;
91 int cursor_x_origin, cursor_y_origin;
92 int translate_x_origin, translate_y_origin;
93 BC_PopupMenu *monitor_menu;
94 int current_operation;
109 int translation_event();
110 int button_press_event();
111 int resize_event(int w, int h);
112 int set_title();
113 int close_event();
114 int create_bitmap();
115 int keypress_event();
117 MWindow *mwindow;
118 BC_SubWindow *mbuttons;
119 BC_Bitmap *bitmap;
120 RecordMonitor *thread;
121 Record *record;
122 #ifdef HAVE_FIREWIRE
123 AVC1394Control *avc;
124 BC_Title *avc1394transport_title;
125 BC_Title *avc1394transport_timecode;
126 #endif
133 class RecVideoMJPGThread;
134 class RecVideoDVThread;
136 class RecordMonitorThread : public Thread
138 public:
139 RecordMonitorThread(MWindow *mwindow, Record *record, RecordMonitor *record_monitor);
140 ~RecordMonitorThread();
142 void reset_parameters();
143 void run();
144 // Calculate the best output format based on input drivers
145 void init_output_format();
146 int start_playback();
147 int stop_playback();
148 int write_frame(VFrame *new_frame);
149 int render_frame();
150 void unlock_input();
151 void new_output_frame();
153 // Input frame being rendered
154 VFrame *input_frame;
155 // Frames for the rendered output
156 VFrame *output_frame;
157 // Best color model given by device
158 int output_colormodel;
159 // Block until new input data
160 Condition *output_lock;
161 Condition *input_lock;
162 Record *record;
163 RecordMonitor *record_monitor;
164 MWindow *mwindow;
165 // If the input frame is the same data that the file handle uses
166 int shared_data;
169 private:
170 void show_output_frame();
171 void render_uncompressed();
172 int render_jpeg();
173 int render_dv();
175 int ready; // Ready to recieve the next frame
176 int done;
177 RecVideoMJPGThread *jpeg_engine;
178 RecVideoDVThread *dv_engine;
181 class RecordMonitorFullsize : public BC_MenuItem
183 public:
184 RecordMonitorFullsize(MWindow *mwindow,
185 RecordMonitorGUI *window);
187 int handle_event();
189 MWindow *mwindow;
190 RecordMonitorGUI *window;
193 class RecordMonitorCanvas : public Canvas
195 public:
196 RecordMonitorCanvas(MWindow *mwindow,
197 RecordMonitorGUI *window,
198 Record *record,
199 int x,
200 int y,
201 int w,
202 int h);
203 ~RecordMonitorCanvas();
205 void zoom_resize_window(float percentage);
206 int button_press_event();
207 int button_release_event();
208 int cursor_motion_event();
209 int cursor_enter_event();
210 void reset_translation();
211 int keypress_event();
212 int get_output_w();
213 int get_output_h();
214 int get_fullscreen();
215 void set_fullscreen(int value);
219 RecordMonitorGUI *window;
220 MWindow *mwindow;
221 Record *record;
224 class ReverseInterlace : public BC_CheckBox
226 public:
227 ReverseInterlace(Record *record, int x, int y);
228 ~ReverseInterlace();
229 int handle_event();
230 Record *record;
233 class RecVideoMJPGThread
235 public:
236 RecVideoMJPGThread(Record *record, RecordMonitorThread *thread);
237 ~RecVideoMJPGThread();
239 int render_frame(VFrame *frame, long size);
240 int start_rendering();
241 int stop_rendering();
243 RecordMonitorThread *thread;
244 Record *record;
246 private:
247 mjpeg_t *mjpeg;
250 class RecVideoDVThread
252 public:
253 RecVideoDVThread(Record *record, RecordMonitorThread *thread);
254 ~RecVideoDVThread();
256 int start_rendering();
257 int stop_rendering();
258 int render_frame(VFrame *frame, long size);
260 RecordMonitorThread *thread;
261 Record *record;
263 private:
264 // Don't want theme to need libdv to compile
265 void *dv;
268 #endif
270 // Local Variables:
271 // mode: C++
272 // c-file-style: "linux"
273 // End: