1 #include "avc1394transport.h"
5 #include "recordmonitor.h"
9 #define POLL_INTERVAL 20000
11 AVC1394TransportThread::AVC1394TransportThread(BC_Title *label,
20 AVC1394TransportThread::~AVC1394TransportThread()
27 void AVC1394TransportThread::run()
33 Thread::disable_cancel();
34 text = avc->timecode();
35 label->lock_window("AVC1394TransportThread::run 1");
36 // Sometimes text is set to NULL for some reason...
38 label->update("Unknown");
41 label->unlock_window();
42 Thread::enable_cancel();
43 usleep(POLL_INTERVAL);
53 AVC1394Transport::AVC1394Transport(MWindow *mwindow,
55 BC_WindowBase *window,
59 this->mwindow = mwindow;
61 this->window = window;
66 AVC1394Transport::~AVC1394Transport()
71 int AVC1394Transport::create_objects()
73 int x = this->x, y = this->y;
75 window->add_subwindow(start_button = new AVC1394GUISeekStart(mwindow, avc, x, y));
76 x += start_button->get_w();
77 window->add_subwindow(rewind_button = new AVC1394GUIRewind(mwindow, avc, x, y));
78 x += rewind_button->get_w();
79 window->add_subwindow(reverse_button = new AVC1394GUIReverse(mwindow, avc, x, y));
80 x += reverse_button->get_w();
81 window->add_subwindow(stop_button = new AVC1394GUIStop(mwindow, avc, x, y));
82 x += stop_button->get_w();
83 window->add_subwindow(pause_button = new AVC1394GUIPause(mwindow, avc, x, y));
84 x += pause_button->get_w();
85 window->add_subwindow(play_button = new AVC1394GUIPlay(mwindow, avc, x, y));
86 x += play_button->get_w();
87 window->add_subwindow(fforward_button = new AVC1394GUIFForward(mwindow, avc, x, y));
88 x += fforward_button->get_w();
89 window->add_subwindow(end_button = new AVC1394GUISeekEnd(mwindow, avc, x, y));
90 x += end_button->get_w();
97 int AVC1394Transport::keypress_event(int keypress)
102 if(avc->current_command == PAUSE)
104 avc->current_command = NORMAL_FWD;
109 avc->current_command = PAUSE;
117 void AVC1394Transport::reposition_window(int x, int y)
122 start_button->reposition_window(x, y);
123 x += start_button->get_w();
124 rewind_button->reposition_window(x, y);
125 x += rewind_button->get_w();
126 reverse_button->reposition_window(x, y);
127 x += reverse_button->get_w();
128 stop_button->reposition_window(x, y);
129 x += stop_button->get_w();
130 pause_button->reposition_window(x, y);
131 x += pause_button->get_w();
132 play_button->reposition_window(x, y);
133 x += play_button->get_w();
134 fforward_button->reposition_window(x, y);
135 x += fforward_button->get_w();
136 end_button->reposition_window(x, y);
150 AVC1394GUISeekStart::AVC1394GUISeekStart(MWindow *mwindow, AVC1394Control *avc, int x, int y)
151 : BC_Button(x, y, mwindow->theme->get_image_set("rewind"))
154 set_tooltip(_("Rewind ( Home )"));
157 AVC1394GUISeekStart::~AVC1394GUISeekStart()
161 int AVC1394GUISeekStart::handle_event()
163 avc->current_command = COMMAND_NONE;
164 avc->seek("00:00:00:00");
168 int AVC1394GUISeekStart::keypress_event()
170 if(get_keypress() == HOME) return handle_event();
175 AVC1394GUIRewind::AVC1394GUIRewind(MWindow *mwindow, AVC1394Control *avc, int x, int y)
176 : BC_Button(x, y, mwindow->theme->get_image_set("fastrev"))
179 set_tooltip(_("Fast Reverse ( + )"));
182 AVC1394GUIRewind::~AVC1394GUIRewind()
186 int AVC1394GUIRewind::handle_event()
188 avc->current_command = FAST_REWIND;
193 int AVC1394GUIRewind::keypress_event()
195 if(get_keypress() == KPPLUS) return handle_event();
199 AVC1394GUIReverse::AVC1394GUIReverse(MWindow *mwindow, AVC1394Control *avc, int x, int y)
200 : BC_Button(x, y, mwindow->theme->get_image_set("reverse"))
203 set_tooltip(_("Reverse Play ( 6 )"));
206 AVC1394GUIReverse::~AVC1394GUIReverse()
210 int AVC1394GUIReverse::handle_event()
212 if(avc->current_command == NORMAL_REWIND)
214 avc->current_command = PAUSE;
219 avc->current_command = NORMAL_REWIND;
225 int AVC1394GUIReverse::keypress_event()
227 if(get_keypress() == KP6) return handle_event();
231 AVC1394GUIStop::AVC1394GUIStop(MWindow *mwindow, AVC1394Control *avc, int x, int y)
232 : BC_Button(x, y, mwindow->theme->get_image_set("stop"))
235 set_tooltip(_("Stop ( 0 )"));
238 AVC1394GUIStop::~AVC1394GUIStop()
242 int AVC1394GUIStop::handle_event()
244 avc->current_command = COMMAND_NONE;
249 int AVC1394GUIStop::keypress_event()
251 if(get_keypress() == KPINS) return handle_event();
255 AVC1394GUIPlay::AVC1394GUIPlay(MWindow *mwindow, AVC1394Control *avc, int x, int y)
256 : BC_Button(x, y, mwindow->theme->get_image_set("play"))
260 set_tooltip(_("Play ( 3 )"));
263 AVC1394GUIPlay::~AVC1394GUIPlay()
267 int AVC1394GUIPlay::handle_event()
269 if(avc->current_command == NORMAL_FWD)
271 avc->current_command = PAUSE;
276 avc->current_command = NORMAL_FWD;
282 int AVC1394GUIPlay::keypress_event()
284 if(get_keypress() == KP3) return handle_event();
288 AVC1394GUIPause::AVC1394GUIPause(MWindow *mwindow, AVC1394Control *avc, int x,
290 : BC_Button(x, y, mwindow->theme->get_image_set("pause"))
293 set_tooltip(_("Pause"));
296 AVC1394GUIPause::~AVC1394GUIPause()
300 int AVC1394GUIPause::handle_event()
302 avc->current_command = PAUSE;
307 int AVC1394GUIPause::keypress_event()
312 AVC1394GUIFForward::AVC1394GUIFForward(MWindow *mwindow, AVC1394Control *avc, int x, int y)
313 : BC_Button(x, y, mwindow->theme->get_image_set("fastfwd"))
316 set_tooltip(_("Fast Forward ( Enter )"));
319 AVC1394GUIFForward::~AVC1394GUIFForward()
323 int AVC1394GUIFForward::handle_event()
325 avc->current_command = FAST_FWD;
330 int AVC1394GUIFForward::keypress_event()
332 if(get_keypress() == KPENTER) return handle_event();
337 AVC1394GUISeekEnd::AVC1394GUISeekEnd(MWindow *mwindow,
341 : BC_Button(x, y, mwindow->theme->get_image_set("end"))
344 set_tooltip(_("Jump to end ( End )"));
347 AVC1394GUISeekEnd::~AVC1394GUISeekEnd()
351 int AVC1394GUISeekEnd::handle_event()
353 avc->current_command = COMMAND_NONE;
354 avc->seek("ff:ff:ff:ff");
358 int AVC1394GUISeekEnd::keypress_event()
360 if(get_keypress() == END) return handle_event();