| 1 |
/* |
| 2 |
* Copyright (C) 2018 The Chromium Authors. All rights reserved. |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: BSD-3-Clause |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "cdm/media/cdm/api/content_decryption_module.h" |
| 12 |
|
| 13 |
#include <string> |
| 14 |
#include <vector> |
| 15 |
|
| 16 |
#include <kodi/addon-instance/VideoCodec.h> |
| 17 |
|
| 18 |
enum class CryptoMode; |
| 19 |
|
| 20 |
namespace media |
| 21 |
{ |
| 22 |
|
| 23 |
// CDM Converters |
| 24 |
|
| 25 |
std::string CdmStatusToString(const cdm::Status status); |
| 26 |
|
| 27 |
cdm::EncryptionScheme ToCdmEncryptionScheme(const CryptoMode cryptoMode); |
| 28 |
|
| 29 |
cdm::VideoCodec ToCdmVideoCodec(const VIDEOCODEC_TYPE codec); |
| 30 |
|
| 31 |
cdm::VideoCodecProfile ToCdmVideoCodecProfile(const STREAMCODEC_PROFILE profile); |
| 32 |
|
| 33 |
// Video Converters |
| 34 |
|
| 35 |
cdm::VideoFormat ToCdmVideoFormat(const VIDEOCODEC_FORMAT videoFormat); |
| 36 |
|
| 37 |
VIDEOCODEC_FORMAT ToSSDVideoFormat(const cdm::VideoFormat format); |
| 38 |
|
| 39 |
// Aggregated Types |
| 40 |
|
| 41 |
// Warning: The returned config contains raw pointers to the extra data in the |
| 42 |
// input |config|. Hence, the caller must make sure the input |config| outlives |
| 43 |
// the returned config. |
| 44 |
cdm::VideoDecoderConfig_3 ToCdmVideoDecoderConfig(const VIDEOCODEC_INITDATA* initData, |
| 45 |
const CryptoMode cryptoMode); |
| 46 |
|
| 47 |
// Fill |input_buffer| based on the values in |encrypted|. |subsamples| |
| 48 |
// is used to hold some of the data. |input_buffer| will contain pointers |
| 49 |
// to data contained in |encrypted| and |subsamples|, so the lifetime of |
| 50 |
// |input_buffer| must be <= the lifetime of |encrypted| and |subsamples|. |
| 51 |
void ToCdmInputBuffer(const DEMUX_PACKET* encryptedBuffer, |
| 52 |
std::vector<cdm::SubsampleEntry>* subsamples, |
| 53 |
cdm::InputBuffer_2* inputBuffer); |
| 54 |
|
| 55 |
} // namespace media |