Home | History | Annotate | Download | only in crypto
      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 CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_INFO_H_
      6 #define CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_INFO_H_
      7 
      8 #include <string>
      9 
     10 #include "base/basictypes.h"
     11 
     12 namespace WebKit {
     13 class WebString;
     14 }
     15 
     16 namespace content {
     17 
     18 struct MediaFormatAndKeySystem {
     19   const char* mime_type;
     20   const char* codecs_list;
     21   const char* key_system;
     22 };
     23 
     24 #if defined(ENABLE_PEPPER_CDMS)
     25 struct KeySystemPepperTypePair {
     26   const char* key_system;
     27   const char* type;
     28 };
     29 #endif  // defined(ENABLE_PEPPER_CDMS)
     30 
     31 #if defined(OS_ANDROID)
     32 struct KeySystemUUIDPair {
     33   const char* key_system;
     34   const uint8 uuid[16];
     35 };
     36 #endif  // defined(OS_ANDROID)
     37 
     38 // Specifies the container and codec combinations supported by individual
     39 // key systems. Each line is a container-codecs combination and the key system
     40 // that supports it. Multiple codecs can be listed. In all cases, the container
     41 // without a codec is also supported.
     42 // This list is converted at runtime into individual container-codec-key system
     43 // entries in KeySystems::key_system_map_.
     44 extern const MediaFormatAndKeySystem kSupportedFormatKeySystemCombinations[];
     45 extern const int kNumSupportedFormatKeySystemCombinations;
     46 
     47 #if defined(ENABLE_PEPPER_CDMS)
     48 // There should be one entry for each key system.
     49 extern const KeySystemPepperTypePair kKeySystemToPepperTypeMapping[];
     50 extern const int kNumKeySystemToPepperTypeMapping;
     51 #endif  // defined(ENABLE_PEPPER_CDMS)
     52 
     53 #if defined(OS_ANDROID)
     54 // Mapping from key system to UUID, one entry per key system.
     55 extern const KeySystemUUIDPair kKeySystemToUUIDMapping[];
     56 extern const int kNumKeySystemToUUIDMapping;
     57 #endif  // defined(OS_ANDROID)
     58 
     59 // Returns whether |key_system| is compatible with the user's system.
     60 bool IsSystemCompatible(const std::string& key_system);
     61 
     62 // Returns true if canPlayType should return an empty string for |key_system|.
     63 bool IsCanPlayTypeSuppressed(const std::string& key_system);
     64 
     65 // Returns the name that UMA will use for the given |key_system|.
     66 // This function can be called frequently. Hence this function should be
     67 // implemented not to impact performance.
     68 std::string KeySystemNameForUMAInternal(const WebKit::WebString& key_system);
     69 
     70 // Returns whether built-in AesDecryptor can be used for the given |key_system|.
     71 bool CanUseBuiltInAesDecryptor(const std::string& key_system);
     72 
     73 }  // namespace content
     74 
     75 #endif  // CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_INFO_H_
     76