}
}
_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 ()));
_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 ();
}
}
}
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 ());
}
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:
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.
_cpl = cpl->id ();
_name = cpl->content_title_text ();
+ _content_kind = cpl->content_kind ();
BOOST_FOREACH (shared_ptr<dcp::Reel> i, cpl->reels()) {
return _three_d;
}
+ dcp::ContentKind content_kind () const {
+ return _content_kind;
+ }
+
std::string cpl () const {
return _cpl;
}
bool _kdm_valid;
boost::optional<dcp::Standard> _standard;
bool _three_d;
+ dcp::ContentKind _content_kind;
std::string _cpl;
std::list<int64_t> _reel_lengths;
};
size_t memory_used () const;
+ boost::weak_ptr<Content> content () const {
+ return _content;
+ }
+
private:
boost::shared_ptr<const ImageProxy> _in;
Crop _crop;
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;
#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>
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)
_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 ();
_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
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
+}
ClosedCaptionsDialog* _closed_captions_dialog;
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+ boost::optional<dcp::ContentKind> _current_kind;
+#endif
+
boost::signals2::scoped_connection _config_changed_connection;
};