summaryrefslogtreecommitdiff
path: root/src/lib/types.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-18 12:40:38 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-18 12:40:38 +0100
commitc6113e09ca546d5a739b36aa0d198581958d9ded (patch)
tree3747f83e86ec7fcfd5475d39486e7f6547c9c568 /src/lib/types.cc
parent5ad79869f79c8fa140974e89b3c67b8eefc7d067 (diff)
Speculative 4K support.
Diffstat (limited to 'src/lib/types.cc')
-rw-r--r--src/lib/types.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/types.cc b/src/lib/types.cc
index 035c8363d..bc4f5f8d9 100644
--- a/src/lib/types.cc
+++ b/src/lib/types.cc
@@ -21,6 +21,7 @@
using std::max;
using std::min;
+using std::string;
bool operator== (Crop const & a, Crop const & b)
{
@@ -32,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;
+}