key_system_names.cc 782 B

1234567891011121314151617181920212223242526
  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. #include "media/base/key_system_names.h"
  5. namespace media {
  6. const char kClearKey[] = "org.w3.clearkey";
  7. const char kExternalClearKey[] = "org.chromium.externalclearkey";
  8. bool IsClearKey(const std::string& key_system) {
  9. return key_system == kClearKey;
  10. }
  11. bool IsSubKeySystemOf(const std::string& key_system, const std::string& base) {
  12. std::string prefix = base + '.';
  13. return key_system.substr(0, prefix.size()) == prefix;
  14. }
  15. bool IsExternalClearKey(const std::string& key_system) {
  16. return key_system == kExternalClearKey ||
  17. IsSubKeySystemOf(key_system, kExternalClearKey);
  18. }
  19. } // namespace media