2 #include "channelpicker.h"
7 #include "edlsession.h"
10 #include "vdeviceprefs.h"
11 #include "videoconfig.h"
12 #include "videodevice.inc"
13 #include "playbackconfig.h"
14 #include "preferences.h"
15 #include "preferencesthread.h"
16 #include "recordconfig.h"
20 VDevicePrefs::VDevicePrefs(int x,
22 PreferencesWindow *pwindow,
23 PreferencesDialog *dialog,
24 VideoOutConfig *out_config,
25 VideoInConfig *in_config,
28 this->pwindow = pwindow;
29 this->dialog = dialog;
32 this->out_config = out_config;
33 this->in_config = in_config;
41 VDevicePrefs::~VDevicePrefs()
48 void VDevicePrefs::reset_objects()
62 firewire_channels = 0;
68 int VDevicePrefs::initialize()
76 driver = &out_config->driver;
80 driver = &in_config->driver;
83 this->driver = *driver;
87 dialog->add_subwindow(menu = new VDriverMenu(x,
92 menu->create_objects();
103 case VIDEO4LINUX2JPEG:
104 create_v4l2jpeg_objs();
107 create_screencap_objs();
117 case PLAYBACK_X11_XV:
118 case PLAYBACK_X11_GL:
121 case PLAYBACK_DV1394:
122 case PLAYBACK_FIREWIRE:
123 case PLAYBACK_IEC61883:
124 case CAPTURE_FIREWIRE:
125 case CAPTURE_IEC61883:
126 create_firewire_objs();
135 int VDevicePrefs::delete_objects()
143 delete channel_picker;
144 delete buz_swap_channels;
150 if(device_text) delete device_text;
152 if(port_title) delete port_title;
154 if(firewire_port) delete firewire_port;
156 if(channel_title) delete channel_title;
158 if(firewire_channel) delete firewire_channel;
161 if(device_title) delete device_title;
163 if(firewire_path) delete firewire_path;
165 if(syt_title) delete syt_title;
167 if(firewire_syt) delete firewire_syt;
175 int VDevicePrefs::create_lml_objs()
178 int x1 = x + menu->get_w() + 5;
179 BC_Resources *resources = BC_WindowBase::get_resources();
184 output_char = out_config->lml_out_device;
187 output_char = in_config->lml_in_device;
190 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, resources->text_default));
191 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
195 int VDevicePrefs::create_buz_objs()
198 int x1 = x + menu->get_w() + 5;
201 BC_Resources *resources = BC_WindowBase::get_resources();
206 output_char = out_config->buz_out_device;
209 output_char = in_config->buz_in_device;
212 dialog->add_subwindow(device_title = new BC_Title(x1, y1, _("Device path:"), MEDIUMFONT, resources->text_default));
215 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y1, output_char));
217 if(driver == PLAYBACK_BUZ)
219 dialog->add_subwindow(buz_swap_channels =
220 new VDeviceCheckBox(x2, y1, &out_config->buz_swap_fields, _("Swap fields")));
223 if(driver == PLAYBACK_BUZ)
225 dialog->add_subwindow(output_title = new BC_Title(x1, y1, _("Output channel:")));
227 channel_picker = new PrefsChannelPicker(pwindow->mwindow,
229 pwindow->mwindow->channeldb_buz,
232 channel_picker->create_objects();
237 int VDevicePrefs::create_firewire_objs()
240 char *output_char = 0;
241 int x1 = x + menu->get_w() + 5;
242 BC_Resources *resources = BC_WindowBase::get_resources();
248 if(driver == PLAYBACK_DV1394)
249 output_char = out_config->dv1394_path;
251 if(driver == PLAYBACK_FIREWIRE)
252 output_char = out_config->firewire_path;
255 if(driver == CAPTURE_FIREWIRE)
256 output_char = in_config->firewire_path;
262 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device Path:"), MEDIUMFONT, resources->text_default));
263 dialog->add_subwindow(firewire_path = new VDeviceTextBox(x1, y + 20, output_char));
264 x1 += firewire_path->get_w() + 5;
271 if(driver == PLAYBACK_DV1394)
272 output_int = &out_config->dv1394_port;
274 output_int = &out_config->firewire_port;
277 output_int = &in_config->firewire_port;
280 dialog->add_subwindow(port_title = new BC_Title(x1, y, _("Port:"), MEDIUMFONT, resources->text_default));
281 dialog->add_subwindow(firewire_port = new VDeviceIntBox(x1, y + 20, output_int));
282 x1 += firewire_port->get_w() + 5;
288 if(driver == PLAYBACK_DV1394)
289 output_int = &out_config->dv1394_channel;
291 output_int = &out_config->firewire_channel;
294 output_int = &in_config->firewire_channel;
298 dialog->add_subwindow(channel_title = new BC_Title(x1, y, _("Channel:"), MEDIUMFONT, resources->text_default));
299 dialog->add_subwindow(firewire_channel = new VDeviceIntBox(x1, y + 20, output_int));
300 x1 += firewire_channel->get_w() + 5;
307 if(driver == PLAYBACK_DV1394)
308 output_int = &out_config->dv1394_syt;
310 if(driver == PLAYBACK_FIREWIRE)
311 output_int = &out_config->firewire_syt;
321 dialog->add_subwindow(syt_title = new BC_Title(x1, y, _("Syt Offset:"), MEDIUMFONT, resources->text_default));
322 dialog->add_subwindow(firewire_syt = new VDeviceIntBox(x1, y + 20, output_int));
328 int VDevicePrefs::create_v4l_objs()
331 BC_Resources *resources = BC_WindowBase::get_resources();
332 int x1 = x + menu->get_w() + 5;
333 output_char = pwindow->thread->edl->session->vconfig_in->v4l_in_device;
334 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, resources->text_default));
335 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
339 int VDevicePrefs::create_v4l2_objs()
342 BC_Resources *resources = BC_WindowBase::get_resources();
343 int x1 = x + menu->get_w() + 5;
344 output_char = pwindow->thread->edl->session->vconfig_in->v4l2_in_device;
345 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, resources->text_default));
346 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
351 int VDevicePrefs::create_v4l2jpeg_objs()
353 BC_Resources *resources = BC_WindowBase::get_resources();
355 int x1 = x + menu->get_w() + 5;
356 output_char = pwindow->thread->edl->session->vconfig_in->v4l2jpeg_in_device;
357 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, resources->text_default));
358 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
365 int VDevicePrefs::create_screencap_objs()
368 BC_Resources *resources = BC_WindowBase::get_resources();
369 int x1 = x + menu->get_w() + 5;
370 output_char = pwindow->thread->edl->session->vconfig_in->screencapture_display;
371 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Display:"), MEDIUMFONT, resources->text_default));
372 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
376 int VDevicePrefs::create_x11_objs()
379 BC_Resources *resources = BC_WindowBase::get_resources();
380 int x1 = x + menu->get_w() + 5;
381 output_char = out_config->x11_host;
382 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Display for compositor:"), MEDIUMFONT, resources->text_default));
383 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
390 VDriverMenu::VDriverMenu(int x,
392 VDevicePrefs *device_prefs,
395 : BC_PopupMenu(x, y, 200, driver_to_string(*output))
397 this->output = output;
398 this->do_input = do_input;
399 this->device_prefs = device_prefs;
402 VDriverMenu::~VDriverMenu()
406 char* VDriverMenu::driver_to_string(int driver)
411 sprintf(string, VIDEO4LINUX_TITLE);
414 sprintf(string, VIDEO4LINUX2_TITLE);
416 case VIDEO4LINUX2JPEG:
417 sprintf(string, VIDEO4LINUX2JPEG_TITLE);
420 sprintf(string, SCREENCAPTURE_TITLE);
423 sprintf(string, CAPTURE_BUZ_TITLE);
426 sprintf(string, CAPTURE_LML_TITLE);
429 case CAPTURE_FIREWIRE:
430 sprintf(string, CAPTURE_FIREWIRE_TITLE);
432 case CAPTURE_IEC61883:
433 sprintf(string, CAPTURE_IEC61883_TITLE);
437 sprintf(string, PLAYBACK_X11_TITLE);
439 case PLAYBACK_X11_XV:
440 sprintf(string, PLAYBACK_X11_XV_TITLE);
442 case PLAYBACK_X11_GL:
443 sprintf(string, PLAYBACK_X11_GL_TITLE);
446 sprintf(string, PLAYBACK_LML_TITLE);
449 sprintf(string, PLAYBACK_BUZ_TITLE);
452 case PLAYBACK_FIREWIRE:
453 sprintf(string, PLAYBACK_FIREWIRE_TITLE);
455 case PLAYBACK_DV1394:
456 sprintf(string, PLAYBACK_DV1394_TITLE);
458 case PLAYBACK_IEC61883:
459 sprintf(string, PLAYBACK_IEC61883_TITLE);
468 int VDriverMenu::create_objects()
472 add_item(new VDriverItem(this, VIDEO4LINUX_TITLE, VIDEO4LINUX));
473 #ifdef HAVE_VIDEO4LINUX2
474 add_item(new VDriverItem(this, VIDEO4LINUX2_TITLE, VIDEO4LINUX2));
475 add_item(new VDriverItem(this, VIDEO4LINUX2JPEG_TITLE, VIDEO4LINUX2JPEG));
477 add_item(new VDriverItem(this, SCREENCAPTURE_TITLE, SCREENCAPTURE));
478 add_item(new VDriverItem(this, CAPTURE_BUZ_TITLE, CAPTURE_BUZ));
480 add_item(new VDriverItem(this, CAPTURE_FIREWIRE_TITLE, CAPTURE_FIREWIRE));
481 add_item(new VDriverItem(this, CAPTURE_IEC61883_TITLE, CAPTURE_IEC61883));
486 add_item(new VDriverItem(this, PLAYBACK_X11_TITLE, PLAYBACK_X11));
487 add_item(new VDriverItem(this, PLAYBACK_X11_XV_TITLE, PLAYBACK_X11_XV));
489 add_item(new VDriverItem(this, PLAYBACK_X11_GL_TITLE, PLAYBACK_X11_GL));
491 add_item(new VDriverItem(this, PLAYBACK_BUZ_TITLE, PLAYBACK_BUZ));
493 add_item(new VDriverItem(this, PLAYBACK_FIREWIRE_TITLE, PLAYBACK_FIREWIRE));
494 add_item(new VDriverItem(this, PLAYBACK_DV1394_TITLE, PLAYBACK_DV1394));
495 add_item(new VDriverItem(this, PLAYBACK_IEC61883_TITLE, PLAYBACK_IEC61883));
502 VDriverItem::VDriverItem(VDriverMenu *popup, char *text, int driver)
506 this->driver = driver;
509 VDriverItem::~VDriverItem()
513 int VDriverItem::handle_event()
515 popup->set_text(get_text());
516 *(popup->output) = driver;
517 popup->device_prefs->initialize();
524 VDeviceTextBox::VDeviceTextBox(int x, int y, char *output)
525 : BC_TextBox(x, y, 200, 1, output)
527 this->output = output;
530 int VDeviceTextBox::handle_event()
532 strcpy(output, get_text());
535 VDeviceIntBox::VDeviceIntBox(int x, int y, int *output)
536 : BC_TextBox(x, y, 60, 1, *output)
538 this->output = output;
541 int VDeviceIntBox::handle_event()
543 *output = atol(get_text());
551 VDeviceCheckBox::VDeviceCheckBox(int x, int y, int *output, char *text)
552 : BC_CheckBox(x, y, *output, text)
554 this->output = output;
556 int VDeviceCheckBox::handle_event()
558 *output = get_value();