+
+void
+Film::set_marker (dcp::Marker type, DCPTime time)
+{
+ ChangeSignaller<Film> ch (this, MARKERS);
+ _markers[type] = time;
+}
+
+void
+Film::unset_marker (dcp::Marker type)
+{
+ ChangeSignaller<Film> ch (this, MARKERS);
+ _markers.erase (type);
+}
+
+
+void
+Film::clear_markers ()
+{
+ ChangeSignaller<Film> ch (this, MARKERS);
+ _markers.clear ();
+}
+
+
+void
+Film::set_ratings (vector<dcp::Rating> r)
+{
+ ChangeSignaller<Film> ch (this, RATINGS);
+ _ratings = r;
+}
+
+void
+Film::set_content_versions (vector<string> v)
+{
+ ChangeSignaller<Film> ch (this, CONTENT_VERSIONS);
+ _content_versions = v;
+}
+
+
+void
+Film::set_name_language (dcp::LanguageTag lang)
+{
+ ChangeSignaller<Film> ch (this, NAME_LANGUAGE);
+ _name_language = lang;
+}
+
+
+void
+Film::set_audio_language (dcp::LanguageTag lang)
+{
+ ChangeSignaller<Film> ch (this, AUDIO_LANGUAGE);
+ _audio_language = lang;
+}
+
+
+void
+Film::set_release_territory (dcp::LanguageTag::RegionSubtag region)
+{
+ ChangeSignaller<Film> ch (this, RELEASE_TERRITORY);
+ _release_territory = region;
+}
+
+
+void
+Film::set_status (dcp::Status s)
+{
+ ChangeSignaller<Film> ch (this, STATUS);
+ _status = s;
+}
+
+
+void
+Film::set_version_number (int v)
+{
+ ChangeSignaller<Film> ch (this, VERSION_NUMBER);
+ _version_number = v;
+}
+
+
+void
+Film::set_chain (string c)
+{
+ ChangeSignaller<Film> ch (this, CHAIN);
+ _chain = c;
+}
+
+
+void
+Film::set_distributor (string d)
+{
+ ChangeSignaller<Film> ch (this, DISTRIBUTOR);
+ _distributor = d;
+}
+
+
+void
+Film::set_luminance (dcp::Luminance l)
+{
+ ChangeSignaller<Film> ch (this, LUMINANCE);
+ _luminance = l;
+}
+
+
+void
+Film::set_subtitle_language (dcp::LanguageTag language)
+{
+ vector<dcp::LanguageTag> lang;
+ lang.push_back (language);
+ set_subtitle_languages (lang);
+}
+
+
+void
+Film::unset_subtitle_language ()
+{
+ ChangeSignaller<Film> ch (this, SUBTITLE_LANGUAGES);
+ _subtitle_languages.clear();
+}
+
+
+void
+Film::set_subtitle_languages (vector<dcp::LanguageTag> languages)
+{
+ ChangeSignaller<Film> ch (this, SUBTITLE_LANGUAGES);
+ _subtitle_languages = languages;
+}
+
+
+void
+Film::set_facility (string f)
+{
+ ChangeSignaller<Film> ch (this, FACILITY);
+ _facility = f;
+}
+
+
+optional<DCPTime>
+Film::marker (dcp::Marker type) const
+{
+ map<dcp::Marker, DCPTime>::const_iterator i = _markers.find (type);
+ if (i == _markers.end()) {
+ return optional<DCPTime>();
+ }
+ return i->second;
+}
+
+shared_ptr<InfoFileHandle>
+Film::info_file_handle (DCPTimePeriod period, bool read) const
+{
+ return shared_ptr<InfoFileHandle> (new InfoFileHandle(_info_file_mutex, info_file(period), read));
+}
+
+InfoFileHandle::InfoFileHandle (boost::mutex& mutex, boost::filesystem::path file, bool read)
+ : _lock (mutex)
+ , _file (file)
+{
+ if (read) {
+ _handle = fopen_boost (file, "rb");
+ if (!_handle) {
+ throw OpenFileError (file, errno, OpenFileError::READ);
+ }
+ } else {
+ bool const exists = boost::filesystem::exists (file);
+ if (exists) {
+ _handle = fopen_boost (file, "r+b");
+ } else {
+ _handle = fopen_boost (file, "wb");
+ }
+
+ if (!_handle) {
+ throw OpenFileError (file, errno, exists ? OpenFileError::READ_WRITE : OpenFileError::WRITE);
+ }
+ }
+}
+
+InfoFileHandle::~InfoFileHandle ()
+{
+ fclose (_handle);
+}
+
+
+/** Add FFOC and LFOC markers to a list if they are not already there */
+void
+Film::add_ffoc_lfoc (Markers& markers) const
+{
+ if (markers.find(dcp::Marker::FFOC) == markers.end()) {
+ markers[dcp::Marker::FFOC] = dcpomatic::DCPTime(0);
+ }
+
+ if (markers.find(dcp::Marker::LFOC) == markers.end()) {
+ markers[dcp::Marker::LFOC] = length() - DCPTime::from_frames(1, video_frame_rate());
+ }
+}