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)
{
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";
}
<< " <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";
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;
+}
{
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.
*/
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 */
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
_assets.push_back (shared_ptr<PictureAsset> (
new PictureAsset (
+ _directory,
cpl_assets->main_picture->annotation_text,
_fps,
_length,
if (cpl_assets->main_sound) {
_assets.push_back (shared_ptr<SoundAsset> (
new SoundAsset (
+ _directory,
cpl_assets->main_picture->annotation_text,
_fps,
_length
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)
{
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)
{
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) {
throw MiscError ("error in finalising video MXF");
}
- _digest = make_digest (_mxf_path, _progress);
+ _digest = make_digest (mxf_path().string(), _progress);
}
void
{
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"
/** 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.
*/
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,
/** 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.
*/
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,
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.
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)
{
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) {
throw MiscError ("could not finalise audio MXF");
}
- _digest = make_digest (_mxf_path, _progress);
+ _digest = make_digest (mxf_path().string(), _progress);
}
void
{
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"
/** 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
/** 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.
*/
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,
);
SoundAsset (
- std::string mxf_path,
+ std::string directory,
+ std::string mxf_name,
int fps,
int length
);