summaryrefslogtreecommitdiff
path: root/src/lib/film.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-04-05 21:57:03 +0200
committerCarl Hetherington <cth@carlh.net>2024-04-21 23:18:23 +0200
commitc98d6fd22da1586ef3c1d64a2f7b1ee602f539e9 (patch)
tree5b35a6c950b5e77befca22564ed93a5920089cab /src/lib/film.cc
parent55f1927db0565c74ff7c121645ec397c07f63d51 (diff)
Rename j2k_bandwidth -> video_bit_rate.
Diffstat (limited to 'src/lib/film.cc')
-rw-r--r--src/lib/film.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index fd703a72a..3de536a6d 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -163,7 +163,7 @@ Film::Film (optional<boost::filesystem::path> dir)
, _resolution (Resolution::TWO_K)
, _encrypted (false)
, _context_id (dcp::make_uuid ())
- , _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ())
+ , _video_bit_rate(Config::instance()->default_video_bit_rate())
, _video_frame_rate (24)
, _audio_channels (Config::instance()->default_dcp_audio_channels ())
, _three_d (false)
@@ -240,7 +240,7 @@ Film::video_identifier () const
+ "_" + resolution_to_string (_resolution)
+ "_" + _playlist->video_identifier()
+ "_" + raw_convert<string>(_video_frame_rate)
- + "_" + raw_convert<string>(j2k_bandwidth());
+ + "_" + raw_convert<string>(video_bit_rate());
if (encrypted ()) {
/* This is insecure but hey, the key is in plaintext in metadata.xml */
@@ -397,7 +397,7 @@ Film::metadata (bool with_content_paths) const
}
cxml::add_text_child(root, "Resolution", resolution_to_string(_resolution));
- cxml::add_text_child(root, "J2KBandwidth", raw_convert<string>(_j2k_bandwidth));
+ cxml::add_text_child(root, "VideoBitRate", raw_convert<string>(_video_bit_rate));
cxml::add_text_child(root, "VideoFrameRate", raw_convert<string>(_video_frame_rate));
cxml::add_text_child(root, "AudioFrameRate", raw_convert<string>(_audio_frame_rate));
cxml::add_text_child(root, "ISDCFDate", boost::gregorian::to_iso_string(_isdcf_date));
@@ -569,7 +569,11 @@ Film::read_metadata (optional<boost::filesystem::path> path)
}
_resolution = string_to_resolution (f.string_child ("Resolution"));
- _j2k_bandwidth = f.number_child<int> ("J2KBandwidth");
+ if (auto j2k = f.optional_number_child<int>("J2KBandwidth")) {
+ _video_bit_rate = *j2k;
+ } else {
+ _video_bit_rate = f.number_child<int64_t>("VideoBitRate");
+ }
_video_frame_rate = f.number_child<int> ("VideoFrameRate");
_audio_frame_rate = f.optional_number_child<int>("AudioFrameRate").get_value_or(48000);
_encrypted = f.bool_child ("Encrypted");
@@ -1169,10 +1173,10 @@ Film::set_resolution (Resolution r, bool explicit_user)
void
-Film::set_j2k_bandwidth (int b)
+Film::set_video_bit_rate(int64_t bit_rate)
{
- FilmChangeSignaller ch(this, FilmProperty::J2K_BANDWIDTH);
- _j2k_bandwidth = b;
+ FilmChangeSignaller ch(this, FilmProperty::VIDEO_BIT_RATE);
+ _video_bit_rate = bit_rate;
}
/** @param f New frame rate.
@@ -1765,7 +1769,7 @@ Film::make_kdm(boost::filesystem::path cpl_file, dcp::LocalTime from, dcp::Local
uint64_t
Film::required_disk_space () const
{
- return _playlist->required_disk_space (shared_from_this(), j2k_bandwidth(), audio_channels(), audio_frame_rate());
+ return _playlist->required_disk_space (shared_from_this(), video_bit_rate(), audio_channels(), audio_frame_rate());
}
/** This method checks the disk that the Film is on and tries to decide whether or not
@@ -1897,7 +1901,7 @@ Film::reels () const
/* Integer-divide reel length by the size of one frame to give the number of frames per reel,
* making sure we don't go less than 1s long.
*/
- Frame const reel_in_frames = max(_reel_length / ((j2k_bandwidth() / video_frame_rate()) / 8), static_cast<Frame>(video_frame_rate()));
+ Frame const reel_in_frames = max(_reel_length / ((video_bit_rate() / video_frame_rate()) / 8), static_cast<Frame>(video_frame_rate()));
while (current < len) {
DCPTime end = min (len, current + DCPTime::from_frames (reel_in_frames, video_frame_rate ()));
periods.emplace_back(current, end);
@@ -1941,7 +1945,7 @@ Film::use_template (string name)
_dcp_content_type = _template_film->_dcp_content_type;
_container = _template_film->_container;
_resolution = _template_film->_resolution;
- _j2k_bandwidth = _template_film->_j2k_bandwidth;
+ _video_bit_rate = _template_film->_video_bit_rate;
_video_frame_rate = _template_film->_video_frame_rate;
_encrypted = _template_film->_encrypted;
_audio_channels = _template_film->_audio_channels;