diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-01-06 14:22:33 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-01-06 14:22:33 +0000 |
| commit | f9819a16d40403af3da08263ee6bb3b5a99d650f (patch) | |
| tree | b59fdf315a46309f6d6ef324388b0f4530cff7e0 /src/lib | |
| parent | 3a51cc23de37ff0821009af780ef56e0e28394f7 (diff) | |
Give a warning on make DCP if it seems unlikely that the disk will have enough space to store the finished DCP (#92).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 25 | ||||
| -rw-r--r-- | src/lib/film.h | 3 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 1bf35cc5f..edd47c6d0 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -974,3 +974,28 @@ Film::make_kdms ( return kdms; } + +/** @return The approximate disk space required to encode a DCP of this film with the + * current settings, in bytes. + */ +uint64_t +Film::required_disk_space () const +{ + return uint64_t (j2k_bandwidth() / 8) * length() / TIME_HZ; +} + +/** This method checks the disk that the Film is on and tries to decide whether or not + * there will be enough space to make a DCP for it. If so, true is returned; if not, + * false is returned and required and availabe are filled in with the amount of disk space + * required and available respectively (in Gb). + * + * Note: the decision made by this method isn't, of course, 100% reliable. + */ +bool +Film::should_be_enough_disk_space (double& required, double& available) const +{ + boost::filesystem::space_info s = boost::filesystem::space (internal_video_mxf_dir ()); + required = double (required_disk_space ()) / 1073741824.0f; + available = double (s.available) / 1073741824.0f; + return (available - required) > 1; +} diff --git a/src/lib/film.h b/src/lib/film.h index e318f7724..0a747193e 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -108,6 +108,9 @@ public: Time video_frames_to_time (OutputVideoFrame) const; Time audio_frames_to_time (OutputAudioFrame) const; + uint64_t required_disk_space () const; + bool should_be_enough_disk_space (double &, double &) const; + /* Proxies for some Playlist methods */ ContentList content () const; |
