1 #include "adeviceprefs.h"
2 #include "audioconfig.h"
3 #include "audiodevice.inc"
7 #include "edlsession.h"
10 #include "overlayframe.inc"
11 #include "playbackprefs.h"
12 #include "preferences.h"
13 #include "vdeviceprefs.h"
14 #include "videodevice.inc"
18 PlaybackPrefs::PlaybackPrefs(MWindow *mwindow, PreferencesWindow *pwindow)
19 : PreferencesDialog(mwindow, pwindow)
22 // head_count_text = 0;
27 PlaybackPrefs::~PlaybackPrefs()
30 // mwindow->defaults->update("PLAYBACK_HEAD", current_head);
35 int PlaybackPrefs::create_objects()
38 char string[BCTEXTLEN];
39 BC_PopupTextBox *popup;
41 playback_config = pwindow->thread->edl->session->playback_config;
42 // current_head = mwindow->defaults->get("PLAYBACK_HEAD", 0);
43 // strategies.append(new BC_ListBoxItem(_("Local Host")));
44 // strategies.append(new BC_ListBoxItem(_("Multihead")));
45 // strategies.append(new BC_ListBoxItem(_("Blond Symphony")));
47 // Global playback options
49 // All strategies use these
50 add_subwindow(new BC_Title(x, y, _("Audio Out"), LARGEFONT, BLACK));
55 BC_Title *title1, *title2;
56 // add_subwindow(title1 = new BC_Title(x, y, _("Samples to read from disk at a time:"), MEDIUMFONT, BLACK));
57 add_subwindow(title2 = new BC_Title(x, y, _("Samples to send to console at a time:"), MEDIUMFONT, BLACK));
58 x2 = MAX(title2->get_w(), title2->get_w()) + 10;
60 // sprintf(string, "%d", pwindow->thread->edl->session->audio_read_length);
61 // add_subwindow(new PlaybackReadLength(x2, y, pwindow, this, string));
62 sprintf(string, "%d", playback_config->aconfig->fragment_size);
63 PlaybackModuleFragment *menu;
64 add_subwindow(menu = new PlaybackModuleFragment(x2,
69 menu->add_item(new BC_MenuItem("2048"));
70 menu->add_item(new BC_MenuItem("4096"));
71 menu->add_item(new BC_MenuItem("8192"));
72 menu->add_item(new BC_MenuItem("16384"));
73 menu->add_item(new BC_MenuItem("32768"));
74 menu->add_item(new BC_MenuItem("65536"));
75 menu->add_item(new BC_MenuItem("131072"));
76 menu->add_item(new BC_MenuItem("262144"));
79 add_subwindow(new PlaybackViewFollows(pwindow, pwindow->thread->edl->session->view_follows_playback, y));
81 add_subwindow(new PlaybackSoftwareTimer(pwindow, pwindow->thread->edl->session->playback_software_position, y));
83 add_subwindow(new PlaybackRealTime(pwindow, pwindow->thread->edl->session->real_time_playback, y));
85 add_subwindow(new BC_Title(x, y, _("Audio Driver:")));
86 audio_device = new ADevicePrefs(x + 100,
90 playback_config->aconfig,
93 audio_device->initialize();
95 // Strategic playback options created here
96 // set_strategy(pwindow->thread->edl->session->playback_strategy);
98 // add_subwindow(new BC_Title(x, y, _("Playback driver:"), MEDIUMFONT, BLACK));
99 // add_subwindow(new AudioDriverMenu(x, y + 20, out_device, &(pwindow->thread->preferences->aconfig->audio_out_driver), 0, 1));
102 add_subwindow(new BC_Title(x, y, _("Video Out"), LARGEFONT, BLACK));
105 add_subwindow(new VideoEveryFrame(pwindow, x, y));
107 add_subwindow(new BC_Title(x + 200, y + 10, _("Framerate achieved:")));
108 add_subwindow(framerate_title = new BC_Title(x + 350, y + 10, _("--"), MEDIUMFONT, RED));
112 add_subwindow(new BC_Title(x, y, _("Scaling equation:")));
114 add_subwindow(nearest_neighbor = new PlaybackNearest(pwindow,
116 pwindow->thread->edl->session->interpolation_type == NEAREST_NEIGHBOR,
120 add_subwindow(cubic_linear = new PlaybackBicubicBilinear(pwindow,
122 pwindow->thread->edl->session->interpolation_type == CUBIC_LINEAR,
126 add_subwindow(linear_linear = new PlaybackBilinearBilinear(pwindow,
128 pwindow->thread->edl->session->interpolation_type == LINEAR_LINEAR,
133 add_subwindow(new BC_Title(x, y, _("Preload buffer for Quicktime:"), MEDIUMFONT, BLACK));
134 sprintf(string, "%d", pwindow->thread->edl->session->playback_preload);
135 add_subwindow(new PlaybackPreload(x + 210, y, pwindow, this, string));
138 // add_subwindow(new PlaybackDeblock(pwindow, 10, y));
141 add_subwindow(vdevice_title = new BC_Title(x, y, _("Video Driver:")));
142 video_device = new VDevicePrefs(x + 100,
146 playback_config->vconfig,
149 video_device->initialize();
151 // Strategic playback options created here
152 // set_strategy(pwindow->thread->edl->session->playback_strategy, y);
158 // char* PlaybackPrefs::strategy_to_string(int strategy)
162 // case PLAYBACK_LOCALHOST:
163 // return _("Local Host");
165 // case PLAYBACK_MULTIHEAD:
166 // return _("Multihead");
168 // case PLAYBACK_BLONDSYMPHONY:
169 // return _("Blond Symphony");
172 // return _("Local Host");
175 // // Delete strategy dependant objects
176 // void PlaybackPrefs::delete_strategy()
181 // delete head_title;
186 // delete host_title;
190 // if(head_count_text)
192 // delete head_count_title;
193 // delete head_count_text;
194 // head_count_text = 0;
198 // delete vdevice_title;
199 // delete video_device;
204 // int PlaybackPrefs::set_strategy(int strategy)
206 // int x = 350, x1 = 450, y = 10;
207 // delete_strategy();
209 // pwindow->thread->edl->session->playback_strategy = strategy;
212 // case PLAYBACK_LOCALHOST:
214 // case PLAYBACK_MULTIHEAD:
215 // add_subwindow(head_title = new BC_Title(x, y, _("Head:")));
216 // head_text = new PlaybackHead(this, x1, y);
217 // head_text->create_objects();
219 // add_subwindow(head_count_title = new BC_Title(x, y, _("Total Heads:")));
220 // head_count_text = new PlaybackHeadCount(this, x1, y);
221 // head_count_text->create_objects();
224 // add_subwindow(vdevice_title = new BC_Title(x, y, _("Video Driver:")));
225 // video_device = new VDevicePrefs(x + 100,
229 // playback_config->vconfig,
232 // video_device->initialize();
234 // case PLAYBACK_BLONDSYMPHONY:
235 // add_subwindow(head_title = new BC_Title(x, y, _("Head:")));
236 // head_text = new PlaybackHead(this, x1, y);
237 // head_text->create_objects();
239 // add_subwindow(head_count_title = new BC_Title(x, y, _("Total Heads:")));
240 // head_count_text = new PlaybackHeadCount(this, x1, y);
241 // head_count_text->create_objects();
243 // add_subwindow(host_title = new BC_Title(x, y, _("Hostname:")));
244 // add_subwindow(host_text = new PlaybackHost(this, x1, y));
247 // add_subwindow(vdevice_title = new BC_Title(x, y, _("Video Driver:")));
248 // video_device = new VDevicePrefs(x + 100,
252 // playback_config->vconfig,
255 // video_device->initialize();
262 // ArrayList<PlaybackConfig*>* PlaybackPrefs::current_config_list()
264 // return pwindow->thread->edl->session->get_playback_config(
265 // pwindow->thread->edl->session->playback_strategy);
268 // PlaybackConfig* PlaybackPrefs::current_config()
270 // return current_config_list()->values[current_head];
274 void PlaybackPrefs::update(int interpolation)
276 pwindow->thread->edl->session->interpolation_type = interpolation;
277 nearest_neighbor->update(interpolation == NEAREST_NEIGHBOR);
278 // cubic_cubic->update(interpolation == CUBIC_CUBIC);
279 cubic_linear->update(interpolation == CUBIC_LINEAR);
280 linear_linear->update(interpolation == LINEAR_LINEAR);
284 int PlaybackPrefs::get_buffer_bytes()
286 // return pwindow->thread->edl->aconfig->oss_out_bits / 8 * pwindow->thread->preferences->aconfig->oss_out_channels * pwindow->thread->preferences->playback_buffer;
289 int PlaybackPrefs::draw_framerate()
291 //printf("PlaybackPrefs::draw_framerate 1 %f\n", pwindow->thread->edl->session->actual_frame_rate);
292 char string[BCTEXTLEN];
293 sprintf(string, "%.4f", pwindow->thread->edl->session->actual_frame_rate);
294 framerate_title->update(string);
302 // PlaybackStrategy::PlaybackStrategy(PlaybackPrefs *prefs,
305 // : BC_PopupTextBox(prefs,
306 // &prefs->strategies,
307 // prefs->strategy_to_string(prefs->pwindow->thread->edl->session->playback_strategy),
313 // this->prefs = prefs;
316 // int PlaybackStrategy::handle_event()
318 // prefs->set_strategy(get_number());
326 // PlaybackHead::PlaybackHead(PlaybackPrefs *prefs,
329 // : BC_TumbleTextBox(prefs,
330 // prefs->current_head,
332 // (int64_t)prefs->current_config_list()->total - 1,
337 // this->prefs = prefs;
340 // int PlaybackHead::handle_event()
345 // PlaybackHeadCount::PlaybackHeadCount(PlaybackPrefs *prefs,
348 // : BC_TumbleTextBox(prefs,
349 // prefs->current_config_list()->total,
356 // this->prefs = prefs;
359 // int PlaybackHeadCount::handle_event()
366 // PlaybackHost::PlaybackHost(PlaybackPrefs *prefs, int x, int y)
367 // : BC_TextBox(x, y, 100, 1, prefs->current_config()->hostname)
369 // this->prefs = prefs;
372 // int PlaybackHost::handle_event()
374 // strcpy(prefs->current_config()->hostname, get_text());
381 // PlaybackReadLength::PlaybackReadLength(int x, int y, PreferencesWindow *pwindow, PlaybackPrefs *playback, char *text)
382 // : BC_TextBox(x, y, 100, 1, text)
384 // this->pwindow = pwindow;
385 // this->playback = playback;
388 // int PlaybackReadLength::handle_event()
390 // pwindow->thread->edl->session->audio_read_length = atol(get_text());
394 // PlaybackBufferSize::PlaybackBufferSize(int x, int y, PreferencesWindow *pwindow, PlaybackPrefs *playback, char *text)
395 // : BC_TextBox(x, y, 100, 1, text)
397 // this->pwindow = pwindow;
398 // this->playback = playback;
401 // int PlaybackBufferSize::handle_event()
403 // pwindow->thread->edl->session->playback_buffer = atol(get_text());
407 // PlaybackBufferBytes::PlaybackBufferBytes(int x,
409 // PreferencesWindow *pwindow,
410 // PlaybackPrefs *playback,
412 // : BC_Title(x, y, text)
414 // this->pwindow = pwindow;
415 // this->playback = playback;
417 // int PlaybackBufferBytes::update_bytes()
419 // sprintf(string, "%d", playback->get_buffer_bytes());
424 // PlaybackDisableNoEdits::PlaybackDisableNoEdits(PreferencesWindow *pwindow, int value, int y)
425 // : BC_CheckBox(10, y, value, _("Disable tracks when no edits."))
427 // this->pwindow = pwindow;
430 // int PlaybackDisableNoEdits::handle_event()
432 // pwindow->thread->edl->session->test_playback_edits = get_value();
438 PlaybackModuleFragment::PlaybackModuleFragment(int x,
440 PreferencesWindow *pwindow,
441 PlaybackPrefs *playback,
449 this->pwindow = pwindow;
450 this->playback = playback;
453 int PlaybackModuleFragment::handle_event()
455 playback->playback_config->aconfig->fragment_size = atol(get_text());
462 PlaybackViewFollows::PlaybackViewFollows(PreferencesWindow *pwindow, int value, int y)
463 : BC_CheckBox(10, y, value, _("View follows playback"))
465 this->pwindow = pwindow;
468 int PlaybackViewFollows::handle_event()
470 pwindow->thread->edl->session->view_follows_playback = get_value();
477 PlaybackSoftwareTimer::PlaybackSoftwareTimer(PreferencesWindow *pwindow, int value, int y)
478 : BC_CheckBox(10, y, value, _("Use software for positioning information"))
480 this->pwindow = pwindow;
483 int PlaybackSoftwareTimer::handle_event()
485 pwindow->thread->edl->session->playback_software_position = get_value();
492 PlaybackRealTime::PlaybackRealTime(PreferencesWindow *pwindow, int value, int y)
493 : BC_CheckBox(10, y, value, _("Audio playback in real time priority (root only)"))
495 this->pwindow = pwindow;
498 int PlaybackRealTime::handle_event()
500 pwindow->thread->edl->session->real_time_playback = get_value();
510 PlaybackNearest::PlaybackNearest(PreferencesWindow *pwindow, PlaybackPrefs *prefs, int value, int x, int y)
511 : BC_Radial(x, y, value, _("Nearest neighbor enlarge and reduce"))
513 this->pwindow = pwindow;
516 int PlaybackNearest::handle_event()
518 prefs->update(NEAREST_NEIGHBOR);
526 PlaybackBicubicBicubic::PlaybackBicubicBicubic(PreferencesWindow *pwindow, PlaybackPrefs *prefs, int value, int x, int y)
527 : BC_Radial(x, y, value, _("Bicubic enlarge and reduce"))
529 this->pwindow = pwindow;
532 int PlaybackBicubicBicubic::handle_event()
534 prefs->update(CUBIC_CUBIC);
541 PlaybackBicubicBilinear::PlaybackBicubicBilinear(PreferencesWindow *pwindow, PlaybackPrefs *prefs, int value, int x, int y)
542 : BC_Radial(x, y, value, _("Bicubic enlarge and bilinear reduce"))
544 this->pwindow = pwindow;
547 int PlaybackBicubicBilinear::handle_event()
549 prefs->update(CUBIC_LINEAR);
554 PlaybackBilinearBilinear::PlaybackBilinearBilinear(PreferencesWindow *pwindow,
555 PlaybackPrefs *prefs,
559 : BC_Radial(x, y, value, _("Bilinear enlarge and bilinear reduce"))
561 this->pwindow = pwindow;
564 int PlaybackBilinearBilinear::handle_event()
566 prefs->update(LINEAR_LINEAR);
571 PlaybackPreload::PlaybackPreload(int x,
573 PreferencesWindow *pwindow,
574 PlaybackPrefs *playback,
576 : BC_TextBox(x, y, 100, 1, text)
578 this->pwindow = pwindow;
579 this->playback = playback;
582 int PlaybackPreload::handle_event()
584 pwindow->thread->edl->session->playback_preload = atol(get_text());
590 VideoEveryFrame::VideoEveryFrame(PreferencesWindow *pwindow, int x, int y)
591 : BC_CheckBox(x, y, pwindow->thread->edl->session->video_every_frame, _("Play every frame"))
593 this->pwindow = pwindow;
596 int VideoEveryFrame::handle_event()
598 pwindow->thread->edl->session->video_every_frame = get_value();
606 // PlaybackDeblock::PlaybackDeblock(PreferencesWindow *pwindow, int x, int y)
609 // pwindow->thread->edl->session->mpeg4_deblock,
610 // _("MPEG-4 Deblocking"))
612 // this->pwindow = pwindow;
615 // int PlaybackDeblock::handle_event()
617 // pwindow->thread->edl->session->mpeg4_deblock = get_value();