doc.write_to_file_formatted (p.string (), "UTF-8");
}
-
void
DCP::read (bool require_mxfs)
{
- Files files;
+ read_assets ();
+ read_cpls (require_mxfs);
+}
+void
+DCP::read_assets ()
+{
shared_ptr<parse::AssetMap> asset_map;
try {
boost::filesystem::path p = _directory;
}
} catch (FileError& e) {
- boost::throw_exception (FileError ("could not load AssetMap file", files.asset_map));
+ boost::throw_exception (FileError ("could not load AssetMap file", _files.asset_map));
}
for (list<shared_ptr<libdcp::parse::AssetMapAsset> >::const_iterator i = asset_map->assets.begin(); i != asset_map->assets.end(); ++i) {
delete p;
if (root == "CompositionPlaylist") {
- files.cpls.push_back (t.string());
+ _files.cpls.push_back (t.string());
} else if (root == "PackingList") {
- if (files.pkl.empty ()) {
- files.pkl = t.string();
+ if (_files.pkl.empty ()) {
+ _files.pkl = t.string();
} else {
boost::throw_exception (DCPReadError ("duplicate PKLs found"));
}
}
}
- if (files.cpls.empty ()) {
+ if (_files.cpls.empty ()) {
boost::throw_exception (FileError ("no CPL files found", ""));
}
- if (files.pkl.empty ()) {
+ if (_files.pkl.empty ()) {
boost::throw_exception (FileError ("no PKL file found", ""));
}
shared_ptr<parse::PKL> pkl;
try {
- pkl.reset (new parse::PKL (files.pkl));
+ pkl.reset (new parse::PKL (_files.pkl));
} catch (FileError& e) {
- boost::throw_exception (FileError ("could not load PKL file", files.pkl));
+ boost::throw_exception (FileError ("could not load PKL file", _files.pkl));
}
- /* Cross-check */
- /* XXX */
-
_asset_maps.push_back (make_pair (boost::filesystem::absolute (_directory).string(), asset_map));
+}
- for (list<string>::iterator i = files.cpls.begin(); i != files.cpls.end(); ++i) {
+void
+DCP::read_cpls (bool require_mxfs)
+{
+ for (list<string>::iterator i = _files.cpls.begin(); i != _files.cpls.end(); ++i) {
_cpls.push_back (shared_ptr<CPL> (new CPL (_directory, *i, _asset_maps, require_mxfs)));
}
}
*/
DCP (std::string directory);
- /** Read an existing DCP's data.
+ void read (bool require_mxfs = true);
+
+ /** Read an existing DCP's assets.
*
* The DCP's XML metadata will be examined, and you can then look at the contents
* of the DCP.
- *
- * @param require_mxfs true to throw an exception if MXF files are missing; setting to false
- * can be useful for testing, but normally it should be set to true.
*/
- void read (bool require_mxfs = true);
+ void read_assets ();
+
+ void read_cpls (bool require_mxfs = true);
/** Write the required XML files to the directory that was
* passed into the constructor.
std::string asset_map;
};
+ Files _files;
+
/** the directory that we are writing to */
std::string _directory;
/** our CPLs */