summaryrefslogtreecommitdiff
path: root/src/lib/types.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-11-08 22:34:18 +0100
committerCarl Hetherington <cth@carlh.net>2020-11-16 01:40:36 +0100
commite64a1a9aae0200d14feed49a4c6cf537bf5708a4 (patch)
treeb1b01bb8e6f1872309eb246434120de3b769e9e5 /src/lib/types.cc
parentf5608308b17c72b3ee459c805663e0103de1d2a4 (diff)
Obey requests to change the video range of RGB content.
Video that comes in with RGB pixels will not have its video level ranges changed by libswscale (it only does this for YUV and greyscale). Here we add code to do it ourselves for RGB content coming in via image files (e.g. PNG/DPX etc). Part of #1851.
Diffstat (limited to 'src/lib/types.cc')
-rw-r--r--src/lib/types.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lib/types.cc b/src/lib/types.cc
index e7acf6992..5687a5d48 100644
--- a/src/lib/types.cc
+++ b/src/lib/types.cc
@@ -229,3 +229,31 @@ bool operator== (NamedChannel const& a, NamedChannel const& b)
return a.name == b.name && a.index == b.index;
}
+
+string
+video_range_to_string (VideoRange r)
+{
+ switch (r) {
+ case VIDEO_RANGE_FULL:
+ return "full";
+ case VIDEO_RANGE_VIDEO:
+ return "video";
+ default:
+ DCPOMATIC_ASSERT (false);
+ }
+}
+
+
+VideoRange
+string_to_video_range (string s)
+{
+ if (s == "full") {
+ return VIDEO_RANGE_FULL;
+ } else if (s == "video") {
+ return VIDEO_RANGE_VIDEO;
+ }
+
+ DCPOMATIC_ASSERT (false);
+ return VIDEO_RANGE_FULL;
+}
+