5777b9771acd76bcdf8d8974376ed08a976dd4e7
[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 using namespace dcpomatic;
71
72 static
73 int
74 rtaudio_callback (void* out, void *, unsigned int frames, double, RtAudioStreamStatus, void* data)
75 {
76         return reinterpret_cast<FilmViewer*>(data)->audio_callback (out, frames);
77 }
78
79 FilmViewer::FilmViewer (wxWindow* p)
80         : _gl_view (new GLView (p))
81         , _coalesce_player_changes (false)
82         , _audio (DCPOMATIC_RTAUDIO_API)
83         , _audio_channels (0)
84         , _audio_block_size (1024)
85         , _playing (false)
86         , _latency_history_count (0)
87         , _dropped (0)
88         , _closed_captions_dialog (new ClosedCaptionsDialog(p, this))
89         , _outline_content (false)
90         , _eyes (EYES_LEFT)
91         , _pad_black (false)
92 #ifdef DCPOMATIC_VARIANT_SWAROOP
93         , _in_watermark (false)
94         , _background_image (false)
95 #endif
96         , _state_timer ("viewer")
97         , _gets (0)
98 {
99         _timer.Bind  (wxEVT_TIMER, boost::bind (&FilmViewer::timer, this));
100
101         set_film (shared_ptr<Film> ());
102
103         _config_changed_connection = Config::instance()->Changed.connect (bind (&FilmViewer::config_changed, this, _1));
104         config_changed (Config::SOUND_OUTPUT);
105 }
106
107 FilmViewer::~FilmViewer ()
108 {
109         stop ();
110 }
111
112 void
113 FilmViewer::set_film (shared_ptr<Film> film)
114 {
115         if (_film == film) {
116                 return;
117         }
118
119         _film = film;
120         _video_position = DCPTime ();
121         _player_video.first.reset ();
122         _player_video.second = DCPTime ();
123
124         _frame.reset ();
125         _closed_captions_dialog->clear ();
126
127         if (!_film) {
128                 _player.reset ();
129                 recreate_butler ();
130                 _frame.reset ();
131                 refresh_panel ();
132                 return;
133         }
134
135         try {
136                 _player.reset (new Player (_film, _film->playlist ()));
137                 _player->set_fast ();
138                 if (_dcp_decode_reduction) {
139                         _player->set_dcp_decode_reduction (_dcp_decode_reduction);
140                 }
141         } catch (bad_alloc) {
142                 error_dialog (_gl_view, _("There is not enough free memory to do that."));
143                 _film.reset ();
144                 return;
145         }
146
147         _player->set_always_burn_open_subtitles ();
148         _player->set_play_referenced ();
149
150         _film->Change.connect (boost::bind (&FilmViewer::film_change, this, _1, _2));
151         _player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3));
152
153         /* Keep about 1 second's worth of history samples */
154         _latency_history_count = _film->audio_frame_rate() / _audio_block_size;
155
156         recreate_butler ();
157
158         calculate_sizes ();
159         slow_refresh ();
160 }
161
162 void
163 FilmViewer::recreate_butler ()
164 {
165         bool const was_running = stop ();
166         _butler.reset ();
167
168         if (!_film) {
169                 return;
170         }
171
172         AudioMapping map = AudioMapping (_film->audio_channels(), _audio_channels);
173
174         if (_audio_channels != 2 || _film->audio_channels() < 3) {
175                 for (int i = 0; i < min (_film->audio_channels(), _audio_channels); ++i) {
176                         map.set (i, i, 1);
177                 }
178         } else {
179                 /* Special case: stereo output, at least 3 channel input.
180                    Map so that Lt = L(-3dB) + Ls(-3dB) + C(-6dB) + Lfe(-10dB)
181                                Rt = R(-3dB) + Rs(-3dB) + C(-6dB) + Lfe(-10dB)
182                 */
183                 map.set (dcp::LEFT,   0, 1 / sqrt(2)); // L -> Lt
184                 map.set (dcp::RIGHT,  1, 1 / sqrt(2)); // R -> Rt
185                 map.set (dcp::CENTRE, 0, 1 / 2.0); // C -> Lt
186                 map.set (dcp::CENTRE, 1, 1 / 2.0); // C -> Rt
187                 map.set (dcp::LFE,    0, 1 / sqrt(10)); // Lfe -> Lt
188                 map.set (dcp::LFE,    1, 1 / sqrt(10)); // Lfe -> Rt
189                 map.set (dcp::LS,     0, 1 / sqrt(2)); // Ls -> Lt
190                 map.set (dcp::RS,     1, 1 / sqrt(2)); // Rs -> Rt
191         }
192
193         _butler.reset (new Butler(_player, map, _audio_channels, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true));
194         if (!Config::instance()->sound() && !_audio.isStreamOpen()) {
195                 _butler->disable_audio ();
196         }
197
198         _closed_captions_dialog->set_film_and_butler (_film, _butler);
199
200         if (was_running) {
201                 start ();
202         }
203 }
204
205 void
206 FilmViewer::refresh_panel ()
207 {
208         /* XXX */
209 }
210
211 void
212 FilmViewer::get ()
213 {
214         DCPOMATIC_ASSERT (_butler);
215         ++_gets;
216
217         do {
218                 Butler::Error e;
219                 _player_video = _butler->get_video (&e);
220                 if (!_player_video.first && e == Butler::AGAIN) {
221                         signal_manager->when_idle (boost::bind(&FilmViewer::get, this));
222                         return;
223                 }
224         } while (
225                 _player_video.first &&
226                 _film->three_d() &&
227                 _eyes != _player_video.first->eyes() &&
228                 _player_video.first->eyes() != EYES_BOTH
229                 );
230
231         _butler->rethrow ();
232
233         display_player_video ();
234 }
235
236 void
237 FilmViewer::display_player_video ()
238 {
239         if (!_player_video.first) {
240                 _frame.reset ();
241                 refresh_panel ();
242                 return;
243         }
244
245         if (_playing && (time() - _player_video.second) > one_video_frame()) {
246                 /* Too late; just drop this frame before we try to get its image (which will be the time-consuming
247                    part if this frame is J2K).
248                 */
249                 _video_position = _player_video.second;
250                 ++_dropped;
251                 return;
252         }
253
254         /* In an ideal world, what we would do here is:
255          *
256          * 1. convert to XYZ exactly as we do in the DCP creation path.
257          * 2. convert back to RGB for the preview display, compensating
258          *    for the monitor etc. etc.
259          *
260          * but this is inefficient if the source is RGB.  Since we don't
261          * (currently) care too much about the precise accuracy of the preview's
262          * colour mapping (and we care more about its speed) we try to short-
263          * circuit this "ideal" situation in some cases.
264          *
265          * The content's specified colour conversion indicates the colourspace
266          * which the content is in (according to the user).
267          *
268          * PlayerVideo::image (bound to PlayerVideo::force) will take the source
269          * image and convert it (from whatever the user has said it is) to RGB.
270          */
271
272         _state_timer.set ("get image");
273         _frame = _player_video.first->image (bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true);
274
275         _state_timer.set ("ImageChanged");
276         ImageChanged (_player_video.first);
277         _state_timer.unset ();
278
279         _video_position = _player_video.second;
280         _inter_position = _player_video.first->inter_position ();
281         _inter_size = _player_video.first->inter_size ();
282
283         refresh_panel ();
284
285         _closed_captions_dialog->update (time());
286 }
287
288 void
289 FilmViewer::timer ()
290 {
291         if (!_film || !_playing) {
292                 return;
293         }
294
295         get ();
296         PositionChanged ();
297         DCPTime const next = _video_position + one_video_frame();
298
299         if (next >= _film->length()) {
300                 stop ();
301                 Finished ();
302                 return;
303         }
304
305         LOG_DEBUG_PLAYER("%1 -> %2; delay %3", next.seconds(), time().seconds(), max((next.seconds() - time().seconds()) * 1000, 1.0));
306         _timer.Start (max ((next.seconds() - time().seconds()) * 1000, 1.0), wxTIMER_ONE_SHOT);
307
308         if (_butler) {
309                 _butler->rethrow ();
310         }
311 }
312
313 bool
314 #ifdef DCPOMATIC_VARIANT_SWAROOP
315 FilmViewer::maybe_draw_background_image (wxPaintDC& dc)
316 {
317 #ifdef DCPOMATIC_VARIANT_SWAROOP
318         XXX
319         optional<boost::filesystem::path> bg = Config::instance()->player_background_image();
320         if (bg) {
321                 wxImage image (std_to_wx(bg->string()));
322                 wxBitmap bitmap (image);
323                 dc.DrawBitmap (bitmap, max(0, (_panel_size.width - image.GetSize().GetWidth()) / 2), max(0, (_panel_size.height - image.GetSize().GetHeight()) / 2));
324                 return true;
325         }
326
327         return false;
328 }
329 #else
330 FilmViewer::maybe_draw_background_image (wxPaintDC &)
331 {
332         return false;
333 }
334 #endif
335
336 #if 0
337 XXX
338 void
339 FilmViewer::paint_panel ()
340 {
341         _state_timer.set ("paint-panel");
342
343         wxPaintDC dc (_panel);
344
345 #ifdef DCPOMATIC_VARIANT_SWAROOP
346         if (_background_image) {
347                 dc.Clear ();
348                 maybe_draw_background_image (dc);
349                 _state_timer.unset ();
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         _state_timer.unset ();
411 }
412 #endif
413
414 void
415 FilmViewer::set_outline_content (bool o)
416 {
417         _outline_content = o;
418         refresh_panel ();
419 }
420
421 void
422 FilmViewer::set_eyes (Eyes e)
423 {
424         _eyes = e;
425         slow_refresh ();
426 }
427
428 #if 0
429 XXX
430 void
431 FilmViewer::panel_sized (wxSizeEvent& ev)
432 {
433         _panel_size.width = ev.GetSize().GetWidth();
434         _panel_size.height = ev.GetSize().GetHeight();
435
436         calculate_sizes ();
437         if (!quick_refresh()) {
438                 slow_refresh ();
439         }
440         PositionChanged ();
441 }
442 #endif
443
444 void
445 FilmViewer::calculate_sizes ()
446 {
447         if (!_film || !_player) {
448                 return;
449         }
450
451         Ratio const * container = _film->container ();
452
453         float const view_ratio = float(_gl_view->GetSize().x) / _gl_view->GetSize().y;
454         float const film_ratio = container ? container->ratio () : 1.78;
455
456         if (view_ratio < film_ratio) {
457                 /* panel is less widscreen than the film; clamp width */
458                 _out_size.width = _gl_view->GetSize().x;
459                 _out_size.height = lrintf (_out_size.width / film_ratio);
460         } else {
461                 /* panel is more widescreen than the film; clamp height */
462                 _out_size.height = _gl_view->GetSize().y;
463                 _out_size.width = lrintf (_out_size.height * film_ratio);
464         }
465
466         /* Catch silly values */
467         _out_size.width = max (64, _out_size.width);
468         _out_size.height = max (64, _out_size.height);
469
470         _player->set_video_container_size (_out_size);
471 }
472
473 void
474 FilmViewer::start ()
475 {
476         if (!_film) {
477                 return;
478         }
479
480         optional<bool> v = PlaybackPermitted ();
481         if (v && !*v) {
482                 /* Computer says no */
483                 return;
484         }
485
486         if (_audio.isStreamOpen()) {
487                 _audio.setStreamTime (_video_position.seconds());
488                 _audio.startStream ();
489         }
490
491         _playing = true;
492         _dropped = 0;
493         timer ();
494         Started (position());
495 }
496
497 bool
498 FilmViewer::stop ()
499 {
500         if (_audio.isStreamRunning()) {
501                 /* stop stream and discard any remaining queued samples */
502                 _audio.abortStream ();
503         }
504
505         if (!_playing) {
506                 return false;
507         }
508
509         _playing = false;
510         Stopped (position());
511         return true;
512 }
513
514 void
515 FilmViewer::player_change (ChangeType type, int property, bool frequent)
516 {
517         if (type != CHANGE_TYPE_DONE || frequent) {
518                 return;
519         }
520
521         if (_coalesce_player_changes) {
522                 _pending_player_changes.push_back (property);
523                 return;
524         }
525
526         calculate_sizes ();
527         bool refreshed = false;
528         if (
529                 property == VideoContentProperty::CROP ||
530                 property == VideoContentProperty::SCALE ||
531                 property == VideoContentProperty::FADE_IN ||
532                 property == VideoContentProperty::FADE_OUT ||
533                 property == VideoContentProperty::COLOUR_CONVERSION ||
534                 property == PlayerProperty::VIDEO_CONTAINER_SIZE ||
535                 property == PlayerProperty::FILM_CONTAINER
536                 ) {
537                 refreshed = quick_refresh ();
538         }
539
540         if (!refreshed) {
541                 slow_refresh ();
542         }
543         PositionChanged ();
544 }
545
546 void
547 FilmViewer::film_change (ChangeType type, Film::Property p)
548 {
549         if (type == CHANGE_TYPE_DONE && p == Film::AUDIO_CHANNELS) {
550                 recreate_butler ();
551         }
552 }
553
554 /** Re-get the current frame slowly by seeking */
555 void
556 FilmViewer::slow_refresh ()
557 {
558         seek (_video_position, true);
559 }
560
561 /** Try to re-get the current frame quickly by resetting the metadata
562  *  in the PlayerVideo that we used last time.
563  *  @return true if this was possible, false if not.
564  */
565 bool
566 FilmViewer::quick_refresh ()
567 {
568         if (!_player_video.first) {
569                 return false;
570         }
571
572         if (!_player_video.first->reset_metadata (_film, _player->video_container_size(), _film->frame_size())) {
573                 return false;
574         }
575
576         display_player_video ();
577         return true;
578 }
579
580 void
581 FilmViewer::seek (shared_ptr<Content> content, ContentTime t, bool accurate)
582 {
583         optional<DCPTime> dt = _player->content_time_to_dcp (content, t);
584         if (dt) {
585                 seek (*dt, accurate);
586         }
587 }
588
589 void
590 FilmViewer::set_coalesce_player_changes (bool c)
591 {
592         _coalesce_player_changes = c;
593
594         if (!c) {
595                 BOOST_FOREACH (int i, _pending_player_changes) {
596                         player_change (CHANGE_TYPE_DONE, i, false);
597                 }
598                 _pending_player_changes.clear ();
599         }
600 }
601
602 void
603 FilmViewer::seek (DCPTime t, bool accurate)
604 {
605         if (!_butler) {
606                 return;
607         }
608
609         if (t < DCPTime ()) {
610                 t = DCPTime ();
611         }
612
613         if (t >= _film->length ()) {
614                 t = _film->length ();
615         }
616
617         bool const was_running = stop ();
618
619         _closed_captions_dialog->clear ();
620         _butler->seek (t, accurate);
621         get ();
622
623         if (was_running) {
624                 start ();
625         }
626
627         PositionChanged ();
628 }
629
630 void
631 FilmViewer::config_changed (Config::Property p)
632 {
633 #ifdef DCPOMATIC_VARIANT_SWAROOP
634         if (p == Config::PLAYER_BACKGROUND_IMAGE) {
635                 refresh_panel ();
636                 return;
637         }
638 #endif
639
640         if (p != Config::SOUND && p != Config::SOUND_OUTPUT) {
641                 return;
642         }
643
644         if (_audio.isStreamOpen ()) {
645                 _audio.closeStream ();
646         }
647
648         if (Config::instance()->sound() && _audio.getDeviceCount() > 0) {
649                 unsigned int st = 0;
650                 if (Config::instance()->sound_output()) {
651                         while (st < _audio.getDeviceCount()) {
652                                 if (_audio.getDeviceInfo(st).name == Config::instance()->sound_output().get()) {
653                                         break;
654                                 }
655                                 ++st;
656                         }
657                         if (st == _audio.getDeviceCount()) {
658                                 st = _audio.getDefaultOutputDevice();
659                         }
660                 } else {
661                         st = _audio.getDefaultOutputDevice();
662                 }
663
664                 _audio_channels = _audio.getDeviceInfo(st).outputChannels;
665
666                 RtAudio::StreamParameters sp;
667                 sp.deviceId = st;
668                 sp.nChannels = _audio_channels;
669                 sp.firstChannel = 0;
670                 try {
671                         _audio.openStream (&sp, 0, RTAUDIO_FLOAT32, 48000, &_audio_block_size, &rtaudio_callback, this);
672 #ifdef DCPOMATIC_USE_RTERROR
673                 } catch (RtError& e) {
674 #else
675                 } catch (RtAudioError& e) {
676 #endif
677                         error_dialog (
678                                 _gl_view,
679                                 _("Could not set up audio output.  There will be no audio during the preview."), std_to_wx(e.what())
680                                 );
681                 }
682                 recreate_butler ();
683
684         } else {
685                 _audio_channels = 0;
686                 recreate_butler ();
687         }
688 }
689
690 DCPTime
691 FilmViewer::uncorrected_time () const
692 {
693         if (_audio.isStreamRunning ()) {
694                 return DCPTime::from_seconds (const_cast<RtAudio*>(&_audio)->getStreamTime());
695         }
696
697         return _video_position;
698 }
699
700 DCPTime
701 FilmViewer::time () const
702 {
703         if (_audio.isStreamRunning ()) {
704                 return DCPTime::from_seconds (const_cast<RtAudio*>(&_audio)->getStreamTime ()) -
705                         DCPTime::from_frames (average_latency(), _film->audio_frame_rate());
706         }
707
708         return _video_position;
709 }
710
711 int
712 FilmViewer::audio_callback (void* out_p, unsigned int frames)
713 {
714         while (true) {
715                 optional<DCPTime> t = _butler->get_audio (reinterpret_cast<float*> (out_p), frames);
716                 if (!t || DCPTime(uncorrected_time() - *t) < one_video_frame()) {
717                         /* There was an underrun or this audio is on time; carry on */
718                         break;
719                 }
720                 /* The audio we just got was (very) late; drop it and get some more. */
721         }
722
723         boost::mutex::scoped_lock lm (_latency_history_mutex, boost::try_to_lock);
724         if (lm) {
725                 _latency_history.push_back (_audio.getStreamLatency ());
726                 if (_latency_history.size() > static_cast<size_t> (_latency_history_count)) {
727                         _latency_history.pop_front ();
728                 }
729         }
730
731         return 0;
732 }
733
734 Frame
735 FilmViewer::average_latency () const
736 {
737         boost::mutex::scoped_lock lm (_latency_history_mutex);
738         if (_latency_history.empty()) {
739                 return 0;
740         }
741
742         Frame total = 0;
743         BOOST_FOREACH (Frame i, _latency_history) {
744                 total += i;
745         }
746
747         return total / _latency_history.size();
748 }
749
750 void
751 FilmViewer::set_dcp_decode_reduction (optional<int> reduction)
752 {
753         _dcp_decode_reduction = reduction;
754         if (_player) {
755                 _player->set_dcp_decode_reduction (reduction);
756         }
757 }
758
759 optional<int>
760 FilmViewer::dcp_decode_reduction () const
761 {
762         return _dcp_decode_reduction;
763 }
764
765 DCPTime
766 FilmViewer::one_video_frame () const
767 {
768         return DCPTime::from_frames (1, _film->video_frame_rate());
769 }
770
771 /** Open a dialog box showing our film's closed captions */
772 void
773 FilmViewer::show_closed_captions ()
774 {
775         _closed_captions_dialog->Show();
776 }
777
778 void
779 FilmViewer::seek_by (DCPTime by, bool accurate)
780 {
781         seek (_video_position + by, accurate);
782 }
783
784 void
785 FilmViewer::set_pad_black (bool p)
786 {
787         _pad_black = p;
788 }