X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fcpl.cc;h=6fc52be536d4499ec372f56c806c7e63ee43eb30;hb=83358c16fcfdad24e8e415df13d6cf8e9bb43556;hp=dcb730ff91cc2287a09378c5b9b6bfdb2e8d59ff;hpb=bf59c288798851808359575662f202d390032aa7;p=libdcp.git diff --git a/src/cpl.cc b/src/cpl.cc index dcb730ff..6fc52be5 100644 --- a/src/cpl.cc +++ b/src/cpl.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2013 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington 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 @@ -31,6 +31,7 @@ #include "signer.h" #include "exceptions.h" #include "compose.hpp" +#include "raw_convert.h" using std::string; using std::stringstream; @@ -177,6 +178,7 @@ CPL::CPL (boost::filesystem::path directory, string file, list ass 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); } @@ -190,14 +192,16 @@ CPL::add_reel (shared_ptr reel) _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 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; @@ -243,13 +247,17 @@ CPL::write_xml (bool interop, XMLMetadata const & metadata, shared_ptradd_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 (_length)); - asset->add_child("Type")->add_child_text ("text/xml"); + asset->add_child("Size")->add_child_text (raw_convert (_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 > @@ -281,7 +289,7 @@ CPL::write_to_assetmap (xmlpp::Node* node) const 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 (_length)); + chunk->add_child("Length")->add_child_text (raw_convert (_length)); }