/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "signer.h"
#include "exceptions.h"
#include "compose.hpp"
+#include "raw_convert.h"
using std::string;
using std::stringstream;
subtitle.reset (new SubtitleAsset (asset.first, asset.second->chunks.front()->path));
subtitle->set_entry_point ((*i)->asset_list->main_subtitle->entry_point);
+ subtitle->set_edit_rate (_fps);
subtitle->set_duration ((*i)->asset_list->main_subtitle->duration);
}
_reels.push_back (reel);
}
+boost::filesystem::path
+CPL::filename () const
+{
+ return _directory / String::compose ("%1_cpl.xml", _id);
+}
+
void
CPL::write_xml (bool interop, XMLMetadata const & metadata, shared_ptr<const Signer> signer) const
{
- boost::filesystem::path p;
- p /= _directory;
- stringstream s;
- s << _id << "_cpl.xml";
- p /= s.str();
+ boost::filesystem::path p = filename ();
xmlpp::Document doc;
xmlpp::Element* root;
}
void
-CPL::write_to_pkl (xmlpp::Node* node) const
+CPL::write_to_pkl (xmlpp::Node* node, bool interop) const
{
xmlpp::Node* asset = node->add_child ("Asset");
asset->add_child("Id")->add_child_text ("urn:uuid:" + _id);
asset->add_child("Hash")->add_child_text (_digest);
- asset->add_child("Size")->add_child_text (lexical_cast<string> (_length));
- asset->add_child("Type")->add_child_text ("text/xml");
+ asset->add_child("Size")->add_child_text (raw_convert<string> (_length));
+ if (interop) {
+ asset->add_child("Type")->add_child_text ("text/xml;asdcpKind=CPL");
+ } else {
+ asset->add_child("Type")->add_child_text ("text/xml");
+ }
}
list<shared_ptr<const Asset> >
chunk->add_child("Path")->add_child_text (_id + "_cpl.xml");
chunk->add_child("VolumeIndex")->add_child_text ("1");
chunk->add_child("Offset")->add_child_text("0");
- chunk->add_child("Length")->add_child_text(lexical_cast<string> (_length));
+ chunk->add_child("Length")->add_child_text (raw_convert<string> (_length));
}