#include <boost/algorithm/string.hpp>
-using std::string;
+using std::cout;
+using std::dynamic_pointer_cast;
using std::list;
-using std::pair;
using std::make_pair;
-using std::cout;
+using std::make_shared;
+using std::pair;
using std::set;
-using std::vector;
using std::shared_ptr;
+using std::string;
+using std::vector;
using boost::optional;
-using std::dynamic_pointer_cast;
using namespace dcp;
_ratings.push_back (Rating(i));
}
}
- _reels = type_grand_children<Reel> (f, "ReelList", "Reel");
+
+ for (auto i: f.node_child("ReelList")->node_children("Reel")) {
+ _reels.push_back (make_shared<Reel>(i, *_standard));
+ }
auto reel_list = f.node_child ("ReelList");
if (reel_list) {
/* If the first language on SubtitleLanguageList is the same as the language of the first subtitle we'll ignore it */
size_t first = 0;
if (!_reels.empty()) {
- shared_ptr<dcp::ReelSubtitleAsset> sub = _reels.front()->main_subtitle();
+ auto sub = _reels.front()->main_subtitle();
if (sub) {
- optional<string> lang = sub->language();
+ auto lang = sub->language();
if (lang && lang == sll_split[0]) {
first = 1;
}
return c;
}
+
vector<shared_ptr<const ReelFileAsset>>
CPL::reel_file_assets () const
{
}
+template <class T>
+void
+add_encryptable_assets (vector<shared_ptr<T>>& assets, vector<shared_ptr<Reel>> reels)
+{
+ for (auto i: reels) {
+ if (i->main_picture ()) {
+ assets.push_back (i->main_picture());
+ }
+ if (i->main_sound ()) {
+ assets.push_back (i->main_sound());
+ }
+ if (i->main_subtitle ()) {
+ if (auto enc = dynamic_pointer_cast<ReelEncryptableAsset>(i->main_subtitle())) {
+ assets.push_back (enc);
+ }
+ }
+ for (auto j: i->closed_captions()) {
+ assets.push_back (j);
+ }
+ if (i->atmos ()) {
+ assets.push_back (i->atmos());
+ }
+ }
+}
+
+
+vector<shared_ptr<ReelEncryptableAsset>>
+CPL::reel_encryptable_assets ()
+{
+ vector<shared_ptr<ReelEncryptableAsset>> c;
+ add_encryptable_assets (c, _reels);
+ return c;
+}
+
+
+vector<shared_ptr<const ReelEncryptableAsset>>
+CPL::reel_encryptable_assets () const
+{
+ vector<shared_ptr<const ReelEncryptableAsset>> c;
+ add_encryptable_assets (c, _reels);
+ return c;
+}
+
+
bool
CPL::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
{