blob: a04173d461091e2df667cfd792d1e8cfe67776c0 [file] [log] [blame]
// Copyright 2018 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 <stdint.h>
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/optional.h"
#include "build/build_config.h"
#include "media/base/media_export.h"
#include "media/cdm/cdm_proxy.h"
#if defined(OS_WIN)
#include <d3d11.h>
namespace media {
// An interface for accessing various CdmProxy data required for decrypting
// and/or decoding data.
class MEDIA_EXPORT CdmProxyContext {
#if defined(OS_WIN)
struct D3D11DecryptContext {
// Crypto session pointer for decryption.
// The pointer is owned by the CdmContext implementation.
ID3D11CryptoSession* crypto_session;
// Opaque key blob for decrypting or decoding.
// The pointer is owned by the CdmContext implementation.
const void* key_blob;
// The size of the blob.
uint32_t key_blob_size;
// GUID identifying the hardware key info.
GUID key_info_guid;
// Returns D3D11DecryptContext on success. Returns nullopt otherwise. The
// D3D11DecryptContext instance is only guaranteed to be valid before the
// caller returns.
// |key_type| is the requesting key type.
// |key_id| is the key ID of the media to decrypt.
virtual base::Optional<D3D11DecryptContext> GetD3D11DecryptContext(
CdmProxy::KeyType key_type,
const std::string& key_id) WARN_UNUSED_RESULT;
#endif // defined(OS_WIN)
// TODO( There will be more methods for this class.
virtual ~CdmProxyContext();
} // namespace media