Allow changing colour conversion settings for multiple pieces of content at the same...
[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
57 static VideoContentScale
58 index_to_scale (int n)
59 {
60         vector<VideoContentScale> scales = VideoContentScale::all ();
61         DCPOMATIC_ASSERT (n >= 0);
62         DCPOMATIC_ASSERT (n < int (scales.size ()));
63         return scales[n];
64 }
65
66 static int
67 scale_to_index (VideoContentScale scale)
68 {
69         vector<VideoContentScale> scales = VideoContentScale::all ();
70         for (size_t i = 0; i < scales.size(); ++i) {
71                 if (scales[i] == scale) {
72                         return i;
73                 }
74         }
75
76         DCPOMATIC_ASSERT (false);
77 }
78
79 VideoPanel::VideoPanel (ContentPanel* p)
80         : ContentSubPanel (p, _("Video"))
81 {
82         _reference = new CheckBox (this, _("Use this DCP's video as OV and make VF"));
83         _reference_note = new StaticText (this, wxT(""));
84         _reference_note->Wrap (200);
85         wxFont font = _reference_note->GetFont();
86         font.SetStyle(wxFONTSTYLE_ITALIC);
87         font.SetPointSize(font.GetPointSize() - 1);
88         _reference_note->SetFont(font);
89
90         _type_label = create_label (this, _("Type"), true);
91         _frame_type = new ContentChoice<VideoContent, VideoFrameType> (
92                 this,
93                 new wxChoice (this, wxID_ANY),
94                 VideoContentProperty::FRAME_TYPE,
95                 &Content::video,
96                 boost::mem_fn (&VideoContent::frame_type),
97                 boost::mem_fn (&VideoContent::set_frame_type),
98                 &caster<int, VideoFrameType>,
99                 &caster<VideoFrameType, int>
100                 );
101
102         _left_crop_label = create_label (this, _("Left crop"), 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 crop"), 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 crop"), 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 crop"), 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 StaticText (this, _("None"), wxDefaultPosition, size);
166         _filters_button = new Button (this, _("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 Button (this, _("Edit..."));
178
179         _description = new StaticText (this, wxT ("\n \n \n \n \n"), wxDefaultPosition, wxDefaultSize);
180         _description->SetFont(font);
181
182         _left_crop->wrapped()->SetRange (0, 4096);
183         _top_crop->wrapped()->SetRange (0, 4096);
184         _right_crop->wrapped()->SetRange (0, 4096);
185         _bottom_crop->wrapped()->SetRange (0, 4096);
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         add_to_grid ();
211 }
212
213 void
214 VideoPanel::add_to_grid ()
215 {
216         bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
217
218         int r = 0;
219
220         _reference->Show (full);
221         _reference_note->Show (full);
222
223         if (full) {
224                 wxBoxSizer* reference_sizer = new wxBoxSizer (wxVERTICAL);
225                 reference_sizer->Add (_reference, 0);
226                 reference_sizer->Add (_reference_note, 0);
227                 _grid->Add (reference_sizer, wxGBPosition(r, 0), wxGBSpan(1, 3));
228                 ++r;
229         }
230
231         add_label_to_sizer (_grid, _type_label, true, wxGBPosition(r, 0));
232         _frame_type->add (_grid, wxGBPosition(r, 1), wxGBSpan(1, 2));
233         ++r;
234
235         int cr = 0;
236         wxGridBagSizer* crop = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
237         add_label_to_sizer (crop, _left_crop_label, true, wxGBPosition (cr, 0));
238         _left_crop->add (crop, wxGBPosition (cr, 1));
239         add_label_to_sizer (crop, _right_crop_label, true, wxGBPosition (cr, 2));
240         _right_crop->add (crop, wxGBPosition (cr, 3));
241         ++cr;
242         add_label_to_sizer (crop, _top_crop_label, true, wxGBPosition (cr, 0));
243         _top_crop->add (crop, wxGBPosition (cr, 1));
244         add_label_to_sizer (crop, _bottom_crop_label, true, wxGBPosition (cr, 2));
245         _bottom_crop->add (crop, wxGBPosition (cr, 3));
246         _grid->Add (crop, wxGBPosition (r, 0), wxGBSpan (2, 4));
247         r += 2;
248
249         _scale_to_label->Show (full);
250         _scale->show (full);
251         _filters_label->Show (full);
252         _filters->Show (full);
253         _filters_button->Show (full);
254         _colour_conversion_label->Show (full);
255         _colour_conversion->Show (full);
256         _edit_colour_conversion_button->Show (full);
257
258         add_label_to_sizer (_grid, _fade_in_label, true, wxGBPosition (r, 0));
259         _grid->Add (_fade_in, wxGBPosition (r, 1), wxGBSpan (1, 3));
260         ++r;
261
262         add_label_to_sizer (_grid, _fade_out_label, true, wxGBPosition (r, 0));
263         _grid->Add (_fade_out, wxGBPosition (r, 1), wxGBSpan (1, 3));
264         ++r;
265
266         if (full) {
267                 add_label_to_sizer (_grid, _scale_to_label, true, wxGBPosition (r, 0));
268                 _scale->add (_grid, wxGBPosition (r, 1), wxGBSpan (1, 2));
269                 ++r;
270
271                 add_label_to_sizer (_grid, _filters_label, true, wxGBPosition (r, 0));
272                 {
273                         wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
274                         s->Add (_filters, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
275                         s->Add (_filters_button, 0, wxALIGN_CENTER_VERTICAL);
276                         _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
277                 }
278                 ++r;
279
280                 add_label_to_sizer (_grid, _colour_conversion_label, true, wxGBPosition(r, 0));
281                 {
282                         wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
283                         s->Add (_colour_conversion, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
284                         s->Add (_edit_colour_conversion_button, 0, wxALIGN_CENTER_VERTICAL);
285                         _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
286                 }
287                 ++r;
288         }
289
290         _grid->Add (_description, wxGBPosition (r, 0), wxGBSpan (1, 4), wxEXPAND | wxALIGN_CENTER_VERTICAL, 6);
291         ++r;
292 }
293
294
295 void
296 VideoPanel::film_changed (Film::Property property)
297 {
298         switch (property) {
299         case Film::VIDEO_FRAME_RATE:
300         case Film::CONTAINER:
301         case Film::RESOLUTION:
302                 setup_description ();
303                 setup_sensitivity ();
304                 break;
305         case Film::REEL_TYPE:
306         case Film::INTEROP:
307                 setup_sensitivity ();
308                 break;
309         default:
310                 break;
311         }
312 }
313
314 std::size_t
315 hash_value (boost::optional<ColourConversion> const & c)
316 {
317         boost::hash<string> hasher;
318         if (!c) {
319                 return hasher ("none");
320         }
321         return hasher (c->identifier());
322 }
323
324
325 void
326 VideoPanel::film_content_changed (int property)
327 {
328         ContentList vc = _parent->selected_video ();
329         shared_ptr<Content> vcs;
330         shared_ptr<FFmpegContent> fcs;
331         if (!vc.empty ()) {
332                 vcs = vc.front ();
333                 fcs = dynamic_pointer_cast<FFmpegContent> (vcs);
334         }
335
336         if (property == ContentProperty::VIDEO_FRAME_RATE ||
337             property == VideoContentProperty::FRAME_TYPE ||
338             property == VideoContentProperty::CROP ||
339             property == VideoContentProperty::SCALE) {
340                 setup_description ();
341         } else if (property == VideoContentProperty::COLOUR_CONVERSION) {
342                 boost::unordered_set<optional<ColourConversion> > check;
343                 BOOST_FOREACH (shared_ptr<const Content> i, vc) {
344                         check.insert (i->video->colour_conversion());
345                 }
346
347                 /* Remove any "Many" entry that we might have added previously.  There should
348                  * be entries for each preset plus one for "None" and one for "Custom".
349                  */
350                 vector<PresetColourConversion> cc = PresetColourConversion::all ();
351                 if (_colour_conversion->GetCount() > cc.size() + 2) {
352                         _colour_conversion->Delete (_colour_conversion->GetCount() - 1);
353                 }
354
355                 if (check.size() == 1) {
356                         if (vcs && vcs->video->colour_conversion ()) {
357                                 optional<size_t> preset = vcs->video->colour_conversion().get().preset ();
358                                 if (preset) {
359                                         checked_set (_colour_conversion, preset.get() + 1);
360                                 } else {
361                                         checked_set (_colour_conversion, cc.size() + 1);
362                                 }
363                         } else {
364                                 checked_set (_colour_conversion, 0);
365                         }
366                 } else if (check.size() > 1) {
367                         /* Add a "many" entry and select it as an indication that multiple different
368                          * colour conversions are present in the selection.
369                          */
370                         _colour_conversion->Append (_("Many"));
371                         checked_set (_colour_conversion, _colour_conversion->GetCount() - 1);
372                 }
373
374                 setup_sensitivity ();
375
376         } else if (property == FFmpegContentProperty::FILTERS) {
377                 if (fcs) {
378                         string p = Filter::ffmpeg_string (fcs->filters ());
379                         if (p.empty ()) {
380                                 checked_set (_filters, _("None"));
381                         } else {
382                                 if (p.length() > 25) {
383                                         p = p.substr (0, 25) + "...";
384                                 }
385                                 checked_set (_filters, p);
386                         }
387                 }
388         } else if (property == VideoContentProperty::FADE_IN) {
389                 set<Frame> check;
390                 BOOST_FOREACH (shared_ptr<const Content> i, vc) {
391                         check.insert (i->video->fade_in ());
392                 }
393
394                 if (check.size() == 1) {
395                         _fade_in->set (
396                                 ContentTime::from_frames (vc.front()->video->fade_in(), vc.front()->active_video_frame_rate(_parent->film())),
397                                 vc.front()->active_video_frame_rate(_parent->film())
398                                 );
399                 } else {
400                         _fade_in->clear ();
401                 }
402         } else if (property == VideoContentProperty::FADE_OUT) {
403                 set<Frame> check;
404                 BOOST_FOREACH (shared_ptr<const Content> i, vc) {
405                         check.insert (i->video->fade_out ());
406                 }
407
408                 if (check.size() == 1) {
409                         _fade_out->set (
410                                 ContentTime::from_frames (vc.front()->video->fade_out(), vc.front()->active_video_frame_rate(_parent->film())),
411                                 vc.front()->active_video_frame_rate(_parent->film())
412                                 );
413                 } else {
414                         _fade_out->clear ();
415                 }
416         } else if (property == DCPContentProperty::REFERENCE_VIDEO) {
417                 if (vc.size() == 1) {
418                         shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (vc.front ());
419                         checked_set (_reference, dcp ? dcp->reference_video () : false);
420                 } else {
421                         checked_set (_reference, false);
422                 }
423
424                 setup_sensitivity ();
425         }
426 }
427
428 /** Called when the `Edit filters' button has been clicked */
429 void
430 VideoPanel::edit_filters_clicked ()
431 {
432         FFmpegContentList c = _parent->selected_ffmpeg ();
433         if (c.size() != 1) {
434                 return;
435         }
436
437         FilterDialog* d = new FilterDialog (this, c.front()->filters());
438         d->ActiveChanged.connect (bind (&FFmpegContent::set_filters, c.front(), _1));
439         d->ShowModal ();
440         d->Destroy ();
441 }
442
443 void
444 VideoPanel::setup_description ()
445 {
446         ContentList vc = _parent->selected_video ();
447         if (vc.empty ()) {
448                 checked_set (_description, wxT (""));
449                 return;
450         } else if (vc.size() > 1) {
451                 checked_set (_description, _("Multiple content selected"));
452                 return;
453         }
454
455         string d = vc.front()->video->processing_description (_parent->film());
456         size_t lines = count (d.begin(), d.end(), '\n');
457
458         for (int i = lines; i < 6; ++i) {
459                 d += "\n ";
460         }
461
462         checked_set (_description, d);
463         _sizer->Layout ();
464 }
465
466 void
467 VideoPanel::colour_conversion_changed ()
468 {
469         ContentList vc = _parent->selected_video ();
470
471         int const s = _colour_conversion->GetSelection ();
472         vector<PresetColourConversion> all = PresetColourConversion::all ();
473
474         if (s == int(all.size() + 1)) {
475                 edit_colour_conversion_clicked ();
476         } else {
477                 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
478                         if (s == 0) {
479                                 i->video->unset_colour_conversion ();
480                         } else if (s != int(all.size() + 2)) {
481                                 i->video->set_colour_conversion (all[s - 1].conversion);
482                         }
483                 }
484         }
485 }
486
487 void
488 VideoPanel::edit_colour_conversion_clicked ()
489 {
490         ContentList vc = _parent->selected_video ();
491
492         ContentColourConversionDialog* d = new ContentColourConversionDialog (this, vc.front()->video->yuv ());
493         d->set (vc.front()->video->colour_conversion().get_value_or (PresetColourConversion::all().front().conversion));
494         if (d->ShowModal() == wxID_OK) {
495                 BOOST_FOREACH (shared_ptr<Content> i, vc) {
496                         i->video->set_colour_conversion (d->get ());
497                 }
498         } else {
499                 /* Reset the colour conversion choice */
500                 film_content_changed (VideoContentProperty::COLOUR_CONVERSION);
501         }
502         d->Destroy ();
503 }
504
505 void
506 VideoPanel::content_selection_changed ()
507 {
508         ContentList video_sel = _parent->selected_video ();
509
510         _frame_type->set_content (video_sel);
511         _left_crop->set_content (video_sel);
512         _right_crop->set_content (video_sel);
513         _top_crop->set_content (video_sel);
514         _bottom_crop->set_content (video_sel);
515         _scale->set_content (video_sel);
516
517         film_content_changed (ContentProperty::VIDEO_FRAME_RATE);
518         film_content_changed (VideoContentProperty::CROP);
519         film_content_changed (VideoContentProperty::COLOUR_CONVERSION);
520         film_content_changed (VideoContentProperty::FADE_IN);
521         film_content_changed (VideoContentProperty::FADE_OUT);
522         film_content_changed (FFmpegContentProperty::FILTERS);
523         film_content_changed (DCPContentProperty::REFERENCE_VIDEO);
524
525         setup_sensitivity ();
526 }
527
528 void
529 VideoPanel::setup_sensitivity ()
530 {
531         ContentList sel = _parent->selected ();
532
533         shared_ptr<DCPContent> dcp;
534         if (sel.size() == 1) {
535                 dcp = dynamic_pointer_cast<DCPContent> (sel.front ());
536         }
537
538         string why_not;
539         bool const can_reference = dcp && dcp->can_reference_video (_parent->film(), why_not);
540         setup_refer_button (_reference, _reference_note, dcp, can_reference, why_not);
541
542         if (_reference->GetValue ()) {
543                 _frame_type->wrapped()->Enable (false);
544                 _left_crop->wrapped()->Enable (false);
545                 _right_crop->wrapped()->Enable (false);
546                 _top_crop->wrapped()->Enable (false);
547                 _bottom_crop->wrapped()->Enable (false);
548                 _fade_in->Enable (false);
549                 _fade_out->Enable (false);
550                 _scale->wrapped()->Enable (false);
551                 _description->Enable (false);
552                 _filters->Enable (false);
553                 _filters_button->Enable (false);
554                 _colour_conversion->Enable (false);
555         } else {
556                 ContentList video_sel = _parent->selected_video ();
557                 FFmpegContentList ffmpeg_sel = _parent->selected_ffmpeg ();
558                 bool const single = video_sel.size() == 1;
559
560                 _frame_type->wrapped()->Enable (true);
561                 _left_crop->wrapped()->Enable (true);
562                 _right_crop->wrapped()->Enable (true);
563                 _top_crop->wrapped()->Enable (true);
564                 _bottom_crop->wrapped()->Enable (true);
565                 _fade_in->Enable (!video_sel.empty ());
566                 _fade_out->Enable (!video_sel.empty ());
567                 _scale->wrapped()->Enable (true);
568                 _description->Enable (true);
569                 _filters->Enable (true);
570                 _filters_button->Enable (single && !ffmpeg_sel.empty ());
571                 _colour_conversion->Enable (!video_sel.empty());
572         }
573
574         ContentList vc = _parent->selected_video ();
575         shared_ptr<Content> vcs;
576         if (!vc.empty ()) {
577                 vcs = vc.front ();
578         }
579
580         if (vcs && vcs->video->colour_conversion ()) {
581                 _edit_colour_conversion_button->Enable (!vcs->video->colour_conversion().get().preset());
582         } else {
583                 _edit_colour_conversion_button->Enable (false);
584         }
585 }
586
587 void
588 VideoPanel::fade_in_changed ()
589 {
590         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video ()) {
591                 double const vfr = i->active_video_frame_rate (_parent->film());
592                 i->video->set_fade_in (_fade_in->get(vfr).frames_round(vfr));
593         }
594 }
595
596 void
597 VideoPanel::fade_out_changed ()
598 {
599         BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video ()) {
600                 double const vfr = i->active_video_frame_rate (_parent->film());
601                 i->video->set_fade_out (_fade_out->get(vfr).frames_round(vfr));
602         }
603 }
604
605 void
606 VideoPanel::reference_clicked ()
607 {
608         ContentList c = _parent->selected ();
609         if (c.size() != 1) {
610                 return;
611         }
612
613         shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent> (c.front ());
614         if (!d) {
615                 return;
616         }
617
618         d->set_reference_video (_reference->GetValue ());
619 }