• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef MEDIA_CDM_PPAPI_SUPPORTED_CDM_VERSIONS_H_
6 #define MEDIA_CDM_PPAPI_SUPPORTED_CDM_VERSIONS_H_
7 
8 #include "media/cdm/ppapi/api/content_decryption_module.h"
9 
10 namespace media {
11 
IsSupportedCdmModuleVersion(int version)12 bool IsSupportedCdmModuleVersion(int version) {
13   switch(version) {
14     // Latest.
15     case CDM_MODULE_VERSION:
16       return true;
17     default:
18       return false;
19   }
20 }
21 
IsSupportedCdmInterfaceVersion(int version)22 bool IsSupportedCdmInterfaceVersion(int version) {
23   COMPILE_ASSERT(cdm::ContentDecryptionModule::kVersion ==
24                  cdm::ContentDecryptionModule_3::kVersion,
25                  update_code_below);
26   switch(version) {
27     // Supported versions in decreasing order.
28     case cdm::ContentDecryptionModule_3::kVersion:
29     case cdm::ContentDecryptionModule_2::kVersion:
30     case cdm::ContentDecryptionModule_1::kVersion:
31       return true;
32     default:
33       return false;
34   }
35 }
36 
IsSupportedCdmHostVersion(int version)37 bool IsSupportedCdmHostVersion(int version) {
38   COMPILE_ASSERT(cdm::ContentDecryptionModule::Host::kVersion ==
39                  cdm::ContentDecryptionModule_3::Host::kVersion,
40                  update_code_below);
41   switch(version) {
42     // Supported versions in decreasing order.
43     case cdm::Host_3::kVersion:
44     case cdm::Host_2::kVersion:
45     case cdm::Host_1::kVersion:
46       return true;
47     default:
48       return false;
49   }
50 }
51 
52 }  // namespace media
53 
54 #endif  // MEDIA_CDM_PPAPI_SUPPORTED_CDM_VERSIONS_H_
55