1 #include "channelpicker.h"
6 #include "edlsession.h"
9 #include "vdeviceprefs.h"
10 #include "videoconfig.h"
11 #include "videodevice.inc"
12 #include "playbackconfig.h"
13 #include "preferences.h"
14 #include "preferencesthread.h"
15 #include "recordconfig.h"
19 VDevicePrefs::VDevicePrefs(int x,
21 PreferencesWindow *pwindow,
22 PreferencesDialog *dialog,
23 VideoOutConfig *out_config,
24 VideoInConfig *in_config,
27 this->pwindow = pwindow;
28 this->dialog = dialog;
31 this->out_config = out_config;
32 this->in_config = in_config;
40 VDevicePrefs::~VDevicePrefs()
47 void VDevicePrefs::reset_objects()
58 firewire_channels = 0;
63 int VDevicePrefs::initialize()
71 driver = &out_config->driver;
75 driver = &in_config->driver;
78 this->driver = *driver;
82 dialog->add_subwindow(menu = new VDriverMenu(x,
87 menu->create_objects();
98 case VIDEO4LINUX2JPEG:
99 create_v4l2jpeg_objs();
102 create_screencap_objs();
112 case PLAYBACK_X11_XV:
115 case PLAYBACK_DV1394:
116 case PLAYBACK_FIREWIRE:
117 case CAPTURE_FIREWIRE:
118 create_firewire_objs();
124 int VDevicePrefs::delete_objects()
131 delete channel_picker;
132 delete buz_swap_channels;
138 if(device_text) delete device_text;
140 if(port_title) delete port_title;
141 if(firewire_port) delete firewire_port;
142 if(channel_title) delete channel_title;
143 if(firewire_channel) delete firewire_channel;
144 if(device_title) delete device_title;
145 if(firewire_path) delete firewire_path;
146 if(syt_title) delete syt_title;
147 if(firewire_syt) delete firewire_syt;
154 int VDevicePrefs::create_lml_objs()
157 int x1 = x + menu->get_w() + 5;
162 output_char = out_config->lml_out_device;
165 output_char = in_config->lml_in_device;
168 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, BLACK));
169 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
173 int VDevicePrefs::create_buz_objs()
176 int x1 = x + menu->get_w() + 5;
183 output_char = out_config->buz_out_device;
186 output_char = in_config->buz_in_device;
189 dialog->add_subwindow(device_title = new BC_Title(x1, y1, _("Device path:"), MEDIUMFONT, BLACK));
192 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y1, output_char));
194 if(driver == PLAYBACK_BUZ)
196 dialog->add_subwindow(buz_swap_channels =
197 new VDeviceCheckBox(x2, y1, &out_config->buz_swap_fields, _("Swap fields")));
200 if(driver == PLAYBACK_BUZ)
202 dialog->add_subwindow(output_title = new BC_Title(x1, y1, _("Output channel:")));
204 channel_picker = new PrefsChannelPicker(pwindow->mwindow,
206 pwindow->mwindow->channeldb_buz,
209 channel_picker->create_objects();
214 int VDevicePrefs::create_firewire_objs()
218 int x1 = x + menu->get_w() + 5;
224 if(driver == PLAYBACK_DV1394)
225 output_char = out_config->dv1394_path;
227 output_char = out_config->firewire_path;
230 // Our version of raw1394 doesn't support changing the input path
237 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device Path:"), MEDIUMFONT, BLACK));
238 dialog->add_subwindow(firewire_path = new VDeviceTextBox(x1, y + 20, output_char));
239 x1 += firewire_path->get_w() + 5;
246 if(driver == PLAYBACK_DV1394)
247 output_int = &out_config->dv1394_port;
249 output_int = &out_config->firewire_port;
252 output_int = &in_config->firewire_port;
255 dialog->add_subwindow(port_title = new BC_Title(x1, y, _("Port:"), MEDIUMFONT, BLACK));
256 dialog->add_subwindow(firewire_port = new VDeviceIntBox(x1, y + 20, output_int));
257 x1 += firewire_port->get_w() + 5;
263 if(driver == PLAYBACK_DV1394)
264 output_int = &out_config->dv1394_channel;
266 output_int = &out_config->firewire_channel;
269 output_int = &in_config->firewire_channel;
273 dialog->add_subwindow(channel_title = new BC_Title(x1, y, _("Channel:"), MEDIUMFONT, BLACK));
274 dialog->add_subwindow(firewire_channel = new VDeviceIntBox(x1, y + 20, output_int));
275 x1 += firewire_channel->get_w() + 5;
282 if(driver == PLAYBACK_DV1394)
283 output_int = &out_config->dv1394_syt;
285 output_int = &out_config->firewire_syt;
293 dialog->add_subwindow(syt_title = new BC_Title(x1, y, _("Syt Offset:"), MEDIUMFONT, BLACK));
294 dialog->add_subwindow(firewire_syt = new VDeviceIntBox(x1, y + 20, output_int));
300 int VDevicePrefs::create_v4l_objs()
303 int x1 = x + menu->get_w() + 5;
304 output_char = pwindow->thread->edl->session->vconfig_in->v4l_in_device;
305 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, BLACK));
306 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
310 int VDevicePrefs::create_v4l2_objs()
313 int x1 = x + menu->get_w() + 5;
314 output_char = pwindow->thread->edl->session->vconfig_in->v4l2_in_device;
315 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, BLACK));
316 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
320 int VDevicePrefs::create_v4l2jpeg_objs()
323 int x1 = x + menu->get_w() + 5;
324 output_char = pwindow->thread->edl->session->vconfig_in->v4l2jpeg_in_device;
325 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, BLACK));
326 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
332 int VDevicePrefs::create_screencap_objs()
335 int x1 = x + menu->get_w() + 5;
336 output_char = pwindow->thread->edl->session->vconfig_in->screencapture_display;
337 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Display:"), MEDIUMFONT, BLACK));
338 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
342 int VDevicePrefs::create_x11_objs()
345 int x1 = x + menu->get_w() + 5;
346 output_char = out_config->x11_host;
347 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Display for compositor:"), MEDIUMFONT, BLACK));
348 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
355 VDriverMenu::VDriverMenu(int x,
357 VDevicePrefs *device_prefs,
360 : BC_PopupMenu(x, y, 200, driver_to_string(*output))
362 this->output = output;
363 this->do_input = do_input;
364 this->device_prefs = device_prefs;
367 VDriverMenu::~VDriverMenu()
371 char* VDriverMenu::driver_to_string(int driver)
376 sprintf(string, VIDEO4LINUX_TITLE);
379 sprintf(string, VIDEO4LINUX2_TITLE);
381 case VIDEO4LINUX2JPEG:
382 sprintf(string, VIDEO4LINUX2JPEG_TITLE);
385 sprintf(string, SCREENCAPTURE_TITLE);
388 sprintf(string, CAPTURE_BUZ_TITLE);
391 sprintf(string, CAPTURE_LML_TITLE);
393 case CAPTURE_FIREWIRE:
394 sprintf(string, CAPTURE_FIREWIRE_TITLE);
397 sprintf(string, PLAYBACK_X11_TITLE);
399 case PLAYBACK_X11_XV:
400 sprintf(string, PLAYBACK_X11_XV_TITLE);
403 sprintf(string, PLAYBACK_LML_TITLE);
406 sprintf(string, PLAYBACK_BUZ_TITLE);
408 case PLAYBACK_FIREWIRE:
409 sprintf(string, PLAYBACK_FIREWIRE_TITLE);
411 case PLAYBACK_DV1394:
412 sprintf(string, PLAYBACK_DV1394_TITLE);
420 int VDriverMenu::create_objects()
424 add_item(new VDriverItem(this, VIDEO4LINUX_TITLE, VIDEO4LINUX));
425 #ifdef HAVE_VIDEO4LINUX2
426 add_item(new VDriverItem(this, VIDEO4LINUX2_TITLE, VIDEO4LINUX2));
427 add_item(new VDriverItem(this, VIDEO4LINUX2JPEG_TITLE, VIDEO4LINUX2JPEG));
429 add_item(new VDriverItem(this, SCREENCAPTURE_TITLE, SCREENCAPTURE));
430 add_item(new VDriverItem(this, CAPTURE_BUZ_TITLE, CAPTURE_BUZ));
431 add_item(new VDriverItem(this, CAPTURE_FIREWIRE_TITLE, CAPTURE_FIREWIRE));
435 add_item(new VDriverItem(this, PLAYBACK_X11_TITLE, PLAYBACK_X11));
436 add_item(new VDriverItem(this, PLAYBACK_X11_XV_TITLE, PLAYBACK_X11_XV));
437 add_item(new VDriverItem(this, PLAYBACK_BUZ_TITLE, PLAYBACK_BUZ));
438 add_item(new VDriverItem(this, PLAYBACK_FIREWIRE_TITLE, PLAYBACK_FIREWIRE));
439 add_item(new VDriverItem(this, PLAYBACK_DV1394_TITLE, PLAYBACK_DV1394));
445 VDriverItem::VDriverItem(VDriverMenu *popup, char *text, int driver)
449 this->driver = driver;
452 VDriverItem::~VDriverItem()
456 int VDriverItem::handle_event()
458 popup->set_text(get_text());
459 *(popup->output) = driver;
460 popup->device_prefs->initialize();
467 VDeviceTextBox::VDeviceTextBox(int x, int y, char *output)
468 : BC_TextBox(x, y, 200, 1, output)
470 this->output = output;
473 int VDeviceTextBox::handle_event()
475 strcpy(output, get_text());
478 VDeviceIntBox::VDeviceIntBox(int x, int y, int *output)
479 : BC_TextBox(x, y, 60, 1, *output)
481 this->output = output;
484 int VDeviceIntBox::handle_event()
486 *output = atol(get_text());
492 VDeviceCheckBox::VDeviceCheckBox(int x, int y, int *output, char *text)
493 : BC_CheckBox(x, y, *output, text)
495 this->output = output;
497 int VDeviceCheckBox::handle_event()
499 *output = get_value();