- add sources.
[platform/framework/web/crosswalk.git] / src / media / cdm / ppapi / supported_cdm_versions.h
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
12 // TODO(ddorwin): Move to content_decryption_module.h.
13 #define CDM_MODULE_VERSION 4
14
15 bool IsSupportedCdmModuleVersion(int version) {
16   switch(version) {
17     // Latest.
18     case CDM_MODULE_VERSION:
19       return true;
20     default:
21       return false;
22   }
23 }
24
25 bool IsSupportedCdmInterfaceVersion(int version) {
26   COMPILE_ASSERT(cdm::ContentDecryptionModule::kVersion ==
27                  cdm::ContentDecryptionModule_2::kVersion,
28                  update_code_below);
29   switch(version) {
30     // Latest.
31     case cdm::ContentDecryptionModule::kVersion:
32     // Older supported versions.
33     case cdm::ContentDecryptionModule_1::kVersion:
34       return true;
35     default:
36       return false;
37   }
38 }
39
40 bool IsSupportedCdmHostVersion(int version) {
41   COMPILE_ASSERT(cdm::ContentDecryptionModule::Host::kVersion ==
42                  cdm::ContentDecryptionModule_2::Host::kVersion,
43                  update_code_below);
44   switch(version) {
45     // Supported versions in increasing order (there is no default).
46     case cdm::Host_1::kVersion:
47     case cdm::Host_2::kVersion:
48       return true;
49     default:
50       return false;
51   }
52 }
53
54 }  // namespace media
55
56 #endif  // MEDIA_CDM_PPAPI_SUPPORTED_CDM_VERSIONS_H_