summaryrefslogtreecommitdiff
path: root/chromium/media/base/cdm_key_information.h
blob: 16ea225ad36c0a986f5b5f30f47782ccc12b2f3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_BASE_CDM_KEY_INFORMATION_H_
#define MEDIA_BASE_CDM_KEY_INFORMATION_H_

#include <stddef.h>
#include <stdint.h>

#include <string>
#include <vector>

#include "media/base/media_export.h"

namespace media {

struct MEDIA_EXPORT CdmKeyInformation {
  enum KeyStatus {
    USABLE = 0,
    INTERNAL_ERROR = 1,
    EXPIRED = 2,
    OUTPUT_RESTRICTED = 3,
    OUTPUT_DOWNSCALED = 4,
    KEY_STATUS_PENDING = 5,
    RELEASED = 6,
    KEY_STATUS_MAX = RELEASED
  };

  // Default constructor needed for passing this type through IPC. Regular
  // code should use one of the other constructors.
  CdmKeyInformation();
  CdmKeyInformation(const std::vector<uint8_t>& key_id,
                    KeyStatus status,
                    uint32_t system_code);
  CdmKeyInformation(const std::string& key_id,
                    KeyStatus status,
                    uint32_t system_code);
  CdmKeyInformation(const uint8_t* key_id_data,
                    size_t key_id_length,
                    KeyStatus status,
                    uint32_t system_code);
  CdmKeyInformation(const CdmKeyInformation& other);
  ~CdmKeyInformation();

  static std::string KeyStatusToString(KeyStatus key_status);

  std::vector<uint8_t> key_id;
  KeyStatus status;
  uint32_t system_code;
};

// For logging use only.
MEDIA_EXPORT std::ostream& operator<<(std::ostream& os,
                                      const CdmKeyInformation& info);

}  // namespace media

#endif  // MEDIA_BASE_CDM_KEY_INFORMATION_H_