GLView integration (not working).
[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         /* XXX: do we need to store _frame? */
274         _frame = _player_video.first->image (bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true);
275         _gl_view->set_image (_frame);
276
277         _state_timer.set ("ImageChanged");
278         ImageChanged (_player_video.first);
279         _state_timer.unset ();
280
281         _video_position = _player_video.second;
282         _inter_position = _player_video.first->inter_position ();
283         _inter_size = _player_video.first->inter_size ();
284
285         refresh_panel ();
286
287         _closed_captions_dialog->update (time());
288 }
289
290 void
291 FilmViewer::timer ()
292 {
293         if (!_film || !_playing) {
294                 return;
295         }
296
297         get ();
298         PositionChanged ();
299         DCPTime const next = _video_position + one_video_frame();
300
301         if (next >= _film->length()) {
302                 stop ();
303                 Finished ();
304                 return;
305         }
306
307         LOG_DEBUG_PLAYER("%1 -> %2; delay %3", next.seconds(), time().seconds(), max((next.seconds() - time().seconds()) * 1000, 1.0));
308         _timer.Start (max ((next.seconds() - time().seconds()) * 1000, 1.0), wxTIMER_ONE_SHOT);
309
310         if (_butler) {
311                 _butler->rethrow ();
312         }
313 }
314
315 bool
316 #ifdef DCPOMATIC_VARIANT_SWAROOP
317 FilmViewer::maybe_draw_background_image (wxPaintDC& dc)
318 {
319 #ifdef DCPOMATIC_VARIANT_SWAROOP
320         XXX
321         optional<boost::filesystem::path> bg = Config::instance()->player_background_image();
322         if (bg) {
323                 wxImage image (std_to_wx(bg->string()));
324                 wxBitmap bitmap (image);
325                 dc.DrawBitmap (bitmap, max(0, (_panel_size.width - image.GetSize().GetWidth()) / 2), max(0, (_panel_size.height - image.GetSize().GetHeight()) / 2));
326                 return true;
327         }
328
329         return false;
330 }
331 #else
332 FilmViewer::maybe_draw_background_image (wxPaintDC &)
333 {
334         return false;
335 }
336 #endif
337
338 #if 0
339 XXX
340 void
341 FilmViewer::paint_panel ()
342 {
343         _state_timer.set ("paint-panel");
344
345         wxPaintDC dc (_panel);
346
347 #ifdef DCPOMATIC_VARIANT_SWAROOP
348         if (_background_image) {
349                 dc.Clear ();
350                 maybe_draw_background_image (dc);
351                 _state_timer.unset ();
352                 return;
353         }
354 #endif
355
356         if (!_out_size.width || !_out_size.height || !_film || !_frame || _out_size != _frame->size()) {
357                 dc.Clear ();
358         } else {
359
360                 wxImage frame (_out_size.width, _out_size.height, _frame->data()[0], true);
361                 wxBitmap frame_bitmap (frame);
362                 dc.DrawBitmap (frame_bitmap, 0, max(0, (_panel_size.height - _out_size.height) / 2));
363
364 #ifdef DCPOMATIC_VARIANT_SWAROOP
365                 DCPTime const period = DCPTime::from_seconds(Config::instance()->player_watermark_period() * 60);
366                 int64_t n = _video_position.get() / period.get();
367                 DCPTime from(n * period.get());
368                 DCPTime to = from + DCPTime::from_seconds(Config::instance()->player_watermark_duration() / 1000.0);
369                 if (from <= _video_position && _video_position <= to) {
370                         if (!_in_watermark) {
371                                 _in_watermark = true;
372                                 _watermark_x = rand() % _panel_size.width;
373                                 _watermark_y = rand() % _panel_size.height;
374                         }
375                         dc.SetTextForeground(*wxWHITE);
376                         string wm = Config::instance()->player_watermark_theatre();
377                         boost::posix_time::ptime t = boost::posix_time::second_clock::local_time();
378                         wm += "\n" + boost::posix_time::to_iso_extended_string(t);
379                         dc.DrawText(std_to_wx(wm), _watermark_x, _watermark_y);
380                 } else {
381                         _in_watermark = false;
382                 }
383 #endif
384         }
385
386         if (_out_size.width < _panel_size.width) {
387                 /* XXX: these colours are right for GNOME; may need adjusting for other OS */
388                 wxPen   p (_pad_black ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
389                 wxBrush b (_pad_black ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
390                 dc.SetPen (p);
391                 dc.SetBrush (b);
392                 dc.DrawRectangle (_out_size.width, 0, _panel_size.width - _out_size.width, _panel_size.height);
393         }
394
395         if (_out_size.height < _panel_size.height) {
396                 wxPen   p (_pad_black ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
397                 wxBrush b (_pad_black ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
398                 dc.SetPen (p);
399                 dc.SetBrush (b);
400                 int const gap = (_panel_size.height - _out_size.height) / 2;
401                 dc.DrawRectangle (0, 0, _panel_size.width, gap);
402                 dc.DrawRectangle (0, gap + _out_size.height + 1, _panel_size.width, gap + 1);
403         }
404
405         if (_outline_content) {
406                 wxPen p (wxColour (255, 0, 0), 2);
407                 dc.SetPen (p);
408                 dc.SetBrush (*wxTRANSPARENT_BRUSH);
409                 dc.DrawRectangle (_inter_position.x, _inter_position.y + (_panel_size.height - _out_size.height) / 2, _inter_size.width, _inter_size.height);
410         }
411
412         _state_timer.unset ();
413 }
414 #endif
415
416 void
417 FilmViewer::set_outline_content (bool o)
418 {
419         _outline_content = o;
420         refresh_panel ();
421 }
422
423 void
424 FilmViewer::set_eyes (Eyes e)
425 {
426         _eyes = e;
427         slow_refresh ();
428 }
429
430 #if 0
431 XXX
432 void
433 FilmViewer::panel_sized (wxSizeEvent& ev)
434 {
435         _panel_size.width = ev.GetSize().GetWidth();
436         _panel_size.height = ev.GetSize().GetHeight();
437
438         calculate_sizes ();
439         if (!quick_refresh()) {
440                 slow_refresh ();
441         }
442         PositionChanged ();
443 }
444 #endif
445
446 void
447 FilmViewer::calculate_sizes ()
448 {
449         if (!_film || !_player) {
450                 return;
451         }
452
453         Ratio const * container = _film->container ();
454
455         float const view_ratio = float(_gl_view->GetSize().x) / _gl_view->GetSize().y;
456         float const film_ratio = container ? container->ratio () : 1.78;
457
458         if (view_ratio < film_ratio) {
459                 /* panel is less widscreen than the film; clamp width */
460                 _out_size.width = _gl_view->GetSize().x;
461                 _out_size.height = lrintf (_out_size.width / film_ratio);
462         } else {
463                 /* panel is more widescreen than the film; clamp height */
464                 _out_size.height = _gl_view->GetSize().y;
465                 _out_size.width = lrintf (_out_size.height * film_ratio);
466         }
467
468         /* Catch silly values */
469         _out_size.width = max (64, _out_size.width);
470         _out_size.height = max (64, _out_size.height);
471
472         _player->set_video_container_size (_out_size);
473 }
474
475 void
476 FilmViewer::start ()
477 {
478         if (!_film) {
479                 return;
480         }
481
482         optional<bool> v = PlaybackPermitted ();
483         if (v && !*v) {
484                 /* Computer says no */
485                 return;
486         }
487
488         if (_audio.isStreamOpen()) {
489                 _audio.setStreamTime (_video_position.seconds());
490                 _audio.startStream ();
491         }
492
493         _playing = true;
494         _dropped = 0;
495         timer ();
496         Started (position());
497 }
498
499 bool
500 FilmViewer::stop ()
501 {
502         if (_audio.isStreamRunning()) {
503                 /* stop stream and discard any remaining queued samples */
504                 _audio.abortStream ();
505         }
506
507         if (!_playing) {
508                 return false;
509         }
510
511         _playing = false;
512         Stopped (position());
513         return true;
514 }
515
516 void
517 FilmViewer::player_change (ChangeType type, int property, bool frequent)
518 {
519         if (type != CHANGE_TYPE_DONE || frequent) {
520                 return;
521         }
522
523         if (_coalesce_player_changes) {
524                 _pending_player_changes.push_back (property);
525                 return;
526         }
527
528         calculate_sizes ();
529         bool refreshed = false;
530         if (
531                 property == VideoContentProperty::CROP ||
532                 property == VideoContentProperty::SCALE ||
533                 property == VideoContentProperty::FADE_IN ||
534                 property == VideoContentProperty::FADE_OUT ||
535                 property == VideoContentProperty::COLOUR_CONVERSION ||
536                 property == PlayerProperty::VIDEO_CONTAINER_SIZE ||
537                 property == PlayerProperty::FILM_CONTAINER
538                 ) {
539                 refreshed = quick_refresh ();
540         }
541
542         if (!refreshed) {
543                 slow_refresh ();
544         }
545         PositionChanged ();
546 }
547
548 void
549 FilmViewer::film_change (ChangeType type, Film::Property p)
550 {
551         if (type == CHANGE_TYPE_DONE && p == Film::AUDIO_CHANNELS) {
552                 recreate_butler ();
553         }
554 }
555
556 /** Re-get the current frame slowly by seeking */
557 void
558 FilmViewer::slow_refresh ()
559 {
560         seek (_video_position, true);
561 }
562
563 /** Try to re-get the current frame quickly by resetting the metadata
564  *  in the PlayerVideo that we used last time.
565  *  @return true if this was possible, false if not.
566  */
567 bool
568 FilmViewer::quick_refresh ()
569 {
570         if (!_player_video.first) {
571                 return false;
572         }
573
574         if (!_player_video.first->reset_metadata (_film, _player->video_container_size(), _film->frame_size())) {
575                 return false;
576         }
577
578         display_player_video ();
579         return true;
580 }
581
582 void
583 FilmViewer::seek (shared_ptr<Content> content, ContentTime t, bool accurate)
584 {
585         optional<DCPTime> dt = _player->content_time_to_dcp (content, t);
586         if (dt) {
587                 seek (*dt, accurate);
588         }
589 }
590
591 void
592 FilmViewer::set_coalesce_player_changes (bool c)
593 {
594         _coalesce_player_changes = c;
595
596         if (!c) {
597                 BOOST_FOREACH (int i, _pending_player_changes) {
598                         player_change (CHANGE_TYPE_DONE, i, false);
599                 }
600                 _pending_player_changes.clear ();
601         }
602 }
603
604 void
605 FilmViewer::seek (DCPTime t, bool accurate)
606 {
607         if (!_butler) {
608                 return;
609         }
610
611         if (t < DCPTime ()) {
612                 t = DCPTime ();
613         }
614
615         if (t >= _film->length ()) {
616                 t = _film->length ();
617         }
618
619         bool const was_running = stop ();
620
621         _closed_captions_dialog->clear ();
622         _butler->seek (t, accurate);
623         get ();
624
625         if (was_running) {
626                 start ();
627         }
628
629         PositionChanged ();
630 }
631
632 void
633 FilmViewer::config_changed (Config::Property p)
634 {
635 #ifdef DCPOMATIC_VARIANT_SWAROOP
636         if (p == Config::PLAYER_BACKGROUND_IMAGE) {
637                 refresh_panel ();
638                 return;
639         }
640 #endif
641
642         if (p != Config::SOUND && p != Config::SOUND_OUTPUT) {
643                 return;
644         }
645
646         if (_audio.isStreamOpen ()) {
647                 _audio.closeStream ();
648         }
649
650         if (Config::instance()->sound() && _audio.getDeviceCount() > 0) {
651                 unsigned int st = 0;
652                 if (Config::instance()->sound_output()) {
653                         while (st < _audio.getDeviceCount()) {
654                                 if (_audio.getDeviceInfo(st).name == Config::instance()->sound_output().get()) {
655                                         break;
656                                 }
657                                 ++st;
658                         }
659                         if (st == _audio.getDeviceCount()) {
660                                 st = _audio.getDefaultOutputDevice();
661                         }
662                 } else {
663                         st = _audio.getDefaultOutputDevice();
664                 }
665
666                 _audio_channels = _audio.getDeviceInfo(st).outputChannels;
667
668                 RtAudio::StreamParameters sp;
669                 sp.deviceId = st;
670                 sp.nChannels = _audio_channels;
671                 sp.firstChannel = 0;
672                 try {
673                         _audio.openStream (&sp, 0, RTAUDIO_FLOAT32, 48000, &_audio_block_size, &rtaudio_callback, this);
674 #ifdef DCPOMATIC_USE_RTERROR
675                 } catch (RtError& e) {
676 #else
677                 } catch (RtAudioError& e) {
678 #endif
679                         error_dialog (
680                                 _gl_view,
681                                 _("Could not set up audio output.  There will be no audio during the preview."), std_to_wx(e.what())
682                                 );
683                 }
684                 recreate_butler ();
685
686         } else {
687                 _audio_channels = 0;
688                 recreate_butler ();
689         }
690 }
691
692 DCPTime
693 FilmViewer::uncorrected_time () const
694 {
695         if (_audio.isStreamRunning ()) {
696                 return DCPTime::from_seconds (const_cast<RtAudio*>(&_audio)->getStreamTime());
697         }
698
699         return _video_position;
700 }
701
702 DCPTime
703 FilmViewer::time () const
704 {
705         if (_audio.isStreamRunning ()) {
706                 return DCPTime::from_seconds (const_cast<RtAudio*>(&_audio)->getStreamTime ()) -
707                         DCPTime::from_frames (average_latency(), _film->audio_frame_rate());
708         }
709
710         return _video_position;
711 }
712
713 int
714 FilmViewer::audio_callback (void* out_p, unsigned int frames)
715 {
716         while (true) {
717                 optional<DCPTime> t = _butler->get_audio (reinterpret_cast<float*> (out_p), frames);
718                 if (!t || DCPTime(uncorrected_time() - *t) < one_video_frame()) {
719                         /* There was an underrun or this audio is on time; carry on */
720                         break;
721                 }
722                 /* The audio we just got was (very) late; drop it and get some more. */
723         }
724
725         boost::mutex::scoped_lock lm (_latency_history_mutex, boost::try_to_lock);
726         if (lm) {
727                 _latency_history.push_back (_audio.getStreamLatency ());
728                 if (_latency_history.size() > static_cast<size_t> (_latency_history_count)) {
729                         _latency_history.pop_front ();
730                 }
731         }
732
733         return 0;
734 }
735
736 Frame
737 FilmViewer::average_latency () const
738 {
739         boost::mutex::scoped_lock lm (_latency_history_mutex);
740         if (_latency_history.empty()) {
741                 return 0;
742         }
743
744         Frame total = 0;
745         BOOST_FOREACH (Frame i, _latency_history) {
746                 total += i;
747         }
748
749         return total / _latency_history.size();
750 }
751
752 void
753 FilmViewer::set_dcp_decode_reduction (optional<int> reduction)
754 {
755         _dcp_decode_reduction = reduction;
756         if (_player) {
757                 _player->set_dcp_decode_reduction (reduction);
758         }
759 }
760
761 optional<int>
762 FilmViewer::dcp_decode_reduction () const
763 {
764         return _dcp_decode_reduction;
765 }
766
767 DCPTime
768 FilmViewer::one_video_frame () const
769 {
770         return DCPTime::from_frames (1, _film->video_frame_rate());
771 }
772
773 /** Open a dialog box showing our film's closed captions */
774 void
775 FilmViewer::show_closed_captions ()
776 {
777         _closed_captions_dialog->Show();
778 }
779
780 void
781 FilmViewer::seek_by (DCPTime by, bool accurate)
782 {
783         seek (_video_position + by, accurate);
784 }
785
786 void
787 FilmViewer::set_pad_black (bool p)
788 {
789         _pad_black = p;
790 }