Build fixes for Boost >= 1.73
[dcpomatic.git] / src / wx / video_panel.cc
1 /*
2     Copyright (C) 2012-2018 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 #include "filter_dialog.h"
22 #include "video_panel.h"
23 #include "wx_util.h"
24 #include "content_colour_conversion_dialog.h"
25 #include "content_widget.h"
26 #include "content_panel.h"
27 #include "static_text.h"
28 #include "check_box.h"
29 #include "dcpomatic_button.h"
30 #include "lib/filter.h"
31 #include "lib/ffmpeg_content.h"
32 #include "lib/colour_conversion.h"
33 #include "lib/config.h"
34 #include "lib/util.h"
35 #include "lib/ratio.h"
36 #include "lib/frame_rate_change.h"
37 #include "lib/dcp_content.h"
38 #include "lib/video_content.h"
39 #include <wx/spinctrl.h>
40 #include <boost/foreach.hpp>
41 #include <boost/unordered_set.hpp>
42 #include <boost/functional/hash.hpp>
43 #include <set>
44 #include <iostream>
45
46 using std::vector;
47 using std::string;
48 using std::pair;
49 using std::cout;
50 using std::list;
51 using std::set;
52 using boost::shared_ptr;
53 using boost::dynamic_pointer_cast;
54 using boost::bind;
55 using boost::optional;
56 #if BOOST_VERSION >= 106100
57 using namespace boost::placeholders;
58 #endif
59
60 static VideoContentScale
61 index_to_scale (int n)
62 {
63         vector<VideoContentScale> scales = VideoContentScale::all ();
64         DCPOMATIC_ASSERT (n >= 0);
65         DCPOMATIC_ASSERT (n < int (scales.size ()));
66         return scales[n];
67 }
68
69 static int
70 scale_to_index (VideoContentScale scale)
71 {
72         vector<VideoContentScale> scales = VideoContentScale::all ();
73         for (size_t i = 0; i < scales.size(); ++i) {
74                 if (scales[i] == scale) {
75                         return i;
76                 }
77         }
78
79         DCPOMATIC_ASSERT (false);
80 }
81
82 VideoPanel::VideoPanel (ContentPanel* p)
83         : ContentSubPanel (p, _("Video"))
84 {
85         _reference = new CheckBox (this, _("Use this DCP's video as OV and make VF"));
86         _reference_note = new StaticText (this, wxT(""));
87         _reference_note->Wrap (200);
88         wxFont font = _reference_note->GetFont();
89         font.SetStyle(wxFONTSTYLE_ITALIC);
90         font.SetPointSize(font.GetPointSize() - 1);
91         _reference_note->SetFont(font);
92
93         _type_label = create_label (this, _("Type"), true);
94         _frame_type = new ContentChoice<VideoContent, VideoFrameType> (
95                 this,
96                 new wxChoice (this, wxID_ANY),
97                 VideoContentProperty::FRAME_TYPE,
98                 &Content::video,
99                 boost::mem_fn (&VideoContent::frame_type),
100                 boost::mem_fn (&VideoContent::set_frame_type),
101                 &caster<int, VideoFrameType>,
102                 &caster<VideoFrameType, int>
103                 );
104
105         _left_crop_label = create_label (this, _("Left crop"), true);
106         _left_crop = new ContentSpinCtrl<VideoContent> (
107                 this,
108                 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
109                 VideoContentProperty::CROP,
110                 &Content::video,
111                 boost::mem_fn (&VideoContent::left_crop),
112                 boost::mem_fn (&VideoContent::set_left_crop)
113                 );
114
115         _right_crop_label = create_label (this, _("Right crop"), true);
116         _right_crop = new ContentSpinCtrl<VideoContent> (
117                 this,
118                 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
119                 VideoContentProperty::CROP,
120                 &Content::video,
121                 boost::mem_fn (&VideoContent::right_crop),
122                 boost::mem_fn (&VideoContent::set_right_crop)
123                 );
124
125         _top_crop_label = create_label (this, _("Top crop"), true);
126         _top_crop = new ContentSpinCtrl<VideoContent> (
127                 this,
128                 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
129                 VideoContentProperty::CROP,
130                 &Content::video,
131                 boost::mem_fn (&VideoContent::top_crop),
132                 boost::mem_fn (&VideoContent::set_top_crop)
133                 );
134
135         _bottom_crop_label = create_label (this, _("Bottom crop"), true);
136         _bottom_crop = new ContentSpinCtrl<VideoContent> (
137                 this,
138                 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
139                 VideoContentProperty::CROP,
140                 &Content::video,
141                 boost::mem_fn (&VideoContent::bottom_crop),
142                 boost::mem_fn (&VideoContent::set_bottom_crop)
143                 );
144
145         _fade_in_label = create_label (this, _("Fade in"), true);
146         _fade_in = new Timecode<ContentTime> (this);
147
148         _fade_out_label = create_label (this, _("Fade out"), true);
149         _fade_out = new Timecode<ContentTime> (this);
150
151         _scale_to_label = create_label (this, _("Scale to"), true);
152         _scale = new ContentChoice<VideoContent, VideoContentScale> (
153                 this,
154                 new wxChoice (this, wxID_ANY),
155                 VideoContentProperty::SCALE,
156                 &Content::video,
157                 boost::mem_fn (&VideoContent::scale),
158                 boost::mem_fn (&VideoContent::set_scale),
159                 &index_to_scale,
160                 &scale_to_index
161                 );
162
163         wxClientDC dc (this);
164         wxSize size = dc.GetTextExtent (wxT ("A quite long name"));
165         size.SetHeight (-1);
166
167         _filters_label = create_label (this, _("Filters"), true);
168         _filters = new StaticText (this, _("None"), wxDefaultPosition, size);
169         _filters_button = new Button (this, _("Edit..."));
170
171         _colour_conversion_label = create_label (this, _("Colour conversion"), true);
172         _colour_conversion = new wxChoice (this, wxID_ANY, wxDefaultPosition, size);
173         _colour_conversion->Append (_("None"));
174         BOOST_FOREACH (PresetColourConversion const & i, PresetColourConversion::all()) {
175                 _colour_conversion->Append (std_to_wx (i.name));
176         }
177
178         /// TRANSLATORS: translate the word "Custom" here; do not include the "Colour|" prefix
179         _colour_conversion->Append (S_("Colour|Custom"));
180         _edit_colour_conversion_button = new Button (this, _("Edit..."));
181
182         _description = new StaticText (this, wxT ("\n \n \n \n \n"), wxDefaultPosition, wxDefaultSize);
183         _description->SetFont(font);
184
185         _left_crop->wrapped()->SetRange (0, 4096);
186         _top_crop->wrapped()->SetRange (0, 4096);
187         _right_crop->wrapped()->SetRange (0, 4096);
188         _bottom_crop->wrapped()->SetRange (0, 4096);
189
190         _scale->wrapped()->Clear ();
191         BOOST_FOREACH (VideoContentScale const & i, VideoContentScale::all ()) {
192                 _scale->wrapped()->Append (std_to_wx (i.name ()));
193         }
194
195         _frame_type->wrapped()->Append (_("2D"));
196         _frame_type->wrapped()->Append (_("3D"));
197         _frame_type->wrapped()->Append (_("3D left/right"));
198         _frame_type->wrapped()->Append (_("3D top/bottom"));
199         _frame_type->wrapped()->Append (_("3D alternate"));
200         _frame_type->wrapped()->Append (_("3D left only"));
201         _frame_type->wrapped()->Append (_("3D right only"));
202
203         content_selection_changed ();
204
205         _fade_in->Changed.connect (boost::bind (&VideoPanel::fade_in_changed, this));
206         _fade_out->Changed.connect (boost::bind (&VideoPanel::fade_out_changed, this));
207
208         _reference->Bind                     (wxEVT_CHECKBOX, boost::bind (&VideoPanel::reference_clicked, this));
209         _filters_button->Bind                (wxEVT_BUTTON,   boost::bind (&VideoPanel::edit_filters_clicked, this));
210         _colour_conversion->Bind             (wxEVT_CHOICE,   boost::bind (&VideoPanel::colour_conversion_changed, this));
211         _edit_colour_conversion_button->Bind (wxEVT_BUTTON,   boost::bind (&VideoPanel::edit_colour_conversion_clicked, this));
212
213         add_to_grid ();
214 }
215
216 void
217 VideoPanel::add_to_grid ()
218 {
219         bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
220
221         int r = 0;
222
223         _reference->Show (full);
224         _reference_note->Show (full);
225
226         if (full) {
227                 wxBoxSizer* reference_sizer = new wxBoxSizer (wxVERTICAL);
228                 reference_sizer->Add (_reference, 0);
229                 reference_sizer->Add (_reference_note, 0);
230                 _grid->Add (reference_sizer, wxGBPosition(r, 0), wxGBSpan(1, 3));
231                 ++r;
232         }
233
234         add_label_to_sizer (_grid, _type_label, true, wxGBPosition(r, 0));
235         _frame_type->add (_grid, wxGBPosition(r, 1), wxGBSpan(1, 2));
236         ++r;
237
238         int cr = 0;
239         wxGridBagSizer* crop = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
240         add_label_to_sizer (crop, _left_crop_label, true, wxGBPosition (cr, 0));
241         _left_crop->add (crop, wxGBPosition (cr, 1));
242         add_label_to_sizer (crop, _right_crop_label, true, wxGBPosition (cr, 2));
243         _right_crop->add (crop, wxGBPosition (cr, 3));
244         ++cr;
245         add_label_to_sizer (crop, _top_crop_label, true, wxGBPosition (cr, 0));
246         _top_crop->add (crop, wxGBPosition (cr, 1));
247         add_label_to_sizer (crop, _bottom_crop_label, true, wxGBPosition (cr, 2));
248         _bottom_crop->add (crop, wxGBPosition (cr, 3));
249         _grid->Add (crop, wxGBPosition (r, 0), wxGBSpan (2, 4));
250         r += 2;
251
252         _scale_to_label->Show (full);
253         _scale->show (full);
254         _filters_label->Show (full);
255         _filters->Show (full);
256         _filters_button->Show (full);
257         _colour_conversion_label->Show (full);
258         _colour_conversion->Show (full);
259         _edit_colour_conversion_button->Show (full);
260
261         add_label_to_sizer (_grid, _fade_in_label, true, wxGBPosition (r, 0));
262         _grid->Add (_fade_in, wxGBPosition (r, 1), wxGBSpan (1, 3));
263         ++r;
264
265         add_label_to_sizer (_grid, _fade_out_label, true, wxGBPosition (r, 0));
266         _grid->Add (_fade_out, wxGBPosition (r, 1), wxGBSpan (1, 3));
267         ++r;
268
269         if (full) {
270                 add_label_to_sizer (_grid, _scale_to_label, true, wxGBPosition (r, 0));
271                 _scale->add (_grid, wxGBPosition (r, 1), wxGBSpan (1, 2));
272                 ++r;
273
274                 add_label_to_sizer (_grid, _filters_label, true, wxGBPosition (r, 0));
275                 {
276                         wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
277                         s->Add (_filters, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
278                         s->Add (_filters_button, 0, wxALIGN_CENTER_VERTICAL);
279                         _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
280                 }
281                 ++r;
282
283                 add_label_to_sizer (_grid, _colour_conversion_label, true, wxGBPosition(r, 0));
284                 {
285                         wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
286                         s->Add (_colour_conversion, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
287                         s->Add (_edit_colour_conversion_button, 0, wxALIGN_CENTER_VERTICAL);
288                         _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
289                 }
290                 ++r;
291         }
292
293         _grid->Add (_description, wxGBPosition (r, 0), wxGBSpan (1, 4), wxEXPAND | wxALIGN_CENTER_VERTICAL, 6);
294         ++r;
295 }
296
297
298 void
299 VideoPanel::film_changed (Film::Property property)
300 {
301         switch (property) {
302         case Film::VIDEO_FRAME_RATE:
303         case Film::CONTAINER:
304         case Film::RESOLUTION:
305                 setup_description ();
306                 setup_sensitivity ();
307                 break;
308         case Film::REEL_TYPE:
309         case Film::INTEROP:
310                 setup_sensitivity ();
311                 break;
312         default:
313                 break;
314         }
315 }
316
317 std::size_t
318 hash_value (boost::optional<ColourConversion> const & c)
319 {
320         boost::hash<string> hasher;
321         if (!c) {
322                 return hasher ("none");
323         }
324         return hasher (c->identifier());
325 }
326
327
328 void
329 VideoPanel::film_content_changed (int property)
330 {
331         ContentList vc = _parent->selected_video ();
332         shared_ptr<Content> vcs;
333         shared_ptr<FFmpegContent> fcs;
334         if (!vc.empty ()) {
335                 vcs = vc.front ();
336                 fcs = dynamic_pointer_cast<FFmpegContent> (vcs);
337         }
338
339         if (property == ContentProperty::VIDEO_FRAME_RATE ||
340             property == VideoContentProperty::FRAME_TYPE ||
341             property == VideoContentProperty::CROP ||
342             property == VideoContentProperty::SCALE) {
343                 setup_description ();
344         } else if (property == VideoContentProperty::COLOUR_CONVERSION) {
345                 boost::unordered_set<optional<ColourConversion> > check;
346                 BOOST_FOREACH (shared_ptr<const Content> i, vc) {
347                         check.insert (i->video->colour_conversion());
348                 }
349
350                 /* Remove any "Many" entry that we might have added previously.  There should
351                  * be entries for each preset plus one for "None" and one for "Custom".
352                  */
353                 vector<PresetColourConversion> cc = PresetColourConversion::all ();
354                 if (_colour_conversion->GetCount() > cc.size() + 2) {
355                         _colour_conversion->Delete (_colour_conversion->GetCount() - 1);
356                 }
357
358                 if (check.size() == 1) {
359                         if (vcs && vcs->video->colour_conversion ()) {
360                                 optional<size_t> preset = vcs->video->colour_conversion().get().preset ();
361                                 if (preset) {
362                                         checked_set (_colour_conversion, preset.get() + 1);
363                                 } else {
364                                         checked_set (_colour_conversion, cc.size() + 1);
365                                 }
366                         } else {
367                                 checked_set (_colour_conversion, 0);
368                         }
369                 } else if (check.size() > 1) {
370                         /* Add a "many" entry and select it as an indication that multiple different
371                          * colour conversions are present in the selection.
372                          */
373                         _colour_conversion->Append (_("Many"));
374                         checked_set (_colour_conversion, _colour_conversion->GetCount() - 1);
375                 }
376
377                 setup_sensitivity ();
378
379         } else if (property == FFmpegContentProperty::FILTERS) {
380                 if (fcs) {
381                         string p = Filter::ffmpeg_string (fcs->filters ());
382                         if (p.empty ()) {
383                                 checked_set (_filters, _("None"));
384                         } else {
385                                 if (p.length() > 25) {
386                                         p = p.substr (0, 25) + "...";
387                                 }
388                                 checked_set (_filters, p);
389                         }
390                 }
391         } else if (property == VideoContentProperty::FADE_IN) {
392                 set<Frame> check;
393                 BOOST_FOREACH (shared_ptr<const Content> i, vc) {
394                         check.insert (i->video->fade_in ());
395                 }
396
397                 if (check.size() == 1) {
398                         _fade_in->set (
399                                 ContentTime::from_frames (vc.front()->video->fade_in(), vc.front()->active_video_frame_rate(_parent->film())),
400                                 vc.front()->active_video_frame_rate(_parent->film())
401                                 );
402                 } else {
403                         _fade_in->clear ();
404                 }
405         } else if (property == VideoContentProperty::FADE_OUT) {
406                 set<Frame> check;
407                 BOOST_FOREACH (shared_ptr<const Content> i, vc) {
408                         check.insert (i->video->fade_out ());
409                 }
410
411                 if (check.size() == 1) {
412                         _fade_out->set (
413                                 ContentTime::from_frames (vc.front()->video->fade_out(), vc.front()->active_video_frame_rate(_parent->film())),
414                                 vc.front()->active_video_frame_rate(_parent->film())
415                                 );
416                 } else {
417                         _fade_out->clear ();
418                 }
419         } else if (property == DCPContentProperty::REFERENCE_VIDEO) {
420                 if (vc.size() == 1) {
421                         shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (vc.front ());
422                         checked_set (_reference, dcp ? dcp->reference_video () : false);
423                 } else {
424                         checked_set (_reference, false);
425                 }
426
427                 setup_sensitivity ();
428         }
429 }
430
431 /** Called when the `Edit filters' button has been clicked */
432 void
433 VideoPanel::edit_filters_clicked ()
434 {
435         FFmpegContentList c = _parent->selected_ffmpeg ();
436         if (c.size() != 1) {
437                 return;
438         }
439
440         FilterDialog* d = new FilterDialog (this, c.front()->filters());
441         d->ActiveChanged.connect (bind (&FFmpegContent::set_filters, c.front(), _1));
442         d->ShowModal ();
443         d->Destroy ();
444 }
445
446 void
447 VideoPanel::setup_description ()
448 {
449         ContentList vc = _parent->selected_video ();
450         if (vc.empty ()) {
451                 checked_set (_description, wxT (""));
452                 return;
453         } else if (vc.size() > 1) {
454                 checked_set (_description, _("Multiple content selected"));
455                 return;
456         }
457
458         string d = vc.front()->video->processing_description (_parent->film());
459         size_t lines = count (d.begin(), d.end(), '\n');
460
461         for (int i = lines; i < 6; ++i) {
462                 d += "\n ";
463         }
464
465         checked_set (_description, d);
466         _sizer->Layout ();
467 }
468
469 void
470 VideoPanel::colour_conversion_changed ()
471 {
472         ContentList vc = _parent->selected_video ();
473
474         int const s = _colour_conversion->GetSelection ();
475         vector<PresetColourConversion> all = PresetColourConversion::all ();
476
477         if (s == int(all.size() + 1)) {
478                 edit_colour_conversion_clicked ();
479         } else {
480                 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
481                         if (s == 0) {
482                                 i->video->unset_colour_conversion ();
483                         } else if (s != int(all.size() + 2)) {
484                                 i->video->set_colour_conversion (all[s - 1].conversion);
485                         }
486                 }
487         }
488 }
489
490 void
491 VideoPanel::edit_colour_conversion_clicked ()
492 {
493         ContentList vc = _parent->selected_video ();
494
495         ContentColourConversionDialog* d = new ContentColourConversionDialog (this, vc.front()->video->yuv ());
496         d->set (vc.front()->video->colour_conversion().get_value_or (PresetColourConversion::all().front().conversion));
497         if (d->ShowModal() == wxID_OK) {
498                 BOOST_FOREACH (shared_ptr<Content> i, vc) {
499                         i->video->set_colour_conversion (d->get ());
500                 }
501         } else {
502                 /* Reset the colour conversion choice */
503                 film_content_changed (VideoContentProperty::COLOUR_CONVERSION);
504         }
505         d->Destroy ();
506 }
507
508 void
509 VideoPanel::content_selection_changed ()
510 {
511         ContentList video_sel = _parent->selected_video ();
512
513         _frame_type->set_content (video_sel);
514         _left_crop->set_content (video_sel);
515         _right_crop->set_content (video_sel);
516         _top_crop->set_content (video_sel);
517         _bottom_crop->set_content (video_sel);
518         _scale->set_content (video_sel);
519
520         film_content_changed (ContentProperty::VIDEO_FRAME_RATE);
521         film_content_changed (VideoContentProperty::CROP);
522         film_content_changed (VideoContentProperty::COLOUR_CONVERSION);
523         film_content_changed (VideoContentProperty::FADE_IN);
524         film_content_changed (VideoContentProperty::FADE_OUT);
525         film_content_changed (FFmpegContentProperty::FILTERS);
526         film_content_changed (DCPContentProperty::REFERENCE_VIDEO);
527
528         setup_sensitivity ();
529 }
530
531 void
532 VideoPanel::setup_sensitivity ()
533 {
534         ContentList sel = _parent->selected ();
535
536         shared_ptr<DCPContent> dcp;
537         if (sel.size() == 1) {
538                 dcp = dynamic_pointer_cast<DCPContent> (sel.front ());
539         }
540
541         string why_not;
542         bool const can_reference = dcp && dcp->can_reference_video (_parent->film(), why_not);
543         setup_refer_button (_reference, _reference_note, dcp, can_reference, why_not);
544
545         if (_reference->GetValue ()) {
546                 _frame_type->wrapped()->Enable (false);
547                 _left_crop->wrapped()->Enable (false);
548                 _right_crop->wrapped()->Enable (false);
549                 _top_crop->wrapped()->Enable (false);
550                 _bottom_crop->wrapped()->Enable (false);
551                 _fade_in->Enable (false);
552                 _fade_out->Enable (false);
553                 _scale->wrapped()->Enable (false);
554                 _description->Enable (false);
555                 _filters->Enable (false);
556                 _filters_button->Enable (false);
557                 _colour_conversion->Enable (false);
558         } else {
559                 ContentList video_sel = _parent->selected_video ();
560                 FFmpegContentList ffmpeg_sel = _parent->selected_ffmpeg ();
561                 bool const single = video_sel.size() == 1;
562
563                 _frame_type->wrapped()->Enable (true);
564                 _left_crop->wrapped()->Enable (true);
565                 _right_crop->wrapped()->Enable (true);
566                 _top_crop->wrapped()->Enable (true);
567                 _bottom_crop->wrapped()->Enable (true);
568                 _fade_in->Enable (!video_sel.empty ());
569                 _fade_out->Enable (!video_sel.empty ());
570                 _scale->wrapped()->Enable (true);
571                 _description->Enable (true);
572                 _filters->Enable (true);
573                 _filters_button->Enable (single && !ffmpeg_sel.empty ());
574                 _colour_conversion->Enable (!video_sel.empty());
575         }
576
577         ContentList vc = _parent->selected_video ();
578         shared_ptr<Content> vcs;
579         if (!vc.empty ()) {
580                 vcs = vc.front ();
581         }
582
583         if (vcs && vcs->video->colour_conversion ()) {
584                 _edit_colour_conversion_button->Enable (!vcs->video->colour_conversion().get().preset());
585         } else {
586                 _edit_colour_conversion_button->Enable (false);
587         }
588 }
589
590 void
591 VideoPanel::fade_in_changed ()
592 {
593         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video ()) {
594                 double const vfr = i->active_video_frame_rate (_parent->film());
595                 i->video->set_fade_in (_fade_in->get(vfr).frames_round(vfr));
596         }
597 }
598
599 void
600 VideoPanel::fade_out_changed ()
601 {
602         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video ()) {
603                 double const vfr = i->active_video_frame_rate (_parent->film());
604                 i->video->set_fade_out (_fade_out->get(vfr).frames_round(vfr));
605         }
606 }
607
608 void
609 VideoPanel::reference_clicked ()
610 {
611         ContentList c = _parent->selected ();
612         if (c.size() != 1) {
613                 return;
614         }
615
616         shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent> (c.front ());
617         if (!d) {
618                 return;
619         }
620
621         d->set_reference_video (_reference->GetValue ());
622 }