X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Ftypes.cc;h=bc4f5f8d9d425d0d9305f1015c124ee92590dcb7;hb=98060a4e6f02b418f30b4b736e5880a357454c40;hp=1e0f48327bfe0a35aa5097985ea859fcaebf8690;hpb=5859b758e3a6e0191ce12e77b636c7def58bbc3b;p=dcpomatic.git diff --git a/src/lib/types.cc b/src/lib/types.cc index 1e0f48327..bc4f5f8d9 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -19,6 +19,10 @@ #include "types.h" +using std::max; +using std::min; +using std::string; + bool operator== (Crop const & a, Crop const & b) { return (a.left == b.left && a.right == b.right && a.top == b.top && a.bottom == b.bottom); @@ -29,3 +33,35 @@ bool operator!= (Crop const & a, Crop const & b) return !(a == b); } +/** @param r Resolution. + * @return Untranslated string representation. + */ +string +resolution_to_string (Resolution r) +{ + switch (r) { + case RESOLUTION_2K: + return "2K"; + case RESOLUTION_4K: + return "4K"; + } + + assert (false); + return ""; +} + + +Resolution +string_to_resolution (string s) +{ + if (s == "2K") { + return RESOLUTION_2K; + } + + if (s == "4K") { + return RESOLUTION_4K; + } + + assert (false); + return RESOLUTION_2K; +}