0fc3382479d180865f668df6c2f8b4a671db3649
[dcpomatic.git] / src / wx / film_viewer.cc
1 /*
2     Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 /** @file  src/film_viewer.cc
22  *  @brief A wx widget to view a preview of a Film.
23  */
24
25 #include "film_viewer.h"
26 #include "playhead_to_timecode_dialog.h"
27 #include "playhead_to_frame_dialog.h"
28 #include "wx_util.h"
29 #include "closed_captions_dialog.h"
30 #include "lib/film.h"
31 #include "lib/ratio.h"
32 #include "lib/util.h"
33 #include "lib/job_manager.h"
34 #include "lib/image.h"
35 #include "lib/exceptions.h"
36 #include "lib/examine_content_job.h"
37 #include "lib/filter.h"
38 #include "lib/player.h"
39 #include "lib/player_video.h"
40 #include "lib/video_content.h"
41 #include "lib/video_decoder.h"
42 #include "lib/timer.h"
43 #include "lib/butler.h"
44 #include "lib/log.h"
45 #include "lib/config.h"
46 #include "lib/compose.hpp"
47 #include "lib/dcpomatic_log.h"
48 extern "C" {
49 #include <libavutil/pixfmt.h>
50 }
51 #include <dcp/exceptions.h>
52 #include <wx/tglbtn.h>
53 #include <iostream>
54 #include <iomanip>
55
56 using std::string;
57 using std::pair;
58 using std::min;
59 using std::max;
60 using std::cout;
61 using std::list;
62 using std::bad_alloc;
63 using std::make_pair;
64 using std::exception;
65 using boost::shared_ptr;
66 using boost::dynamic_pointer_cast;
67 using boost::weak_ptr;
68 using boost::optional;
69 using dcp::Size;
70
71 static
72 int
73 rtaudio_callback (void* out, void *, unsigned int frames, double, RtAudioStreamStatus, void* data)
74 {
75         return reinterpret_cast<FilmViewer*>(data)->audio_callback (out, frames);
76 }
77
78 FilmViewer::FilmViewer (wxWindow* p)
79         : _panel (new wxPanel (p))
80         , _coalesce_player_changes (false)
81         , _audio (DCPOMATIC_RTAUDIO_API)
82         , _audio_channels (0)
83         , _audio_block_size (1024)
84         , _playing (false)
85         , _latency_history_count (0)
86         , _dropped (0)
87         , _closed_captions_dialog (new ClosedCaptionsDialog(p, this))
88         , _outline_content (false)
89         , _eyes (EYES_LEFT)
90         , _pad_black (false)
91 #ifdef DCPOMATIC_VARIANT_SWAROOP
92         , _in_watermark (false)
93         , _background_image (false)
94 #endif
95 {
96 #ifndef __WXOSX__
97         _panel->SetDoubleBuffered (true);
98 #endif
99
100         _panel->SetBackgroundStyle (wxBG_STYLE_PAINT);
101         _panel->SetBackgroundColour (*wxBLACK);
102
103         _panel->Bind (wxEVT_PAINT, boost::bind (&FilmViewer::paint_panel, this));
104         _panel->Bind (wxEVT_SIZE,  boost::bind (&FilmViewer::panel_sized, this, _1));
105         _timer.Bind  (wxEVT_TIMER, boost::bind (&FilmViewer::timer, this));
106
107         set_film (shared_ptr<Film> ());
108
109         _config_changed_connection = Config::instance()->Changed.connect (bind (&FilmViewer::config_changed, this, _1));
110         config_changed (Config::SOUND_OUTPUT);
111 }
112
113 FilmViewer::~FilmViewer ()
114 {
115         stop ();
116 }
117
118 void
119 FilmViewer::set_film (shared_ptr<Film> film)
120 {
121         if (_film == film) {
122                 return;
123         }
124
125         _film = film;
126         _video_position = DCPTime ();
127         _player_video.first.reset ();
128         _player_video.second = DCPTime ();
129
130         _frame.reset ();
131         _closed_captions_dialog->clear ();
132
133         if (!_film) {
134                 _player.reset ();
135                 recreate_butler ();
136                 _frame.reset ();
137                 refresh_panel ();
138                 return;
139         }
140
141         try {
142                 _player.reset (new Player (_film, _film->playlist ()));
143                 _player->set_fast ();
144                 if (_dcp_decode_reduction) {
145                         _player->set_dcp_decode_reduction (_dcp_decode_reduction);
146                 }
147         } catch (bad_alloc &) {
148                 error_dialog (_panel, _("There is not enough free memory to do that."));
149                 _film.reset ();
150                 return;
151         }
152
153         _player->set_always_burn_open_subtitles ();
154         _player->set_play_referenced ();
155
156         _film->Change.connect (boost::bind (&FilmViewer::film_change, this, _1, _2));
157         _player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3));
158
159         /* Keep about 1 second's worth of history samples */
160         _latency_history_count = _film->audio_frame_rate() / _audio_block_size;
161
162         recreate_butler ();
163
164         calculate_sizes ();
165         slow_refresh ();
166 }
167
168 void
169 FilmViewer::recreate_butler ()
170 {
171         bool const was_running = stop ();
172         _butler.reset ();
173
174         if (!_film) {
175                 return;
176         }
177
178         AudioMapping map = AudioMapping (_film->audio_channels(), _audio_channels);
179
180         if (_audio_channels != 2 || _film->audio_channels() < 3) {
181                 for (int i = 0; i < min (_film->audio_channels(), _audio_channels); ++i) {
182                         map.set (i, i, 1);
183                 }
184         } else {
185                 /* Special case: stereo output, at least 3 channel input.
186                    Map so that Lt = L(-3dB) + Ls(-3dB) + C(-6dB) + Lfe(-10dB)
187                                Rt = R(-3dB) + Rs(-3dB) + C(-6dB) + Lfe(-10dB)
188                 */
189                 map.set (dcp::LEFT,   0, 1 / sqrt(2)); // L -> Lt
190                 map.set (dcp::RIGHT,  1, 1 / sqrt(2)); // R -> Rt
191                 map.set (dcp::CENTRE, 0, 1 / 2.0); // C -> Lt
192                 map.set (dcp::CENTRE, 1, 1 / 2.0); // C -> Rt
193                 map.set (dcp::LFE,    0, 1 / sqrt(10)); // Lfe -> Lt
194                 map.set (dcp::LFE,    1, 1 / sqrt(10)); // Lfe -> Rt
195                 map.set (dcp::LS,     0, 1 / sqrt(2)); // Ls -> Lt
196                 map.set (dcp::RS,     1, 1 / sqrt(2)); // Rs -> Rt
197         }
198
199         _butler.reset (new Butler(_player, map, _audio_channels, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true));
200         if (!Config::instance()->sound() && !_audio.isStreamOpen()) {
201                 _butler->disable_audio ();
202         }
203
204         _closed_captions_dialog->set_film_and_butler (_film, _butler);
205
206         if (was_running) {
207                 start ();
208         }
209 }
210
211 void
212 FilmViewer::refresh_panel ()
213 {
214         _panel->Refresh ();
215         _panel->Update ();
216 }
217
218 void
219 FilmViewer::get ()
220 {
221         DCPOMATIC_ASSERT (_butler);
222
223         do {
224                 Butler::Error e;
225                 _player_video = _butler->get_video (&e);
226                 if (!_player_video.first && e == Butler::AGAIN) {
227                         signal_manager->when_idle (boost::bind(&FilmViewer::get, this));
228                         return;
229                 }
230         } while (
231                 _player_video.first &&
232                 _film->three_d() &&
233                 _eyes != _player_video.first->eyes() &&
234                 _player_video.first->eyes() != EYES_BOTH
235                 );
236
237         try {
238                 _butler->rethrow ();
239         } catch (DecodeError& e) {
240                 error_dialog (_panel, e.what());
241         }
242
243         display_player_video ();
244 }
245
246 void
247 FilmViewer::display_player_video ()
248 {
249         if (!_player_video.first) {
250                 _frame.reset ();
251                 refresh_panel ();
252                 return;
253         }
254
255         if (_playing && (time() - _player_video.second) > one_video_frame()) {
256                 /* Too late; just drop this frame before we try to get its image (which will be the time-consuming
257                    part if this frame is J2K).
258                 */
259                 _video_position = _player_video.second;
260                 ++_dropped;
261                 return;
262         }
263
264         /* In an ideal world, what we would do here is:
265          *
266          * 1. convert to XYZ exactly as we do in the DCP creation path.
267          * 2. convert back to RGB for the preview display, compensating
268          *    for the monitor etc. etc.
269          *
270          * but this is inefficient if the source is RGB.  Since we don't
271          * (currently) care too much about the precise accuracy of the preview's
272          * colour mapping (and we care more about its speed) we try to short-
273          * circuit this "ideal" situation in some cases.
274          *
275          * The content's specified colour conversion indicates the colourspace
276          * which the content is in (according to the user).
277          *
278          * PlayerVideo::image (bound to PlayerVideo::force) will take the source
279          * image and convert it (from whatever the user has said it is) to RGB.
280          */
281
282         _frame = _player_video.first->image (bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true);
283
284         ImageChanged (_player_video.first);
285
286         _video_position = _player_video.second;
287         _inter_position = _player_video.first->inter_position ();
288         _inter_size = _player_video.first->inter_size ();
289
290         refresh_panel ();
291
292         _closed_captions_dialog->update (time());
293 }
294
295 void
296 FilmViewer::timer ()
297 {
298         if (!_film || !_playing) {
299                 return;
300         }
301
302         get ();
303         PositionChanged ();
304         DCPTime const next = _video_position + one_video_frame();
305
306         if (next >= _film->length()) {
307                 stop ();
308                 Finished ();
309                 return;
310         }
311
312         LOG_DEBUG_PLAYER("%1 -> %2; delay %3", next.seconds(), time().seconds(), max((next.seconds() - time().seconds()) * 1000, 1.0));
313         _timer.Start (max ((next.seconds() - time().seconds()) * 1000, 1.0), wxTIMER_ONE_SHOT);
314
315         if (_butler) {
316                 _butler->rethrow ();
317         }
318 }
319
320 bool
321 #ifdef DCPOMATIC_VARIANT_SWAROOP
322 FilmViewer::maybe_draw_background_image (wxPaintDC& dc)
323 {
324         optional<boost::filesystem::path> bg = Config::instance()->player_background_image();
325         if (bg) {
326                 wxImage image (std_to_wx(bg->string()));
327                 wxBitmap bitmap (image);
328                 dc.DrawBitmap (bitmap, max(0, (_panel_size.width - image.GetSize().GetWidth()) / 2), max(0, (_panel_size.height - image.GetSize().GetHeight()) / 2));
329                 return true;
330         }
331
332         return false;
333 }
334 #else
335 FilmViewer::maybe_draw_background_image (wxPaintDC &)
336 {
337         return false;
338 }
339 #endif
340
341 void
342 FilmViewer::paint_panel ()
343 {
344         wxPaintDC dc (_panel);
345
346 #ifdef DCPOMATIC_VARIANT_SWAROOP
347         if (_background_image) {
348                 dc.Clear ();
349                 maybe_draw_background_image (dc);
350                 return;
351         }
352 #endif
353
354         if (!_out_size.width || !_out_size.height || !_film || !_frame || _out_size != _frame->size()) {
355                 dc.Clear ();
356         } else {
357
358                 wxImage frame (_out_size.width, _out_size.height, _frame->data()[0], true);
359                 wxBitmap frame_bitmap (frame);
360                 dc.DrawBitmap (frame_bitmap, 0, max(0, (_panel_size.height - _out_size.height) / 2));
361
362 #ifdef DCPOMATIC_VARIANT_SWAROOP
363                 DCPTime const period = DCPTime::from_seconds(Config::instance()->player_watermark_period() * 60);
364                 int64_t n = _video_position.get() / period.get();
365                 DCPTime from(n * period.get());
366                 DCPTime to = from + DCPTime::from_seconds(Config::instance()->player_watermark_duration() / 1000.0);
367                 if (from <= _video_position && _video_position <= to) {
368                         if (!_in_watermark) {
369                                 _in_watermark = true;
370                                 _watermark_x = rand() % _panel_size.width;
371                                 _watermark_y = rand() % _panel_size.height;
372                         }
373                         dc.SetTextForeground(*wxWHITE);
374                         string wm = Config::instance()->player_watermark_theatre();
375                         boost::posix_time::ptime t = boost::posix_time::second_clock::local_time();
376                         wm += "\n" + boost::posix_time::to_iso_extended_string(t);
377                         dc.DrawText(std_to_wx(wm), _watermark_x, _watermark_y);
378                 } else {
379                         _in_watermark = false;
380                 }
381 #endif
382         }
383
384         if (_out_size.width < _panel_size.width) {
385                 /* XXX: these colours are right for GNOME; may need adjusting for other OS */
386                 wxPen   p (_pad_black ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
387                 wxBrush b (_pad_black ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
388                 dc.SetPen (p);
389                 dc.SetBrush (b);
390                 dc.DrawRectangle (_out_size.width, 0, _panel_size.width - _out_size.width, _panel_size.height);
391         }
392
393         if (_out_size.height < _panel_size.height) {
394                 wxPen   p (_pad_black ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
395                 wxBrush b (_pad_black ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
396                 dc.SetPen (p);
397                 dc.SetBrush (b);
398                 int const gap = (_panel_size.height - _out_size.height) / 2;
399                 dc.DrawRectangle (0, 0, _panel_size.width, gap);
400                 dc.DrawRectangle (0, gap + _out_size.height + 1, _panel_size.width, gap + 1);
401         }
402
403         if (_outline_content) {
404                 wxPen p (wxColour (255, 0, 0), 2);
405                 dc.SetPen (p);
406                 dc.SetBrush (*wxTRANSPARENT_BRUSH);
407                 dc.DrawRectangle (_inter_position.x, _inter_position.y + (_panel_size.height - _out_size.height) / 2, _inter_size.width, _inter_size.height);
408         }
409 }
410
411 void
412 FilmViewer::set_outline_content (bool o)
413 {
414         _outline_content = o;
415         refresh_panel ();
416 }
417
418 void
419 FilmViewer::set_eyes (Eyes e)
420 {
421         _eyes = e;
422         slow_refresh ();
423 }
424
425 void
426 FilmViewer::panel_sized (wxSizeEvent& ev)
427 {
428         _panel_size.width = ev.GetSize().GetWidth();
429         _panel_size.height = ev.GetSize().GetHeight();
430
431         calculate_sizes ();
432         if (!quick_refresh()) {
433                 slow_refresh ();
434         }
435         PositionChanged ();
436 }
437
438 void
439 FilmViewer::calculate_sizes ()
440 {
441         if (!_film || !_player) {
442                 return;
443         }
444
445         Ratio const * container = _film->container ();
446
447         float const panel_ratio = _panel_size.ratio ();
448         float const film_ratio = container ? container->ratio () : 1.78;
449
450         if (panel_ratio < film_ratio) {
451                 /* panel is less widscreen than the film; clamp width */
452                 _out_size.width = _panel_size.width;
453                 _out_size.height = lrintf (_out_size.width / film_ratio);
454         } else {
455                 /* panel is more widescreen than the film; clamp height */
456                 _out_size.height = _panel_size.height;
457                 _out_size.width = lrintf (_out_size.height * film_ratio);
458         }
459
460         /* Catch silly values */
461         _out_size.width = max (64, _out_size.width);
462         _out_size.height = max (64, _out_size.height);
463
464         _player->set_video_container_size (_out_size);
465 }
466
467 void
468 FilmViewer::start ()
469 {
470         if (!_film) {
471                 return;
472         }
473
474         optional<bool> v = PlaybackPermitted ();
475         if (v && !*v) {
476                 /* Computer says no */
477                 return;
478         }
479
480         if (_audio.isStreamOpen()) {
481                 _audio.setStreamTime (_video_position.seconds());
482                 _audio.startStream ();
483         }
484
485         _playing = true;
486         _dropped = 0;
487         timer ();
488         Started (position());
489 }
490
491 bool
492 FilmViewer::stop ()
493 {
494         if (_audio.isStreamRunning()) {
495                 /* stop stream and discard any remaining queued samples */
496                 _audio.abortStream ();
497         }
498
499         if (!_playing) {
500                 return false;
501         }
502
503         _playing = false;
504         Stopped (position());
505         return true;
506 }
507
508 void
509 FilmViewer::player_change (ChangeType type, int property, bool frequent)
510 {
511         if (type != CHANGE_TYPE_DONE || frequent) {
512                 return;
513         }
514
515         if (_coalesce_player_changes) {
516                 _pending_player_changes.push_back (property);
517                 return;
518         }
519
520         calculate_sizes ();
521         bool refreshed = false;
522         if (
523                 property == VideoContentProperty::CROP ||
524                 property == VideoContentProperty::SCALE ||
525                 property == VideoContentProperty::FADE_IN ||
526                 property == VideoContentProperty::FADE_OUT ||
527                 property == VideoContentProperty::COLOUR_CONVERSION ||
528                 property == PlayerProperty::VIDEO_CONTAINER_SIZE ||
529                 property == PlayerProperty::FILM_CONTAINER
530                 ) {
531                 refreshed = quick_refresh ();
532         }
533
534         if (!refreshed) {
535                 slow_refresh ();
536         }
537         PositionChanged ();
538 }
539
540 void
541 FilmViewer::film_change (ChangeType type, Film::Property p)
542 {
543         if (type == CHANGE_TYPE_DONE && p == Film::AUDIO_CHANNELS) {
544                 recreate_butler ();
545         }
546 }
547
548 /** Re-get the current frame slowly by seeking */
549 void
550 FilmViewer::slow_refresh ()
551 {
552         seek (_video_position, true);
553 }
554
555 /** Try to re-get the current frame quickly by resetting the metadata
556  *  in the PlayerVideo that we used last time.
557  *  @return true if this was possible, false if not.
558  */
559 bool
560 FilmViewer::quick_refresh ()
561 {
562         if (!_player_video.first) {
563                 return false;
564         }
565
566         if (!_player_video.first->reset_metadata (_film, _player->video_container_size(), _film->frame_size())) {
567                 return false;
568         }
569
570         display_player_video ();
571         return true;
572 }
573
574 void
575 FilmViewer::seek (shared_ptr<Content> content, ContentTime t, bool accurate)
576 {
577         optional<DCPTime> dt = _player->content_time_to_dcp (content, t);
578         if (dt) {
579                 seek (*dt, accurate);
580         }
581 }
582
583 void
584 FilmViewer::set_coalesce_player_changes (bool c)
585 {
586         _coalesce_player_changes = c;
587
588         if (!c) {
589                 BOOST_FOREACH (int i, _pending_player_changes) {
590                         player_change (CHANGE_TYPE_DONE, i, false);
591                 }
592                 _pending_player_changes.clear ();
593         }
594 }
595
596 void
597 FilmViewer::seek (DCPTime t, bool accurate)
598 {
599         if (!_butler) {
600                 return;
601         }
602
603         if (t < DCPTime ()) {
604                 t = DCPTime ();
605         }
606
607         if (t >= _film->length ()) {
608                 t = _film->length ();
609         }
610
611         bool const was_running = stop ();
612
613         _closed_captions_dialog->clear ();
614         _butler->seek (t, accurate);
615         get ();
616
617         if (was_running) {
618                 start ();
619         }
620
621         PositionChanged ();
622 }
623
624 void
625 FilmViewer::config_changed (Config::Property p)
626 {
627 #ifdef DCPOMATIC_VARIANT_SWAROOP
628         if (p == Config::PLAYER_BACKGROUND_IMAGE) {
629                 refresh_panel ();
630                 return;
631         }
632 #endif
633
634         if (p != Config::SOUND && p != Config::SOUND_OUTPUT) {
635                 return;
636         }
637
638         if (_audio.isStreamOpen ()) {
639                 _audio.closeStream ();
640         }
641
642         if (Config::instance()->sound() && _audio.getDeviceCount() > 0) {
643                 unsigned int st = 0;
644                 if (Config::instance()->sound_output()) {
645                         while (st < _audio.getDeviceCount()) {
646                                 if (_audio.getDeviceInfo(st).name == Config::instance()->sound_output().get()) {
647                                         break;
648                                 }
649                                 ++st;
650                         }
651                         if (st == _audio.getDeviceCount()) {
652                                 st = _audio.getDefaultOutputDevice();
653                         }
654                 } else {
655                         st = _audio.getDefaultOutputDevice();
656                 }
657
658                 _audio_channels = _audio.getDeviceInfo(st).outputChannels;
659
660                 RtAudio::StreamParameters sp;
661                 sp.deviceId = st;
662                 sp.nChannels = _audio_channels;
663                 sp.firstChannel = 0;
664                 try {
665                         _audio.openStream (&sp, 0, RTAUDIO_FLOAT32, 48000, &_audio_block_size, &rtaudio_callback, this);
666 #ifdef DCPOMATIC_USE_RTERROR
667                 } catch (RtError& e) {
668 #else
669                 } catch (RtAudioError& e) {
670 #endif
671                         error_dialog (
672                                 _panel,
673                                 _("Could not set up audio output.  There will be no audio during the preview."), std_to_wx(e.what())
674                                 );
675                 }
676                 recreate_butler ();
677
678         } else {
679                 _audio_channels = 0;
680                 recreate_butler ();
681         }
682 }
683
684 DCPTime
685 FilmViewer::uncorrected_time () const
686 {
687         if (_audio.isStreamRunning ()) {
688                 return DCPTime::from_seconds (const_cast<RtAudio*>(&_audio)->getStreamTime());
689         }
690
691         return _video_position;
692 }
693
694 DCPTime
695 FilmViewer::time () const
696 {
697         if (_audio.isStreamRunning ()) {
698                 return DCPTime::from_seconds (const_cast<RtAudio*>(&_audio)->getStreamTime ()) -
699                         DCPTime::from_frames (average_latency(), _film->audio_frame_rate());
700         }
701
702         return _video_position;
703 }
704
705 int
706 FilmViewer::audio_callback (void* out_p, unsigned int frames)
707 {
708         while (true) {
709                 optional<DCPTime> t = _butler->get_audio (reinterpret_cast<float*> (out_p), frames);
710                 if (!t || DCPTime(uncorrected_time() - *t) < one_video_frame()) {
711                         /* There was an underrun or this audio is on time; carry on */
712                         break;
713                 }
714                 /* The audio we just got was (very) late; drop it and get some more. */
715         }
716
717         boost::mutex::scoped_lock lm (_latency_history_mutex, boost::try_to_lock);
718         if (lm) {
719                 _latency_history.push_back (_audio.getStreamLatency ());
720                 if (_latency_history.size() > static_cast<size_t> (_latency_history_count)) {
721                         _latency_history.pop_front ();
722                 }
723         }
724
725         return 0;
726 }
727
728 Frame
729 FilmViewer::average_latency () const
730 {
731         boost::mutex::scoped_lock lm (_latency_history_mutex);
732         if (_latency_history.empty()) {
733                 return 0;
734         }
735
736         Frame total = 0;
737         BOOST_FOREACH (Frame i, _latency_history) {
738                 total += i;
739         }
740
741         return total / _latency_history.size();
742 }
743
744 void
745 FilmViewer::set_dcp_decode_reduction (optional<int> reduction)
746 {
747         _dcp_decode_reduction = reduction;
748         if (_player) {
749                 _player->set_dcp_decode_reduction (reduction);
750         }
751 }
752
753 optional<int>
754 FilmViewer::dcp_decode_reduction () const
755 {
756         return _dcp_decode_reduction;
757 }
758
759 DCPTime
760 FilmViewer::one_video_frame () const
761 {
762         return DCPTime::from_frames (1, _film->video_frame_rate());
763 }
764
765 /** Open a dialog box showing our film's closed captions */
766 void
767 FilmViewer::show_closed_captions ()
768 {
769         _closed_captions_dialog->Show();
770 }
771
772 void
773 FilmViewer::seek_by (DCPTime by, bool accurate)
774 {
775         seek (_video_position + by, accurate);
776 }
777
778 void
779 FilmViewer::set_pad_black (bool p)
780 {
781         _pad_black = p;
782 }