}
-EncodedData::EncodedData (string file)
+EncodedData::EncodedData (boost::filesystem::path file)
{
_size = boost::filesystem::file_size (file);
_data = new uint8_t[_size];
void
EncodedData::write (shared_ptr<const Film> film, int frame, Eyes eyes) const
{
- string const tmp_j2c = film->j2c_path (frame, eyes, true);
+ boost::filesystem::path const tmp_j2c = film->j2c_path (frame, eyes, true);
FILE* f = fopen (tmp_j2c.c_str (), N_("wb"));
fwrite (_data, 1, _size, f);
fclose (f);
- string const real_j2c = film->j2c_path (frame, eyes, false);
+ boost::filesystem::path const real_j2c = film->j2c_path (frame, eyes, false);
/* Rename the file from foo.j2c.tmp to foo.j2c now that it is complete */
boost::filesystem::rename (tmp_j2c, real_j2c);
void
EncodedData::write_info (shared_ptr<const Film> film, int frame, Eyes eyes, libdcp::FrameInfo fin) const
{
- string const info = film->info_path (frame, eyes);
+ boost::filesystem::path const info = film->info_path (frame, eyes);
ofstream h (info.c_str());
fin.write (h);
}
/** @param s Size of data, in bytes */
EncodedData (int s);
- EncodedData (std::string f);
+ EncodedData (boost::filesystem::path);
virtual ~EncodedData ();
}
/** @return The path to the directory to write video frame info files to */
-string
+boost::filesystem::path
Film::info_dir () const
{
boost::filesystem::path p;
p /= "info";
p /= video_identifier ();
- return dir (p.string());
+ return dir (p);
}
-string
+boost::filesystem::path
Film::internal_video_mxf_dir () const
{
return dir ("video");
}
-string
+boost::filesystem::path
Film::internal_video_mxf_filename () const
{
return video_identifier() + ".mxf";
}
-string
+boost::filesystem::path
Film::video_mxf_filename () const
{
return filename_safe_name() + "_video.mxf";
}
-string
+boost::filesystem::path
Film::audio_mxf_filename () const
{
return filename_safe_name() + "_audio.mxf";
root->add_child("Key")->add_child_text (_key.hex ());
_playlist->as_xml (root->add_child ("Playlist"));
- doc.write_to_file_formatted (file ("metadata.xml"));
+ doc.write_to_file_formatted (file("metadata.xml").string ());
_dirty = false;
}
/** Given a directory name, return its full path within the Film's directory.
* The directory (and its parents) will be created if they do not exist.
*/
-string
-Film::dir (string d) const
+boost::filesystem::path
+Film::dir (boost::filesystem::path d) const
{
boost::filesystem::path p;
p /= _directory;
boost::filesystem::create_directories (p);
- return p.string ();
+ return p;
}
/** Given a file or directory name, return its full path within the Film's directory.
* Any required parent directories will be created.
*/
-string
-Film::file (string f) const
+boost::filesystem::path
+Film::file (boost::filesystem::path f) const
{
boost::filesystem::path p;
p /= _directory;
boost::filesystem::create_directories (p.parent_path ());
- return p.string ();
+ return p;
}
/** @return a DCI-compliant name for a DCP of this film */
_dci_date = boost::gregorian::day_clock::local_day ();
}
-string
+boost::filesystem::path
Film::info_path (int f, Eyes e) const
{
boost::filesystem::path p;
/* info_dir() will already have added any initial bit of the path,
so don't call file() on this.
*/
- return p.string ();
+ return p;
}
-string
+boost::filesystem::path
Film::j2c_path (int f, Eyes e, bool t) const
{
boost::filesystem::path p;
}
p /= s.str();
- return file (p.string ());
+ return file (p);
}
/** @return List of subdirectories (not full paths) containing DCPs that can be successfully libdcp::DCP::read() */
public:
Film (boost::filesystem::path);
- std::string info_dir () const;
- std::string j2c_path (int, Eyes, bool) const;
- std::string info_path (int, Eyes) const;
- std::string internal_video_mxf_dir () const;
- std::string internal_video_mxf_filename () const;
+ boost::filesystem::path info_dir () const;
+ boost::filesystem::path j2c_path (int, Eyes, bool) const;
+ boost::filesystem::path info_path (int, Eyes) const;
+ boost::filesystem::path internal_video_mxf_dir () const;
+ boost::filesystem::path internal_video_mxf_filename () const;
boost::filesystem::path audio_analysis_path (boost::shared_ptr<const AudioContent>) const;
- std::string video_mxf_filename () const;
- std::string audio_mxf_filename () const;
+ boost::filesystem::path video_mxf_filename () const;
+ boost::filesystem::path audio_mxf_filename () const;
void send_dcp_to_tms ();
void make_dcp ();
int encoded_frames () const;
- std::string file (std::string f) const;
- std::string dir (std::string d) const;
+ boost::filesystem::path file (boost::filesystem::path f) const;
+ boost::filesystem::path dir (boost::filesystem::path d) const;
void read_metadata ();
void write_metadata () const;
}
/** @param file Filename to write log to */
-FileLog::FileLog (string file)
+FileLog::FileLog (boost::filesystem::path file)
: _file (file)
{
#include <string>
#include <boost/thread/mutex.hpp>
+#include <boost/filesystem.hpp>
/** @class Log
* @brief A very simple logging class.
class FileLog : public Log
{
public:
- FileLog (std::string file);
+ FileLog (boost::filesystem::path file);
private:
void do_log (std::string m);
/** filename to write to */
- std::string _file;
+ boost::filesystem::path _file;
};
#endif
throw NetworkError (String::compose (_("Could not create remote directory %1 (%2)"), _film->dcp_name(), ssh_get_error (ss.session)));
}
- string const dcp_dir = _film->dir (_film->dcp_name());
+ boost::filesystem::path const dcp_dir = _film->dir (_film->dcp_name());
boost::uintmax_t bytes_to_transfer = 0;
for (boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (dcp_dir); i != boost::filesystem::directory_iterator(); ++i) {