Index: media/base/assert_matching_enums.cc |
diff --git a/media/base/assert_matching_enums.cc b/media/base/assert_matching_enums.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..230e25945023fa046806491dd0bc53b4e80fcd1d |
--- /dev/null |
+++ b/media/base/assert_matching_enums.cc |
@@ -0,0 +1,47 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
amogh.bihani
2014/07/30 10:22:41
This should avoid anyone accidentally changing ent
xhwang
2014/07/30 21:21:41
I think we are doing the conversion explicitly in
amogh.bihani
2014/07/31 05:07:40
Acknowledged. I'll remove this :).
|
+// found in the LICENSE file. |
+ |
+#include "base/macros.h" |
+#include "media/base/video_decoder_config.h" |
+#include "ppapi/c/dev/pp_video_dev.h" |
+ |
+namespace { |
+ |
+#define COMPILE_ASSERT_MATCHING_ENUM(expected, actual) \ |
+ COMPILE_ASSERT(int(expected) == int(actual), mismatching_enums) |
+ |
+// PPAPI contains a "none" H.264 profile that doesn't correspond to any codec |
+// profile in H.264 |
+const int kH264PROFILE_NONE_OFFSET = 1; |
+ |
+// Video codecs |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_PROFILE_UNKNOWN, |
+ media::VIDEO_CODEC_PROFILE_UNKNOWN); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_H264PROFILE_BASELINE, |
+ media::H264PROFILE_BASELINE + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_H264PROFILE_MAIN, |
+ media::H264PROFILE_MAIN + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_H264PROFILE_EXTENDED, |
+ media::H264PROFILE_EXTENDED + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_H264PROFILE_HIGH, |
+ media::H264PROFILE_HIGH + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_H264PROFILE_HIGH10PROFILE, |
+ media::H264PROFILE_HIGH10PROFILE + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_H264PROFILE_HIGH422PROFILE, |
+ media::H264PROFILE_HIGH422PROFILE + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM( |
+ PP_VIDEODECODER_H264PROFILE_HIGH444PREDICTIVEPROFILE, |
+ media::H264PROFILE_HIGH444PREDICTIVEPROFILE + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_H264PROFILE_SCALABLEBASELINE, |
+ media::H264PROFILE_SCALABLEBASELINE + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_H264PROFILE_SCALABLEHIGH, |
+ media::H264PROFILE_SCALABLEHIGH + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_H264PROFILE_STEREOHIGH, |
+ media::H264PROFILE_STEREOHIGH + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_H264PROFILE_MULTIVIEWHIGH, |
+ media::H264PROFILE_MULTIVIEWHIGH + kH264PROFILE_NONE_OFFSET); |
+COMPILE_ASSERT_MATCHING_ENUM(PP_VIDEODECODER_VP8PROFILE_MAIN, |
+ media::VP8PROFILE_MAIN + kH264PROFILE_NONE_OFFSET); |
+ |
+} // namespace |