summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-07-21 18:52:44 +0200
committerCarl Hetherington <cth@carlh.net>2024-07-21 18:58:43 +0200
commite0149411ce091a3f0c33d6bb81602e15c19a09d3 (patch)
tree1e50745298fb12ba44e23e26acb1ed6b438cb9b8 /src/lib
parent4d721e683b584fe48e7905e44ab3da23afe76145 (diff)
Cleanup: move InfoFileHandle into its own files.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/film.cc10
-rw-r--r--src/lib/film.h18
-rw-r--r--src/lib/info_file_handle.cc38
-rw-r--r--src/lib/info_file_handle.h41
-rw-r--r--src/lib/wscript1
5 files changed, 82 insertions, 26 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 174b3ce83..577895161 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -47,6 +47,7 @@
#include "file_log.h"
#include "film.h"
#include "font.h"
+#include "info_file_handle.h"
#include "job.h"
#include "job_manager.h"
#include "kdm_with_metadata.h"
@@ -2182,15 +2183,6 @@ Film::info_file_handle (DCPTimePeriod period, bool read) const
return std::make_shared<InfoFileHandle>(_info_file_mutex, info_file(period), read);
}
-InfoFileHandle::InfoFileHandle (boost::mutex& mutex, boost::filesystem::path path, bool read)
- : _lock (mutex)
- , _file(path, read ? "rb" : (dcp::filesystem::exists(path) ? "r+b" : "wb"))
-{
- if (!_file) {
- throw OpenFileError(path, errno, read ? OpenFileError::READ : (dcp::filesystem::exists(path) ? OpenFileError::READ_WRITE : OpenFileError::WRITE));
- }
-}
-
/** Add FFOC and LFOC markers to a list if they are not already there */
void
diff --git a/src/lib/film.h b/src/lib/film.h
index d71435566..2e7a562e1 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -72,6 +72,7 @@ class AudioProcessor;
class Content;
class DCPContentType;
class Film;
+class InfoFileHandle;
class Job;
class Log;
class Playlist;
@@ -84,23 +85,6 @@ struct ov_subs_in_vf_name;
struct recover_test_2d_encrypted;
-class InfoFileHandle
-{
-public:
- InfoFileHandle (boost::mutex& mutex, boost::filesystem::path file, bool read);
-
- dcp::File& get () {
- return _file;
- }
-
-private:
- friend class Film;
-
- boost::mutex::scoped_lock _lock;
- dcp::File _file;
-};
-
-
/** @class Film
*
* @brief A representation of some audio, video, subtitle and closed-caption content,
diff --git a/src/lib/info_file_handle.cc b/src/lib/info_file_handle.cc
new file mode 100644
index 000000000..ce1ab0b18
--- /dev/null
+++ b/src/lib/info_file_handle.cc
@@ -0,0 +1,38 @@
+/*
+ Copyright (C) 2024 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "info_file_handle.h"
+#include "exceptions.h"
+#include <dcp/filesystem.h>
+
+
+
+InfoFileHandle::InfoFileHandle(boost::mutex& mutex, boost::filesystem::path path, bool read)
+ : _lock(mutex)
+ , _file(path, read ? "rb" : (dcp::filesystem::exists(path) ? "r+b" : "wb"))
+{
+ if (!_file) {
+ throw OpenFileError(path, errno, read ? OpenFileError::READ : (dcp::filesystem::exists(path) ? OpenFileError::READ_WRITE : OpenFileError::WRITE));
+ }
+}
+
+
+
diff --git a/src/lib/info_file_handle.h b/src/lib/info_file_handle.h
new file mode 100644
index 000000000..4ee872025
--- /dev/null
+++ b/src/lib/info_file_handle.h
@@ -0,0 +1,41 @@
+/*
+ Copyright (C) 2024 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include <boost/thread/mutex.hpp>
+#include <dcp/file.h>
+
+
+class InfoFileHandle
+{
+public:
+ InfoFileHandle(boost::mutex& mutex, boost::filesystem::path file, bool read);
+
+ dcp::File& get() {
+ return _file;
+ }
+
+private:
+ friend class Film;
+
+ boost::mutex::scoped_lock _lock;
+ dcp::File _file;
+};
+
diff --git a/src/lib/wscript b/src/lib/wscript
index dfe3ce487..6ca49a05d 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -139,6 +139,7 @@ sources = """
image_png.cc
image_proxy.cc
image_store.cc
+ info_file_handle.cc
internal_player_server.cc
j2k_image_proxy.cc
job.cc