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