1 // Copyright 2016 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 CHROMECAST_MEDIA_CDM_CAST_CDM_CONTEXT_H_
6 #define CHROMECAST_MEDIA_CDM_CAST_CDM_CONTEXT_H_
7 
8 #include <memory>
9 #include <string>
10 
11 #include "chromecast/public/media/cast_decrypt_config.h"
12 #include "chromecast/public/media/cast_key_status.h"
13 #include "media/base/cdm_context.h"
14 
15 namespace chromecast {
16 namespace media {
17 
18 class DecryptContextImpl;
19 
20 // CdmContext implementation + some extra APIs needed by CastRenderer.
21 class CastCdmContext : public ::media::CdmContext {
22  public:
23   // ::media::CdmContext implementation.
24   ::media::Decryptor* GetDecryptor() override;
25 
26   // Returns the decryption context needed to decrypt frames encrypted with
27   // |key_id|. Returns null if |key_id| is not available.
28   virtual std::unique_ptr<DecryptContextImpl> GetDecryptContext(
29       const std::string& key_id,
30       EncryptionScheme encryption_scheme) = 0;
31 
32   // Notifies that key status has changed (e.g. if expiry is detected by
33   // hardware decoder).
34   virtual void SetKeyStatus(const std::string& key_id,
35                             CastKeyStatus key_status,
36                             uint32_t system_code) = 0;
37 
38   // Notifies of current decoded video resolution (used for licence policy
39   // enforcement).
40   virtual void SetVideoResolution(int width, int height) = 0;
41 };
42 
43 }  // namespace media
44 }  // namespace chromecast
45 
46 #endif  // CHROMECAST_MEDIA_CDM_CAST_CDM_CONTEXT_H_
47