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