From: Carl Hetherington Date: Sat, 10 Dec 2022 22:32:51 +0000 (+0100) Subject: Extract resolution.h X-Git-Tag: v2.16.36~18 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;ds=sidebyside;h=4becf7d0cb19fbbdad4f31b0881b77e689d2c1d6;p=dcpomatic.git Extract resolution.h --- diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 17a9a9386..96ae09521 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -31,6 +31,7 @@ #include "content.h" #include "enum_indexed_vector.h" #include "font.h" +#include "resolution.h" #include #include #include diff --git a/src/lib/dcp_video.h b/src/lib/dcp_video.h index 3bd516ccd..5b397a391 100644 --- a/src/lib/dcp_video.h +++ b/src/lib/dcp_video.h @@ -18,18 +18,22 @@ */ -#include "types.h" + #include "encode_server_description.h" +#include "resolution.h" #include #include + /** @file src/dcp_video_frame.h * @brief A single frame of video destined for a DCP. */ + class Log; class PlayerVideo; + /** @class DCPVideo * @brief A single frame of video destined for a DCP. * diff --git a/src/lib/film.h b/src/lib/film.h index b1451c212..55412c2e8 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -33,9 +33,10 @@ #include "dcp_text_track.h" #include "dcpomatic_time.h" #include "frame_rate_change.h" +#include "resolution.h" #include "signaller.h" #include "transcode_job.h" -#include "types.h" +#include "util.h" #include #include #include diff --git a/src/lib/resolution.cc b/src/lib/resolution.cc new file mode 100644 index 000000000..d87db7a57 --- /dev/null +++ b/src/lib/resolution.cc @@ -0,0 +1,62 @@ +/* + Copyright (C) 2013-2019 Carl Hetherington + + 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 . + +*/ + + +#include "dcpomatic_assert.h" +#include "resolution.h" + + +using std::string; + + +/** @param r Resolution. + * @return Untranslated string representation. + */ +string +resolution_to_string (Resolution r) +{ + switch (r) { + case Resolution::TWO_K: + return "2K"; + case Resolution::FOUR_K: + return "4K"; + } + + DCPOMATIC_ASSERT (false); + return ""; +} + + +Resolution +string_to_resolution (string s) +{ + if (s == "2K") { + return Resolution::TWO_K; + } + + if (s == "4K") { + return Resolution::FOUR_K; + } + + DCPOMATIC_ASSERT (false); + return Resolution::TWO_K; +} + + diff --git a/src/lib/resolution.h b/src/lib/resolution.h new file mode 100644 index 000000000..eab6b0610 --- /dev/null +++ b/src/lib/resolution.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2013-2021 Carl Hetherington + + 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 . + +*/ + + +#ifndef DCPOMATIC_RESOLUTION_H +#define DCPOMATIC_RESOLUTION_H + + +#include + + +enum class Resolution { + TWO_K, + FOUR_K +}; + +std::string resolution_to_string(Resolution); +Resolution string_to_resolution(std::string); + + +#endif diff --git a/src/lib/types.cc b/src/lib/types.cc index 6bac0cf3e..d9108a942 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -43,40 +43,6 @@ using std::vector; using dcp::raw_convert; -/** @param r Resolution. - * @return Untranslated string representation. - */ -string -resolution_to_string (Resolution r) -{ - switch (r) { - case Resolution::TWO_K: - return "2K"; - case Resolution::FOUR_K: - return "4K"; - } - - DCPOMATIC_ASSERT (false); - return ""; -} - - -Resolution -string_to_resolution (string s) -{ - if (s == "2K") { - return Resolution::TWO_K; - } - - if (s == "4K") { - return Resolution::FOUR_K; - } - - DCPOMATIC_ASSERT (false); - return Resolution::TWO_K; -} - - TextType string_to_text_type (string s) { diff --git a/src/lib/types.h b/src/lib/types.h index ab3f15841..e4a333bc2 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -190,14 +190,6 @@ struct CPLSummary time_t last_write_time; }; -enum class Resolution { - TWO_K, - FOUR_K -}; - -std::string resolution_to_string (Resolution); -Resolution string_to_resolution (std::string); - enum class FileTransferProtocol { SCP, FTP diff --git a/src/lib/wscript b/src/lib/wscript index 3a3c8fd51..447c0f478 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -159,6 +159,7 @@ sources = """ release_notes.cc render_text.cc resampler.cc + resolution.cc rgba.cc rng.cc scoped_temporary.cc