00001 #ifndef RECORDMONITOR_H
00002 #define RECORDMONITOR_H
00003
00004 #ifdef HAVE_FIREWIRE
00005 #include "avc1394transport.h"
00006 #endif
00007 #include "canvas.h"
00008 #include "channelpicker.inc"
00009 #include "condition.inc"
00010 #include "guicast.h"
00011 #include "channelpicker.inc"
00012 #include "libmjpeg.h"
00013 #include "meterpanel.inc"
00014 #include "preferences.inc"
00015 #include "record.inc"
00016 #include "recordgui.inc"
00017 #include "recordtransport.inc"
00018 #include "recordmonitor.inc"
00019 #include "videodevice.inc"
00020
00021 class RecordMonitorThread;
00022
00023
00024 class RecordMonitor : public Thread
00025 {
00026 public:
00027 RecordMonitor(MWindow *mwindow, Record *record);
00028 ~RecordMonitor();
00029
00030
00031 int update(VFrame *vframe);
00032
00033 void update_channel(char *text);
00034
00035 MWindow *mwindow;
00036 Record *record;
00037
00038 RecordMonitorThread *thread;
00039 RecordMonitorGUI *window;
00040 VideoDevice *device;
00041
00042 VideoOutConfig *config;
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 void run();
00053
00054 int close_threads();
00055 int create_objects();
00056 int fix_size(int &w, int &h, int width_given, float aspect_ratio);
00057 float get_scale(int w);
00058 int get_mbuttons_height();
00059 int get_canvas_height();
00060 int get_channel_x();
00061 int get_channel_y();
00062 };
00063
00064 class ReverseInterlace;
00065 class RecordMonitorCanvas;
00066
00067 class RecordMonitorGUI : public BC_Window
00068 {
00069 public:
00070 RecordMonitorGUI(MWindow *mwindow,
00071 Record *record,
00072 RecordMonitor *thread,
00073 int min_w);
00074 ~RecordMonitorGUI();
00075
00076 int create_objects();
00077 int cursor_leave_event();
00078 int cursor_enter_event();
00079 int button_release_event();
00080 int cursor_motion_event();
00081
00082 MeterPanel *meters;
00083 Canvas *canvas;
00084
00085 #ifdef HAVE_FIREWIRE
00086 AVC1394Transport *avc1394_transport;
00087 AVC1394TransportThread *avc1394transport_thread;
00088 #endif
00089 RecordChannelPicker *channel_picker;
00090 ReverseInterlace *reverse_interlace;
00091 int cursor_x_origin, cursor_y_origin;
00092 int translate_x_origin, translate_y_origin;
00093 BC_PopupMenu *monitor_menu;
00094 int current_operation;
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 int translation_event();
00110 int button_press_event();
00111 int resize_event(int w, int h);
00112 int set_title();
00113 int close_event();
00114 int create_bitmap();
00115 int keypress_event();
00116
00117 MWindow *mwindow;
00118 BC_SubWindow *mbuttons;
00119 BC_Bitmap *bitmap;
00120 RecordMonitor *thread;
00121 Record *record;
00122 #ifdef HAVE_FIREWIRE
00123 AVC1394Control *avc;
00124 BC_Title *avc1394transport_title;
00125 BC_Title *avc1394transport_timecode;
00126 #endif
00127 };
00128
00129
00130
00131
00132
00133 class RecVideoMJPGThread;
00134 class RecVideoDVThread;
00135
00136 class RecordMonitorThread : public Thread
00137 {
00138 public:
00139 RecordMonitorThread(MWindow *mwindow, Record *record, RecordMonitor *record_monitor);
00140 ~RecordMonitorThread();
00141
00142 void reset_parameters();
00143 void run();
00144
00145 void init_output_format();
00146 int start_playback();
00147 int stop_playback();
00148 int write_frame(VFrame *new_frame);
00149 int render_frame();
00150 void unlock_input();
00151 void new_output_frame();
00152
00153
00154 VFrame *input_frame;
00155
00156 VFrame *output_frame;
00157
00158 int output_colormodel;
00159
00160 Condition *output_lock;
00161 Condition *input_lock;
00162 Record *record;
00163 RecordMonitor *record_monitor;
00164 MWindow *mwindow;
00165
00166 int shared_data;
00167
00168
00169 private:
00170 void show_output_frame();
00171 void render_uncompressed();
00172 int render_jpeg();
00173 int render_dv();
00174
00175 int ready;
00176 int done;
00177 RecVideoMJPGThread *jpeg_engine;
00178 RecVideoDVThread *dv_engine;
00179 };
00180
00181 class RecordMonitorFullsize : public BC_MenuItem
00182 {
00183 public:
00184 RecordMonitorFullsize(MWindow *mwindow,
00185 RecordMonitorGUI *window);
00186
00187 int handle_event();
00188
00189 MWindow *mwindow;
00190 RecordMonitorGUI *window;
00191 };
00192
00193 class RecordMonitorCanvas : public Canvas
00194 {
00195 public:
00196 RecordMonitorCanvas(MWindow *mwindow,
00197 RecordMonitorGUI *window,
00198 Record *record,
00199 int x,
00200 int y,
00201 int w,
00202 int h);
00203 ~RecordMonitorCanvas();
00204
00205 void zoom_resize_window(float percentage);
00206 int button_press_event();
00207 int button_release_event();
00208 int cursor_motion_event();
00209 int cursor_enter_event();
00210 void reset_translation();
00211 int keypress_event();
00212 int get_output_w();
00213 int get_output_h();
00214 int get_fullscreen();
00215 void set_fullscreen(int value);
00216
00217
00218
00219 RecordMonitorGUI *window;
00220 MWindow *mwindow;
00221 Record *record;
00222 };
00223
00224 class ReverseInterlace : public BC_CheckBox
00225 {
00226 public:
00227 ReverseInterlace(Record *record, int x, int y);
00228 ~ReverseInterlace();
00229 int handle_event();
00230 Record *record;
00231 };
00232
00233 class RecVideoMJPGThread
00234 {
00235 public:
00236 RecVideoMJPGThread(Record *record, RecordMonitorThread *thread);
00237 ~RecVideoMJPGThread();
00238
00239 int render_frame(VFrame *frame, long size);
00240 int start_rendering();
00241 int stop_rendering();
00242
00243 RecordMonitorThread *thread;
00244 Record *record;
00245
00246 private:
00247 mjpeg_t *mjpeg;
00248 };
00249
00250 class RecVideoDVThread
00251 {
00252 public:
00253 RecVideoDVThread(Record *record, RecordMonitorThread *thread);
00254 ~RecVideoDVThread();
00255
00256 int start_rendering();
00257 int stop_rendering();
00258 int render_frame(VFrame *frame, long size);
00259
00260 RecordMonitorThread *thread;
00261 Record *record;
00262
00263 private:
00264
00265 void *dv;
00266 };
00267
00268 #endif