diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-09-29 00:13:49 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-09-29 00:13:49 +0100 |
| commit | 92f024ea58c7279b8096e5e9f60f9cb2613e8a91 (patch) | |
| tree | 02c3b4a91effa6ca53ba511b60d6451c1b1f2009 /src | |
| parent | d6825b500b89430cb018d311c090d794ec18faf3 (diff) | |
swaroop: Disable play/stop/pause and slider during ad content.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/dcp_content.cc | 9 | ||||
| -rw-r--r-- | src/lib/dcp_content.h | 6 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.cc | 1 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.h | 5 | ||||
| -rw-r--r-- | src/lib/player_video.h | 8 | ||||
| -rw-r--r-- | src/wx/controls.cc | 35 | ||||
| -rw-r--r-- | src/wx/controls.h | 4 |
7 files changed, 65 insertions, 3 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 3498cc961..7301e5373 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -133,6 +133,11 @@ DCPContent::DCPContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, in } } _three_d = node->optional_bool_child("ThreeD").get_value_or (false); + + optional<string> ck = node->optional_string_child("ContentKind"); + if (ck) { + _content_kind = dcp::content_kind_from_string (*ck); + } _cpl = node->optional_string_child("CPL"); BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("ReelLength")) { _reel_lengths.push_back (raw_convert<int64_t> (i->content ())); @@ -209,6 +214,7 @@ DCPContent::examine (shared_ptr<Job> job) _kdm_valid = examiner->kdm_valid (); _standard = examiner->standard (); _three_d = examiner->three_d (); + _content_kind = examiner->content_kind (); _cpl = examiner->cpl (); _reel_lengths = examiner->reel_lengths (); } @@ -301,6 +307,9 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const } } node->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0"); + if (_content_kind) { + node->add_child("ContentKind")->add_child_text(dcp::content_kind_to_string(*_content_kind)); + } if (_cpl) { node->add_child("CPL")->add_child_text (_cpl.get ()); } diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index db617afa2..2a3ef46e8 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -138,6 +138,11 @@ public: return _three_d; } + boost::optional<dcp::ContentKind> content_kind () const { + boost::mutex::scoped_lock lm (_mutex); + return _content_kind; + } + bool kdm_timing_window_valid () const; private: @@ -176,6 +181,7 @@ private: bool _reference_text[TEXT_COUNT]; boost::optional<dcp::Standard> _standard; + boost::optional<dcp::ContentKind> _content_kind; bool _three_d; /** ID of the CPL to use; older metadata might not specify this: in that case * just use the only CPL. diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 1785669dd..dfb47f2eb 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -108,6 +108,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content) _cpl = cpl->id (); _name = cpl->content_title_text (); + _content_kind = cpl->content_kind (); BOOST_FOREACH (shared_ptr<dcp::Reel> i, cpl->reels()) { diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index 4b93bfa42..f54f02c36 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -99,6 +99,10 @@ public: return _three_d; } + dcp::ContentKind content_kind () const { + return _content_kind; + } + std::string cpl () const { return _cpl; } @@ -125,6 +129,7 @@ private: bool _kdm_valid; boost::optional<dcp::Standard> _standard; bool _three_d; + dcp::ContentKind _content_kind; std::string _cpl; std::list<int64_t> _reel_lengths; }; diff --git a/src/lib/player_video.h b/src/lib/player_video.h index cd904af06..11b2c8833 100644 --- a/src/lib/player_video.h +++ b/src/lib/player_video.h @@ -100,6 +100,10 @@ public: size_t memory_used () const; + boost::weak_ptr<Content> content () const { + return _content; + } + private: boost::shared_ptr<const ImageProxy> _in; Crop _crop; @@ -110,7 +114,9 @@ private: Part _part; boost::optional<ColourConversion> _colour_conversion; boost::optional<PositionImage> _text; - /** Content that we came from. This is so that reset_metadata() can work */ + /** Content that we came from. This is so that reset_metadata() can work, and also + * for variant:swaroop's non-skippable ads. + */ boost::weak_ptr<Content> _content; /** Video frame that we came from. Again, this is for reset_metadata() */ boost::optional<Frame> _video_frame; diff --git a/src/wx/controls.cc b/src/wx/controls.cc index a5cc1dcc4..0c9a27518 100644 --- a/src/wx/controls.cc +++ b/src/wx/controls.cc @@ -24,6 +24,8 @@ #include "playhead_to_timecode_dialog.h" #include "playhead_to_frame_dialog.h" #include "lib/job_manager.h" +#include "lib/player_video.h" +#include "lib/dcp_content.h" #include <dcp/dcp.h> #include <dcp/cpl.h> #include <dcp/reel.h> @@ -38,6 +40,7 @@ using std::make_pair; using boost::optional; using boost::shared_ptr; using boost::weak_ptr; +using boost::dynamic_pointer_cast; Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor_controls) : wxPanel (parent) @@ -170,6 +173,7 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor _viewer->Started.connect (boost::bind(&Controls::started, this)); _viewer->Stopped.connect (boost::bind(&Controls::stopped, this)); _viewer->FilmChanged.connect (boost::bind(&Controls::film_changed, this)); + _viewer->ImageChanged.connect (boost::bind(&Controls::image_changed, this, _1)); film_changed (); @@ -420,8 +424,9 @@ Controls::setup_sensitivity () _forward_button->Enable (c); #ifdef DCPOMATIC_VARIANT_SWAROOP _play_button->Enable (c && !_viewer->playing()); - _pause_button->Enable (c && _viewer->playing()); - _stop_button->Enable (c); + _pause_button->Enable (c && (!_current_kind || _current_kind != dcp::ADVERTISEMENT) && _viewer->playing()); + _stop_button->Enable (c && (!_current_kind || _current_kind != dcp::ADVERTISEMENT)); + _slider->Enable (c && (!_current_kind || _current_kind != dcp::ADVERTISEMENT)); #else _play_button->Enable (c); #endif @@ -610,3 +615,29 @@ Controls::log (wxString s) wxString ts = std_to_wx(string(buffer)) + N_(": "); _log->SetValue(_log->GetValue() + ts + s + "\n"); } + +void +Controls::image_changed (boost::weak_ptr<PlayerVideo> weak_pv) +{ +#ifdef DCPOMATIC_VARIANT_SWAROOP + shared_ptr<PlayerVideo> pv = weak_pv.lock (); + if (!pv) { + return; + } + + shared_ptr<Content> c = pv->content().lock(); + if (!c) { + return; + } + + shared_ptr<DCPContent> dc = dynamic_pointer_cast<DCPContent> (c); + if (!dc) { + return; + } + + if (!_current_kind || *_current_kind != dc->content_kind()) { + _current_kind = dc->content_kind (); + setup_sensitivity (); + } +#endif +} diff --git a/src/wx/controls.h b/src/wx/controls.h index a49f16595..ba7c46fcc 100644 --- a/src/wx/controls.h +++ b/src/wx/controls.h @@ -129,5 +129,9 @@ private: ClosedCaptionsDialog* _closed_captions_dialog; +#ifdef DCPOMATIC_VARIANT_SWAROOP + boost::optional<dcp::ContentKind> _current_kind; +#endif + boost::signals2::scoped_connection _config_changed_connection; }; |
