summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/asset.cc30
-rw-r--r--src/asset.h13
-rw-r--r--src/dcp.cc22
-rw-r--r--src/picture_asset.cc26
-rw-r--r--src/picture_asset.h14
-rw-r--r--src/sound_asset.cc24
-rw-r--r--src/sound_asset.h15
7 files changed, 72 insertions, 72 deletions
diff --git a/src/asset.cc b/src/asset.cc
index 59d106b5..740dc592 100644
--- a/src/asset.cc
+++ b/src/asset.cc
@@ -33,8 +33,9 @@ using namespace std;
using namespace boost;
using namespace libdcp;
-Asset::Asset (string mxf_path, sigc::signal1<void, float>* progress, int fps, int length)
- : _mxf_path (mxf_path)
+Asset::Asset (string directory, string mxf_name, sigc::signal1<void, float>* progress, int fps, int length)
+ : _directory (directory)
+ , _mxf_name (mxf_name)
, _progress (progress)
, _fps (fps)
, _length (length)
@@ -48,13 +49,9 @@ Asset::write_to_pkl (ostream& s) const
{
s << " <Asset>\n"
<< " <Id>urn:uuid:" << _uuid << "</Id>\n"
-#if BOOST_FILESYSTEM_VERSION == 3
- << " <AnnotationText>" << filesystem::path(_mxf_path).filename().string() << "</AnnotationText>\n"
-#else
- << " <AnnotationText>" << filesystem::path(_mxf_path).filename() << "</AnnotationText>\n"
-#endif
+ << " <AnnotationText>" << _mxf_name << "</AnnotationText>\n"
<< " <Hash>" << _digest << "</Hash>\n"
- << " <Size>" << filesystem::file_size(_mxf_path) << "</Size>\n"
+ << " <Size>" << filesystem::file_size(mxf_path()) << "</Size>\n"
<< " <Type>application/mxf</Type>\n"
<< " </Asset>\n";
}
@@ -66,14 +63,10 @@ Asset::write_to_assetmap (ostream& s) const
<< " <Id>urn:uuid:" << _uuid << "</Id>\n"
<< " <ChunkList>\n"
<< " <Chunk>\n"
-#if BOOST_FILESYSTEM_VERSION == 3
- << " <Path>" << filesystem::path(_mxf_path).filename().string() << "</Path>\n"
-#else
- << " <Path>" << filesystem::path(_mxf_path).filename() << "</Path>\n"
-#endif
+ << " <Path>" << _mxf_name << "</Path>\n"
<< " <VolumeIndex>1</VolumeIndex>\n"
<< " <Offset>0</Offset>\n"
- << " <Length>" << filesystem::file_size(_mxf_path) << "</Length>\n"
+ << " <Length>" << filesystem::file_size(mxf_path()) << "</Length>\n"
<< " </Chunk>\n"
<< " </ChunkList>\n"
<< " </Asset>\n";
@@ -91,3 +84,12 @@ Asset::fill_writer_info (ASDCP::WriterInfo* writer_info) const
Kumu::hex2bin (_uuid.c_str(), writer_info->AssetUUID, Kumu::UUID_Length, &c);
assert (c == Kumu::UUID_Length);
}
+
+filesystem::path
+Asset::mxf_path () const
+{
+ filesystem::path p;
+ p /= _directory;
+ p /= _mxf_name;
+ return p;
+}
diff --git a/src/asset.h b/src/asset.h
index b0cc450c..62b7b4ac 100644
--- a/src/asset.h
+++ b/src/asset.h
@@ -42,12 +42,13 @@ class Asset
{
public:
/** Construct an Asset.
- * @param mxf_path Pathname of MXF file.
+ * @param directory Directory where MXF file is.
+ * @param mxf_name Name of MXF file.
* @param progress Signal to inform of progress.
* @param fps Frames per second.
* @param length Length in frames.
*/
- Asset (std::string mxf_path, sigc::signal1<void, float>* progress, int fps, int length);
+ Asset (std::string directory, std::string mxf_path, sigc::signal1<void, float>* progress, int fps, int length);
/** Write details of the asset to a CPL stream.
* @param s Stream.
@@ -70,8 +71,12 @@ protected:
*/
void fill_writer_info (ASDCP::WriterInfo* w) const;
- /** Path to our MXF file */
- std::string _mxf_path;
+ boost::filesystem::path mxf_path () const;
+
+ /** Directory that our MXF file is in */
+ std::string _directory;
+ /** Name of our MXF file */
+ std::string _mxf_name;
/** Signal to emit to report progress */
sigc::signal1<void, float>* _progress;
/** Frames per second */
diff --git a/src/dcp.cc b/src/dcp.cc
index 4b0e9087..8f7a73bc 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -54,37 +54,25 @@ DCP::DCP (string directory, string name, ContentKind content_kind, int fps, int
void
DCP::add_sound_asset (vector<string> const & files)
{
- filesystem::path p;
- p /= _directory;
- p /= "audio.mxf";
- _assets.push_back (shared_ptr<SoundAsset> (new SoundAsset (files, p.string(), &Progress, _fps, _length)));
+ _assets.push_back (shared_ptr<SoundAsset> (new SoundAsset (files, _directory, "audio.mxf", &Progress, _fps, _length)));
}
void
DCP::add_sound_asset (sigc::slot<string, Channel> get_path, int channels)
{
- filesystem::path p;
- p /= _directory;
- p /= "audio.mxf";
- _assets.push_back (shared_ptr<SoundAsset> (new SoundAsset (get_path, p.string(), &Progress, _fps, _length, channels)));
+ _assets.push_back (shared_ptr<SoundAsset> (new SoundAsset (get_path, _directory, "audio.mxf", &Progress, _fps, _length, channels)));
}
void
DCP::add_picture_asset (vector<string> const & files, int width, int height)
{
- filesystem::path p;
- p /= _directory;
- p /= "video.mxf";
- _assets.push_back (shared_ptr<PictureAsset> (new PictureAsset (files, p.string(), &Progress, _fps, _length, width, height)));
+ _assets.push_back (shared_ptr<PictureAsset> (new PictureAsset (files, _directory, "video.mxf", &Progress, _fps, _length, width, height)));
}
void
DCP::add_picture_asset (sigc::slot<string, int> get_path, int width, int height)
{
- filesystem::path p;
- p /= _directory;
- p /= "video.mxf";
- _assets.push_back (shared_ptr<PictureAsset> (new PictureAsset (get_path, p.string(), &Progress, _fps, _length, width, height)));
+ _assets.push_back (shared_ptr<PictureAsset> (new PictureAsset (get_path, _directory, "video.mxf", &Progress, _fps, _length, width, height)));
}
void
@@ -295,6 +283,7 @@ DCP::DCP (string directory)
_assets.push_back (shared_ptr<PictureAsset> (
new PictureAsset (
+ _directory,
cpl_assets->main_picture->annotation_text,
_fps,
_length,
@@ -306,6 +295,7 @@ DCP::DCP (string directory)
if (cpl_assets->main_sound) {
_assets.push_back (shared_ptr<SoundAsset> (
new SoundAsset (
+ _directory,
cpl_assets->main_picture->annotation_text,
_fps,
_length
diff --git a/src/picture_asset.cc b/src/picture_asset.cc
index 2f8a622a..db3f02c3 100644
--- a/src/picture_asset.cc
+++ b/src/picture_asset.cc
@@ -38,13 +38,14 @@ using namespace libdcp;
PictureAsset::PictureAsset (
sigc::slot<string, int> get_path,
- string mxf_path,
+ string directory,
+ string mxf_name,
sigc::signal1<void, float>* progress,
int fps,
int length,
int width,
int height)
- : Asset (mxf_path, progress, fps, length)
+ : Asset (directory, mxf_name, progress, fps, length)
, _width (width)
, _height (height)
{
@@ -53,21 +54,22 @@ PictureAsset::PictureAsset (
PictureAsset::PictureAsset (
vector<string> const & files,
- string mxf_path,
+ string directory,
+ string mxf_name,
sigc::signal1<void, float>* progress,
int fps,
int length,
int width,
int height)
- : Asset (mxf_path, progress, fps, length)
+ : Asset (directory, mxf_name, progress, fps, length)
, _width (width)
, _height (height)
{
construct (sigc::bind (sigc::mem_fun (*this, &PictureAsset::path_from_list), files));
}
-PictureAsset::PictureAsset (string mxf_path, int fps, int length, int width, int height)
- : Asset (mxf_path, 0, fps, length)
+PictureAsset::PictureAsset (string directory, string mxf_name, int fps, int length, int width, int height)
+ : Asset (directory, mxf_name, 0, fps, length)
, _width (width)
, _height (height)
{
@@ -97,8 +99,8 @@ PictureAsset::construct (sigc::slot<string, int> get_path)
fill_writer_info (&writer_info);
ASDCP::JP2K::MXFWriter mxf_writer;
- if (ASDCP_FAILURE (mxf_writer.OpenWrite (_mxf_path.c_str(), writer_info, picture_desc))) {
- throw FileError ("could not open MXF file for writing", _mxf_path);
+ if (ASDCP_FAILURE (mxf_writer.OpenWrite (mxf_path().c_str(), writer_info, picture_desc))) {
+ throw FileError ("could not open MXF file for writing", mxf_path().string());
}
for (int i = 0; i < _length; ++i) {
@@ -121,7 +123,7 @@ PictureAsset::construct (sigc::slot<string, int> get_path)
throw MiscError ("error in finalising video MXF");
}
- _digest = make_digest (_mxf_path, _progress);
+ _digest = make_digest (mxf_path().string(), _progress);
}
void
@@ -129,11 +131,7 @@ PictureAsset::write_to_cpl (ostream& s) const
{
s << " <MainPicture>\n"
<< " <Id>urn:uuid:" << _uuid << "</Id>\n"
-#if BOOST_FILESYSTEM_VERSION == 3
- << " <AnnotationText>" << filesystem::path(_mxf_path).filename().string() << "</AnnotationText>\n"
-#else
- << " <AnnotationText>" << filesystem::path(_mxf_path).filename() << "</AnnotationText>\n"
-#endif
+ << " <AnnotationText>" << _mxf_name << "</AnnotationText>\n"
<< " <EditRate>" << _fps << " 1</EditRate>\n"
<< " <IntrinsicDuration>" << _length << "</IntrinsicDuration>\n"
<< " <EntryPoint>0</EntryPoint>\n"
diff --git a/src/picture_asset.h b/src/picture_asset.h
index e540c074..9fa4f99e 100644
--- a/src/picture_asset.h
+++ b/src/picture_asset.h
@@ -33,7 +33,8 @@ public:
/** Construct a PictureAsset, generating the MXF from the JPEG2000 files.
* This may take some time; progress is indicated by emission of the Progress signal.
* @param files Pathnames of JPEG2000 files, in frame order.
- * @param mxf_path Pathname of MXF file to create.
+ * @param directory Directory in which to create MXF file.
+ * @param mxf_name Name of MXF file to create.
* @param progress Signal to inform of progress.
* @param fps Frames per second.
* @param length Length in frames.
@@ -42,7 +43,8 @@ public:
*/
PictureAsset (
std::vector<std::string> const & files,
- std::string mxf_path,
+ std::string directory,
+ std::string mxf_name,
sigc::signal1<void, float>* progress,
int fps,
int length,
@@ -53,7 +55,8 @@ public:
/** Construct a PictureAsset, generating the MXF from the JPEG2000 files.
* This may take some time; progress is indicated by emission of the Progress signal.
* @param get_path Functor which returns a JPEG2000 file path for a given frame (frames counted from 0).
- * @param mxf_path Pathname of MXF file to create.
+ * @param directory Directory in which to create MXF file.
+ * @param mxf_name Name of MXF file to create.
* @param progress Signal to inform of progress.
* @param fps Frames per second.
* @param length Length in frames.
@@ -62,7 +65,8 @@ public:
*/
PictureAsset (
sigc::slot<std::string, int> get_path,
- std::string mxf_path,
+ std::string directory,
+ std::string mxf_name,
sigc::signal1<void, float>* progress,
int fps,
int length,
@@ -70,7 +74,7 @@ public:
int height
);
- PictureAsset (std::string mxf_path, int fps, int length, int width, int height);
+ PictureAsset (std::string directory, std::string mxf_name, int fps, int length, int width, int height);
/** Write details of this asset to a CPL stream.
* @param s Stream.
diff --git a/src/sound_asset.cc b/src/sound_asset.cc
index a0d17f29..e22357fd 100644
--- a/src/sound_asset.cc
+++ b/src/sound_asset.cc
@@ -34,25 +34,25 @@ using namespace boost;
using namespace libdcp;
SoundAsset::SoundAsset (
- vector<string> const & files, string mxf_path, sigc::signal1<void, float>* progress, int fps, int length
+ vector<string> const & files, string directory, string mxf_name, sigc::signal1<void, float>* progress, int fps, int length
)
- : Asset (mxf_path, progress, fps, length)
+ : Asset (directory, mxf_name, progress, fps, length)
, _channels (files.size ())
{
construct (sigc::bind (sigc::mem_fun (*this, &SoundAsset::path_from_channel), files));
}
SoundAsset::SoundAsset (
- sigc::slot<string, Channel> get_path, string mxf_path, sigc::signal1<void, float>* progress, int fps, int length, int channels
+ sigc::slot<string, Channel> get_path, string directory, string mxf_name, sigc::signal1<void, float>* progress, int fps, int length, int channels
)
- : Asset (mxf_path, progress, fps, length)
+ : Asset (directory, mxf_name, progress, fps, length)
, _channels (channels)
{
construct (get_path);
}
-SoundAsset::SoundAsset (string mxf_path, int fps, int length)
- : Asset (mxf_path, 0, fps, length)
+SoundAsset::SoundAsset (string directory, string mxf_name, int fps, int length)
+ : Asset (directory, mxf_name, 0, fps, length)
, _channels (0)
{
@@ -118,8 +118,8 @@ SoundAsset::construct (sigc::slot<string, Channel> get_path)
fill_writer_info (&writer_info);
ASDCP::PCM::MXFWriter mxf_writer;
- if (ASDCP_FAILURE (mxf_writer.OpenWrite (_mxf_path.c_str(), writer_info, audio_desc))) {
- throw FileError ("could not open audio MXF for writing", _mxf_path);
+ if (ASDCP_FAILURE (mxf_writer.OpenWrite (mxf_path().c_str(), writer_info, audio_desc))) {
+ throw FileError ("could not open audio MXF for writing", mxf_path().string());
}
for (int i = 0; i < _length; ++i) {
@@ -160,7 +160,7 @@ SoundAsset::construct (sigc::slot<string, Channel> get_path)
throw MiscError ("could not finalise audio MXF");
}
- _digest = make_digest (_mxf_path, _progress);
+ _digest = make_digest (mxf_path().string(), _progress);
}
void
@@ -168,11 +168,7 @@ SoundAsset::write_to_cpl (ostream& s) const
{
s << " <MainSound>\n"
<< " <Id>urn:uuid:" << _uuid << "</Id>\n"
-#if BOOST_FILESYSTEM_VERSION == 3
- << " <AnnotationText>" << filesystem::path(_mxf_path).filename().string() << "</AnnotationText>\n"
-#else
- << " <AnnotationText>" << filesystem::path(_mxf_path).filename() << "</AnnotationText>\n"
-#endif
+ << " <AnnotationText>" << _mxf_name << "</AnnotationText>\n"
<< " <EditRate>" << _fps << " 1</EditRate>\n"
<< " <IntrinsicDuration>" << _length << "</IntrinsicDuration>\n"
<< " <EntryPoint>0</EntryPoint>\n"
diff --git a/src/sound_asset.h b/src/sound_asset.h
index 914823a2..4fbec895 100644
--- a/src/sound_asset.h
+++ b/src/sound_asset.h
@@ -37,14 +37,16 @@ public:
/** Construct a SoundAsset, generating the MXF from the WAV files.
* This may take some time; progress is indicated by emission of the Progress signal.
* @param files Pathnames of sound files, in the order Left, Right, Centre, Lfe (sub), Left surround, Right surround.
- * @param mxf_path Pathname of MXF file to create.
+ * @param directory Directory in which to create MXF file.
+ * @param mxf_name Name of MXF file to create.
* @param progress Signal to inform of progress.
* @param fps Frames per second.
* @param length Length in frames.
*/
SoundAsset (
std::vector<std::string> const & files,
- std::string mxf_path,
+ std::string directory,
+ std::string mxf_name,
sigc::signal1<void, float>* progress,
int fps,
int length
@@ -53,7 +55,8 @@ public:
/** Construct a SoundAsset, generating the MXF from the WAV files.
* This may take some time; progress is indicated by emission of the Progress signal.
* @param get_path Functor which returns a WAV file path for a given channel.
- * @param mxf_path Pathname of MXF file to create.
+ * @param directory Directory in which to create MXF file.
+ * @param mxf_name Name of MXF file to create.
* @param progress Signal to inform of progress.
* @param fps Frames per second.
* @param length Length in frames.
@@ -61,7 +64,8 @@ public:
*/
SoundAsset (
sigc::slot<std::string, Channel> get_path,
- std::string mxf_path,
+ std::string directory,
+ std::string mxf_name,
sigc::signal1<void, float>* progress,
int fps,
int length,
@@ -69,7 +73,8 @@ public:
);
SoundAsset (
- std::string mxf_path,
+ std::string directory,
+ std::string mxf_name,
int fps,
int length
);