blob: ad98119ae1a050e64560557ede8efeaf50dbb44d [file] [log] [blame]
// Copyright 2016 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.
#include <memory>
#include <string>
#include "chromecast/public/media/cast_key_status.h"
#include "media/base/cdm_context.h"
namespace chromecast {
namespace media {
class DecryptContextImpl;
// CdmContext implementation + some extra APIs needed by CastRenderer.
class CastCdmContext : public ::media::CdmContext {
// ::media::CdmContext implementation.
::media::Decryptor* GetDecryptor() override;
int GetCdmId() const override;
// Register a player with this CDM. |new_key_cb| will be called when a new
// key is available. |cdm_unset_cb| will be called when the CDM is destroyed.
virtual int RegisterPlayer(const base::Closure& new_key_cb,
const base::Closure& cdm_unset_cb) = 0;
// Unregiester a player with this CDM. |registration_id| should be the id
// returned by RegisterPlayer().
virtual void UnregisterPlayer(int registration_id) = 0;
// Returns the decryption context needed to decrypt frames encrypted with
// |key_id|. Returns null if |key_id| is not available.
virtual std::unique_ptr<DecryptContextImpl> GetDecryptContext(
const std::string& key_id) = 0;
// Notifies that key status has changed (e.g. if expiry is detected by
// hardware decoder).
virtual void SetKeyStatus(const std::string& key_id,
CastKeyStatus key_status,
uint32_t system_code) = 0;
} // namespace media
} // namespace chromecast