1 #include "channelpicker.h"
3 #include "edlsession.h"
5 #include "vdeviceprefs.h"
6 #include "videoconfig.h"
7 #include "videodevice.inc"
8 #include "playbackconfig.h"
9 #include "preferences.h"
10 #include "preferencesthread.h"
11 #include "recordconfig.h"
15 #define _(String) gettext(String)
16 #define gettext_noop(String) String
17 #define N_(String) gettext_noop (String)
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()
49 int VDevicePrefs::initialize()
57 driver = &out_config->driver;
61 driver = &in_config->driver;
64 this->driver = *driver;
68 dialog->add_subwindow(menu = new VDriverMenu(x,
73 menu->create_objects();
82 create_screencap_objs();
95 case PLAYBACK_FIREWIRE:
96 case CAPTURE_FIREWIRE:
97 create_firewire_objs();
103 int VDevicePrefs::delete_objects()
108 case PLAYBACK_X11_XV:
117 delete channel_picker;
118 delete buz_swap_channels;
127 case PLAYBACK_FIREWIRE:
128 case CAPTURE_FIREWIRE:
130 delete firewire_port;
131 delete channel_title;
132 delete firewire_channel;
136 delete firewire_path;
144 delete firewire_use_dv1394;
145 firewire_use_dv1394 = 0;
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 output_char = out_config->firewire_path;
227 // Our version of raw1394 doesn't support changing the input path
234 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device Path:"), MEDIUMFONT, BLACK));
235 dialog->add_subwindow(firewire_path = new VDeviceTextBox(x1, y + 20, output_char));
236 x1 += firewire_path->get_w() + 5;
243 output_int = &out_config->firewire_port;
246 output_int = &in_config->firewire_port;
249 dialog->add_subwindow(port_title = new BC_Title(x1, y, _("Port:"), MEDIUMFONT, BLACK));
250 dialog->add_subwindow(firewire_port = new VDeviceIntBox(x1, y + 20, output_int));
251 x1 += firewire_port->get_w() + 5;
257 output_int = &out_config->firewire_channel;
260 output_int = &in_config->firewire_channel;
264 dialog->add_subwindow(channel_title = new BC_Title(x1, y, _("Channel:"), MEDIUMFONT, BLACK));
265 dialog->add_subwindow(firewire_channel = new VDeviceIntBox(x1, y + 20, output_int));
266 x1 += firewire_channel->get_w() + 5;
273 output_int = &out_config->firewire_syt;
281 dialog->add_subwindow(syt_title = new BC_Title(x1, y, _("Syt Offset:"), MEDIUMFONT, BLACK));
282 dialog->add_subwindow(firewire_syt = new VDeviceIntBox(x1, y + 20, output_int));
284 x1 = x + menu->get_w() + 5;
289 output_int = &out_config->firewire_use_dv1394;
292 //output_int = &in_config->firewire_use_dv1394;
299 dialog->add_subwindow(firewire_use_dv1394 =
300 new VDeviceCheckBox(x1, y + 45, output_int, _("Use DV1394")));
306 int VDevicePrefs::create_v4l_objs()
309 int x1 = x + menu->get_w() + 5;
310 output_char = pwindow->thread->edl->session->vconfig_in->v4l_in_device;
311 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, BLACK));
312 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
316 int VDevicePrefs::create_screencap_objs()
319 int x1 = x + menu->get_w() + 5;
320 output_char = pwindow->thread->edl->session->vconfig_in->screencapture_display;
321 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Display:"), MEDIUMFONT, BLACK));
322 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
326 int VDevicePrefs::create_x11_objs()
329 int x1 = x + menu->get_w() + 5;
330 output_char = out_config->x11_host;
331 dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Display for compositor:"), MEDIUMFONT, BLACK));
332 dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char));
339 VDriverMenu::VDriverMenu(int x,
341 VDevicePrefs *device_prefs,
344 : BC_PopupMenu(x, y, 150, driver_to_string(*output))
346 this->output = output;
347 this->do_input = do_input;
348 this->device_prefs = device_prefs;
351 VDriverMenu::~VDriverMenu()
355 char* VDriverMenu::driver_to_string(int driver)
360 sprintf(string, VIDEO4LINUX_TITLE);
363 sprintf(string, SCREENCAPTURE_TITLE);
366 sprintf(string, CAPTURE_BUZ_TITLE);
369 sprintf(string, CAPTURE_LML_TITLE);
371 case CAPTURE_FIREWIRE:
372 sprintf(string, CAPTURE_FIREWIRE_TITLE);
375 sprintf(string, PLAYBACK_X11_TITLE);
377 case PLAYBACK_X11_XV:
378 sprintf(string, PLAYBACK_X11_XV_TITLE);
381 sprintf(string, PLAYBACK_LML_TITLE);
384 sprintf(string, PLAYBACK_BUZ_TITLE);
386 case PLAYBACK_FIREWIRE:
387 sprintf(string, PLAYBACK_FIREWIRE_TITLE);
395 int VDriverMenu::create_objects()
399 add_item(new VDriverItem(this, VIDEO4LINUX_TITLE, VIDEO4LINUX));
400 add_item(new VDriverItem(this, SCREENCAPTURE_TITLE, SCREENCAPTURE));
401 add_item(new VDriverItem(this, CAPTURE_BUZ_TITLE, CAPTURE_BUZ));
402 add_item(new VDriverItem(this, CAPTURE_FIREWIRE_TITLE, CAPTURE_FIREWIRE));
406 add_item(new VDriverItem(this, PLAYBACK_X11_TITLE, PLAYBACK_X11));
407 add_item(new VDriverItem(this, PLAYBACK_X11_XV_TITLE, PLAYBACK_X11_XV));
408 add_item(new VDriverItem(this, PLAYBACK_BUZ_TITLE, PLAYBACK_BUZ));
409 add_item(new VDriverItem(this, PLAYBACK_FIREWIRE_TITLE, PLAYBACK_FIREWIRE));
415 VDriverItem::VDriverItem(VDriverMenu *popup, char *text, int driver)
419 this->driver = driver;
422 VDriverItem::~VDriverItem()
426 int VDriverItem::handle_event()
428 popup->set_text(get_text());
429 *(popup->output) = driver;
430 popup->device_prefs->initialize();
437 VDeviceTextBox::VDeviceTextBox(int x, int y, char *output)
438 : BC_TextBox(x, y, 200, 1, output)
440 this->output = output;
443 int VDeviceTextBox::handle_event()
445 strcpy(output, get_text());
448 VDeviceIntBox::VDeviceIntBox(int x, int y, int *output)
449 : BC_TextBox(x, y, 60, 1, *output)
451 this->output = output;
454 int VDeviceIntBox::handle_event()
456 *output = atol(get_text());
462 VDeviceCheckBox::VDeviceCheckBox(int x, int y, int *output, char *text)
463 : BC_CheckBox(x, y, *output, text)
465 this->output = output;
467 int VDeviceCheckBox::handle_event()
469 *output = get_value();