Fix for C++20 support.
Math between enums of disparate types is deprecated. Use constexprs
instead.
Bug: chromium:1284275
Change-Id: I9d675cd2cf85f4876c124c9a6dc6a01cd8815037
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/cdm/+/3630721
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
diff --git a/content_decryption_module.h b/content_decryption_module.h
index 0e73012..77dc7f0 100644
--- a/content_decryption_module.h
+++ b/content_decryption_module.h
@@ -479,12 +479,13 @@
virtual ~DecryptedBlock() {}
};
-enum VideoPlane : uint32_t {
- kYPlane = 0,
- kUPlane = 1,
- kVPlane = 2,
- kMaxPlanes = 3,
-};
+// This intentionally avoids using an enum, since it will be used to do math
+// with other enums, which is deprecated in C++20.
+using VideoPlane = uint32_t;
+constexpr VideoPlane kYPlane = 0;
+constexpr VideoPlane kUPlane = 1;
+constexpr VideoPlane kVPlane = 2;
+constexpr VideoPlane kMaxPlanes = 3;
CHECK_TYPE(VideoPlane, 4, 4);
class CDM_CLASS_API VideoFrame {