summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-09-16 10:31:18 +0100
committerCarl Hetherington <cth@carlh.net>2015-09-16 10:31:18 +0100
commit4e6f15f602c605804f95c6b06af9bf79eaf2dde1 (patch)
tree00fb9eb482b3a770b99cb57a4f2e8968416124ec /src
parentdd59755d86cdb1892bb0ba4d69af520cee4aa964 (diff)
Front-end to set up referencing of DCPs.
Diffstat (limited to 'src')
-rw-r--r--src/lib/analyse_audio_job.cc1
-rw-r--r--src/lib/dcp_content.cc38
-rw-r--r--src/lib/dcp_content.h9
-rw-r--r--src/wx/audio_panel.cc65
-rw-r--r--src/wx/audio_panel.h3
-rw-r--r--src/wx/content_colour_conversion_dialog.h1
-rw-r--r--src/wx/subtitle_panel.cc53
-rw-r--r--src/wx/subtitle_panel.h2
-rw-r--r--src/wx/video_panel.cc101
-rw-r--r--src/wx/video_panel.h3
10 files changed, 242 insertions, 34 deletions
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc
index f0fd351b4..525ac6c91 100644
--- a/src/lib/analyse_audio_job.cc
+++ b/src/lib/analyse_audio_job.cc
@@ -74,6 +74,7 @@ AnalyseAudioJob::run ()
shared_ptr<Player> player (new Player (_film, _playlist));
player->set_ignore_video ();
player->set_fast ();
+ player->set_play_referenced ();
DCPTime const start = _playlist->start().get_value_or (DCPTime ());
DCPTime const length = _playlist->length ();
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index 15bcd0b56..cb9dcf53d 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -39,7 +39,10 @@ using std::list;
using boost::shared_ptr;
using boost::optional;
-int const DCPContentProperty::CAN_BE_PLAYED = 600;
+int const DCPContentProperty::CAN_BE_PLAYED = 600;
+int const DCPContentProperty::REFERENCE_VIDEO = 601;
+int const DCPContentProperty::REFERENCE_AUDIO = 602;
+int const DCPContentProperty::REFERENCE_SUBTITLE = 603;
DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p)
: Content (film)
@@ -209,3 +212,36 @@ DCPContent::set_default_colour_conversion ()
/* Default to no colour conversion for DCPs */
unset_colour_conversion ();
}
+
+void
+DCPContent::set_reference_video (bool r)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _reference_video = r;
+ }
+
+ signal_changed (DCPContentProperty::REFERENCE_VIDEO);
+}
+
+void
+DCPContent::set_reference_audio (bool r)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _reference_audio = r;
+ }
+
+ signal_changed (DCPContentProperty::REFERENCE_AUDIO);
+}
+
+void
+DCPContent::set_reference_subtitle (bool r)
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _reference_subtitle = r;
+ }
+
+ signal_changed (DCPContentProperty::REFERENCE_SUBTITLE);
+}
diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h
index 5a0559df2..8f01bbc4e 100644
--- a/src/lib/dcp_content.h
+++ b/src/lib/dcp_content.h
@@ -34,6 +34,9 @@ class DCPContentProperty
{
public:
static int const CAN_BE_PLAYED;
+ static int const REFERENCE_VIDEO;
+ static int const REFERENCE_AUDIO;
+ static int const REFERENCE_SUBTITLE;
};
/** @class DCPContent
@@ -85,16 +88,22 @@ public:
bool can_be_played () const;
+ void set_reference_video (bool r);
+
bool reference_video () const {
boost::mutex::scoped_lock lm (_mutex);
return _reference_video;
}
+ void set_reference_audio (bool r);
+
bool reference_audio () const {
boost::mutex::scoped_lock lm (_mutex);
return _reference_audio;
}
+ void set_reference_subtitle (bool r);
+
bool reference_subtitle () const {
boost::mutex::scoped_lock lm (_mutex);
return _reference_subtitle;
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc
index b89cbb01f..a4976b8c1 100644
--- a/src/wx/audio_panel.cc
+++ b/src/wx/audio_panel.cc
@@ -27,6 +27,7 @@
#include "lib/ffmpeg_content.h"
#include "lib/cinema_sound_processor.h"
#include "lib/job_manager.h"
+#include "lib/dcp_content.h"
#include <wx/spinctrl.h>
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
@@ -51,6 +52,10 @@ AudioPanel::AudioPanel (ContentPanel* p)
int r = 0;
+ _reference = new wxCheckBox (this, wxID_ANY, _("Refer to existing DCP"));
+ grid->Add (_reference, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+
{
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_show = new wxButton (this, wxID_ANY, _("Show graph of audio levels..."));
@@ -107,8 +112,9 @@ AudioPanel::AudioPanel (ContentPanel* p)
_gain->wrapped()->SetIncrement (0.5);
_delay->wrapped()->SetRange (-1000, 1000);
- _show->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&AudioPanel::show_clicked, this));
- _gain_calculate_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&AudioPanel::gain_calculate_button_clicked, this));
+ _reference->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AudioPanel::reference_clicked, this));
+ _show->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&AudioPanel::show_clicked, this));
+ _gain_calculate_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&AudioPanel::gain_calculate_button_clicked, this));
_mapping_connection = _mapping->Changed.connect (boost::bind (&AudioPanel::mapping_changed, this, _1));
@@ -143,8 +149,8 @@ AudioPanel::film_changed (Film::Property property)
void
AudioPanel::film_content_changed (int property)
{
+ AudioContentList ac = _parent->selected_audio ();
if (property == AudioContentProperty::AUDIO_STREAMS) {
- AudioContentList ac = _parent->selected_audio ();
if (ac.size() == 1) {
_mapping->set (ac.front()->audio_mapping());
_mapping->set_input_channels (ac.front()->audio_channel_names ());
@@ -156,6 +162,15 @@ AudioPanel::film_content_changed (int property)
_sizer->Layout ();
} else if (property == AudioContentProperty::AUDIO_GAIN) {
setup_peak ();
+ } else if (property == DCPContentProperty::REFERENCE_AUDIO) {
+ if (ac.size() == 1) {
+ shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (ac.front ());
+ checked_set (_reference, dcp ? dcp->reference_audio () : false);
+ } else {
+ checked_set (_reference, false);
+ }
+
+ setup_sensitivity ();
}
}
@@ -214,10 +229,32 @@ AudioPanel::content_selection_changed ()
_gain->set_content (sel);
_delay->set_content (sel);
- _gain_calculate_button->Enable (sel.size() == 1);
- _mapping->Enable (sel.size() == 1);
-
film_content_changed (AudioContentProperty::AUDIO_STREAMS);
+
+ setup_sensitivity ();
+}
+
+void
+AudioPanel::setup_sensitivity ()
+{
+ AudioContentList sel = _parent->selected_audio ();
+ _reference->Enable (sel.size() == 1 && dynamic_pointer_cast<DCPContent> (sel.front ()));
+
+ if (_reference->GetValue ()) {
+ _gain->wrapped()->Enable (false);
+ _gain_calculate_button->Enable (false);
+ _peak->Enable (false);
+ _delay->wrapped()->Enable (false);
+ _mapping->Enable (false);
+ _description->Enable (false);
+ } else {
+ _gain->wrapped()->Enable (true);
+ _gain_calculate_button->Enable (sel.size() == 1);
+ _peak->Enable (true);
+ _delay->wrapped()->Enable (true);
+ _mapping->Enable (sel.size() == 1);
+ _description->Enable (true);
+ }
}
void
@@ -280,3 +317,19 @@ AudioPanel::active_jobs_changed (optional<string> j)
setup_peak ();
}
}
+
+void
+AudioPanel::reference_clicked ()
+{
+ ContentList c = _parent->selected ();
+ if (c.size() != 1) {
+ return;
+ }
+
+ shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent> (c.front ());
+ if (!d) {
+ return;
+ }
+
+ d->set_reference_audio (_reference->GetValue ());
+}
diff --git a/src/wx/audio_panel.h b/src/wx/audio_panel.h
index 00b06442e..47deaf261 100644
--- a/src/wx/audio_panel.h
+++ b/src/wx/audio_panel.h
@@ -45,7 +45,10 @@ private:
void setup_description ();
void setup_peak ();
void active_jobs_changed (boost::optional<std::string>);
+ void setup_sensitivity ();
+ void reference_clicked ();
+ wxCheckBox* _reference;
wxButton* _show;
ContentSpinCtrlDouble<AudioContent>* _gain;
wxButton* _gain_calculate_button;
diff --git a/src/wx/content_colour_conversion_dialog.h b/src/wx/content_colour_conversion_dialog.h
index 407f3f0c8..f5687a060 100644
--- a/src/wx/content_colour_conversion_dialog.h
+++ b/src/wx/content_colour_conversion_dialog.h
@@ -17,6 +17,7 @@
*/
+#include "lib/colour_conversion.h"
#include <wx/wx.h>
class ColourConversionEditor;
diff --git a/src/wx/subtitle_panel.cc b/src/wx/subtitle_panel.cc
index 40a48a5a2..d2f0e4c11 100644
--- a/src/wx/subtitle_panel.cc
+++ b/src/wx/subtitle_panel.cc
@@ -29,6 +29,7 @@
#include "lib/dcp_subtitle_content.h"
#include "lib/subrip_decoder.h"
#include "lib/dcp_subtitle_decoder.h"
+#include "lib/dcp_content.h"
#include <wx/spinctrl.h>
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
@@ -47,6 +48,10 @@ SubtitlePanel::SubtitlePanel (ContentPanel* p)
wxFlexGridSizer* grid = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
_sizer->Add (grid, 0, wxALL, 8);
+ _reference = new wxCheckBox (this, wxID_ANY, _("Refer to existing DCP"));
+ grid->Add (_reference);
+ grid->AddSpacer (0);
+
_use = new wxCheckBox (this, wxID_ANY, _("Use subtitles"));
grid->Add (_use);
grid->AddSpacer (0);
@@ -112,6 +117,7 @@ SubtitlePanel::SubtitlePanel (ContentPanel* p)
_x_scale->SetRange (10, 1000);
_y_scale->SetRange (10, 1000);
+ _reference->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&SubtitlePanel::reference_clicked, this));
_use->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&SubtitlePanel::use_toggled, this));
_burn->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&SubtitlePanel::burn_toggled, this));
_x_offset->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::x_offset_changed, this));
@@ -178,6 +184,15 @@ SubtitlePanel::film_content_changed (int property)
checked_set (_y_scale, scs ? lrint (scs->subtitle_y_scale() * 100) : 100);
} else if (property == SubtitleContentProperty::SUBTITLE_LANGUAGE) {
checked_set (_language, scs ? scs->subtitle_language() : "");
+ } else if (property == DCPContentProperty::REFERENCE_SUBTITLE) {
+ if (scs) {
+ shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (scs);
+ checked_set (_reference, dcp ? dcp->reference_subtitle () : false);
+ } else {
+ checked_set (_reference, false);
+ }
+
+ setup_sensitivity ();
}
}
@@ -227,17 +242,19 @@ SubtitlePanel::setup_sensitivity ()
}
}
- _use->Enable (any_subs > 0);
+ bool const reference = _reference->GetValue ();
+
+ _use->Enable (!reference && any_subs > 0);
bool const use = _use->GetValue ();
- _burn->Enable (any_subs > 0 && use && image_subs == 0);
- _x_offset->Enable (any_subs > 0 && use);
- _y_offset->Enable (any_subs > 0 && use);
- _x_scale->Enable (any_subs > 0 && use);
- _y_scale->Enable (any_subs > 0 && use);
- _language->Enable (any_subs > 0 && use);
- _stream->Enable (ffmpeg_subs == 1);
- _subtitle_view_button->Enable (subrip_or_dcp_subs == 1);
- _fonts_dialog_button->Enable (subrip_or_dcp_subs == 1);
+ _burn->Enable (!reference && any_subs > 0 && use && image_subs == 0);
+ _x_offset->Enable (!reference && any_subs > 0 && use);
+ _y_offset->Enable (!reference && any_subs > 0 && use);
+ _x_scale->Enable (!reference && any_subs > 0 && use);
+ _y_scale->Enable (!reference && any_subs > 0 && use);
+ _language->Enable (!reference && any_subs > 0 && use);
+ _stream->Enable (!reference && ffmpeg_subs == 1);
+ _subtitle_view_button->Enable (!reference && subrip_or_dcp_subs == 1);
+ _fonts_dialog_button->Enable (!reference && subrip_or_dcp_subs == 1);
}
void
@@ -360,3 +377,19 @@ SubtitlePanel::fonts_dialog_clicked ()
_fonts_dialog = new FontsDialog (this, c.front ());
_fonts_dialog->Show ();
}
+
+void
+SubtitlePanel::reference_clicked ()
+{
+ ContentList c = _parent->selected ();
+ if (c.size() != 1) {
+ return;
+ }
+
+ shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent> (c.front ());
+ if (!d) {
+ return;
+ }
+
+ d->set_reference_subtitle (_reference->GetValue ());
+}
diff --git a/src/wx/subtitle_panel.h b/src/wx/subtitle_panel.h
index 04f21860f..7eb9cd27e 100644
--- a/src/wx/subtitle_panel.h
+++ b/src/wx/subtitle_panel.h
@@ -44,9 +44,11 @@ private:
void stream_changed ();
void subtitle_view_clicked ();
void fonts_dialog_clicked ();
+ void reference_clicked ();
void setup_sensitivity ();
+ wxCheckBox* _reference;
wxCheckBox* _use;
wxCheckBox* _burn;
wxSpinCtrl* _x_offset;
diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc
index 86a738bca..dd9bb5848 100644
--- a/src/wx/video_panel.cc
+++ b/src/wx/video_panel.cc
@@ -17,6 +17,12 @@
*/
+#include "filter_dialog.h"
+#include "video_panel.h"
+#include "wx_util.h"
+#include "content_colour_conversion_dialog.h"
+#include "content_widget.h"
+#include "content_panel.h"
#include "lib/filter.h"
#include "lib/ffmpeg_content.h"
#include "lib/colour_conversion.h"
@@ -24,12 +30,7 @@
#include "lib/util.h"
#include "lib/ratio.h"
#include "lib/frame_rate_change.h"
-#include "filter_dialog.h"
-#include "video_panel.h"
-#include "wx_util.h"
-#include "content_colour_conversion_dialog.h"
-#include "content_widget.h"
-#include "content_panel.h"
+#include "lib/dcp_content.h"
#include <wx/spinctrl.h>
#include <boost/foreach.hpp>
#include <set>
@@ -76,6 +77,10 @@ VideoPanel::VideoPanel (ContentPanel* p)
int r = 0;
+ _reference = new wxCheckBox (this, wxID_ANY, _("Refer to existing DCP"));
+ grid->Add (_reference, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+
add_label_to_grid_bag_sizer (grid, this, _("Type"), true, wxGBPosition (r, 0));
_frame_type = new ContentChoice<VideoContent, VideoFrameType> (
this,
@@ -226,9 +231,10 @@ VideoPanel::VideoPanel (ContentPanel* p)
_fade_in->Changed.connect (boost::bind (&VideoPanel::fade_in_changed, this));
_fade_out->Changed.connect (boost::bind (&VideoPanel::fade_out_changed, this));
- _filters_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&VideoPanel::edit_filters_clicked, this));
- _colour_conversion->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&VideoPanel::colour_conversion_changed, this));
- _edit_colour_conversion_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&VideoPanel::edit_colour_conversion_clicked, this));
+ _reference->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&VideoPanel::reference_clicked, this));
+ _filters_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&VideoPanel::edit_filters_clicked, this));
+ _colour_conversion->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&VideoPanel::colour_conversion_changed, this));
+ _edit_colour_conversion_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&VideoPanel::edit_colour_conversion_clicked, this));
}
void
@@ -316,6 +322,15 @@ VideoPanel::film_content_changed (int property)
} else {
_fade_out->clear ();
}
+ } else if (property == DCPContentProperty::REFERENCE_VIDEO) {
+ if (vc.size() == 1) {
+ shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (vc.front ());
+ checked_set (_reference, dcp ? dcp->reference_video () : false);
+ } else {
+ checked_set (_reference, false);
+ }
+
+ setup_sensitivity ();
}
}
@@ -396,28 +411,64 @@ void
VideoPanel::content_selection_changed ()
{
VideoContentList video_sel = _parent->selected_video ();
- FFmpegContentList ffmpeg_sel = _parent->selected_ffmpeg ();
-
- bool const single = video_sel.size() == 1;
_frame_type->set_content (video_sel);
_left_crop->set_content (video_sel);
_right_crop->set_content (video_sel);
_top_crop->set_content (video_sel);
_bottom_crop->set_content (video_sel);
- _fade_in->Enable (!video_sel.empty ());
- _fade_out->Enable (!video_sel.empty ());
_scale->set_content (video_sel);
- _colour_conversion->Enable (single && !video_sel.empty ());
- _filters_button->Enable (single && !ffmpeg_sel.empty ());
-
film_content_changed (VideoContentProperty::VIDEO_CROP);
film_content_changed (VideoContentProperty::VIDEO_FRAME_RATE);
film_content_changed (VideoContentProperty::COLOUR_CONVERSION);
film_content_changed (VideoContentProperty::VIDEO_FADE_IN);
film_content_changed (VideoContentProperty::VIDEO_FADE_OUT);
film_content_changed (FFmpegContentProperty::FILTERS);
+ film_content_changed (DCPContentProperty::REFERENCE_VIDEO);
+
+ setup_sensitivity ();
+}
+
+void
+VideoPanel::setup_sensitivity ()
+{
+ ContentList sel = _parent->selected ();
+ _reference->Enable (sel.size() == 1 && dynamic_pointer_cast<DCPContent> (sel.front ()));
+
+ if (_reference->GetValue ()) {
+ _frame_type->wrapped()->Enable (false);
+ _left_crop->wrapped()->Enable (false);
+ _right_crop->wrapped()->Enable (false);
+ _top_crop->wrapped()->Enable (false);
+ _bottom_crop->wrapped()->Enable (false);
+ _fade_in->Enable (false);
+ _fade_out->Enable (false);
+ _scale->wrapped()->Enable (false);
+ _description->Enable (false);
+ _filters->Enable (false);
+ _filters_button->Enable (false);
+ _colour_conversion->Enable (false);
+ _edit_colour_conversion_button->Enable (false);
+ } else {
+ VideoContentList video_sel = _parent->selected_video ();
+ FFmpegContentList ffmpeg_sel = _parent->selected_ffmpeg ();
+ bool const single = video_sel.size() == 1;
+
+ _frame_type->wrapped()->Enable (true);
+ _left_crop->wrapped()->Enable (true);
+ _right_crop->wrapped()->Enable (true);
+ _top_crop->wrapped()->Enable (true);
+ _bottom_crop->wrapped()->Enable (true);
+ _fade_in->Enable (!video_sel.empty ());
+ _fade_out->Enable (!video_sel.empty ());
+ _scale->wrapped()->Enable (true);
+ _description->Enable (true);
+ _filters->Enable (true);
+ _filters_button->Enable (single && !ffmpeg_sel.empty ());
+ _colour_conversion->Enable (single && !video_sel.empty ());
+ _edit_colour_conversion_button->Enable (true);
+ }
}
void
@@ -437,3 +488,19 @@ VideoPanel::fade_out_changed ()
i->set_fade_out (_fade_out->get (vfr).frames_round (vfr));
}
}
+
+void
+VideoPanel::reference_clicked ()
+{
+ ContentList c = _parent->selected ();
+ if (c.size() != 1) {
+ return;
+ }
+
+ shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent> (c.front ());
+ if (!d) {
+ return;
+ }
+
+ d->set_reference_video (_reference->GetValue ());
+}
diff --git a/src/wx/video_panel.h b/src/wx/video_panel.h
index b4b4c7766..1b59b4f10 100644
--- a/src/wx/video_panel.h
+++ b/src/wx/video_panel.h
@@ -45,6 +45,7 @@ public:
void content_selection_changed ();
private:
+ void reference_clicked ();
void edit_filters_clicked ();
void colour_conversion_changed ();
void edit_colour_conversion_clicked ();
@@ -52,7 +53,9 @@ private:
void fade_out_changed ();
void setup_description ();
+ void setup_sensitivity ();
+ wxCheckBox* _reference;
ContentChoice<VideoContent, VideoFrameType>* _frame_type;
ContentSpinCtrl<VideoContent>* _left_crop;
ContentSpinCtrl<VideoContent>* _right_crop;