chromium/media/cdm/cdm_type_conversion.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/cdm/cdm_type_conversion.h"

#include <stdint.h>

#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size.h"

// Note: Unexpected values must be handled explicitly since some of these
// functions may be used at either side of the CDM interface, and it's possible
// invalid values are passed in. For example, Chromium loading an older CDM, or
// the CDM is loaded by a non-Chromium browser.

namespace media {

namespace {

cdm::ColorRange ToCdmColorRange(gfx::ColorSpace::RangeID range) {}

gfx::ColorSpace::RangeID ToGfxColorRange(cdm::ColorRange range) {}

}  // namespace

// Color Converters

cdm::ColorSpace ToCdmColorSpace(const VideoColorSpace& color_space) {}

VideoColorSpace ToMediaColorSpace(const cdm::ColorSpace& color_space) {}

// CDM Converters

cdm::HdcpVersion ToCdmHdcpVersion(HdcpVersion hdcp_version) {}

cdm::SessionType ToCdmSessionType(CdmSessionType session_type) {}

CdmSessionType ToMediaSessionType(cdm::SessionType session_type) {}

cdm::InitDataType ToCdmInitDataType(EmeInitDataType init_data_type) {}

EmeInitDataType ToEmeInitDataType(cdm::InitDataType init_data_type) {}

CdmKeyInformation::KeyStatus ToMediaKeyStatus(cdm::KeyStatus status) {}

cdm::KeyStatus ToCdmKeyStatus(CdmKeyInformation::KeyStatus status) {}

cdm::EncryptionScheme ToCdmEncryptionScheme(EncryptionScheme scheme) {}

CdmPromise::Exception ToMediaCdmPromiseException(cdm::Exception exception) {}

cdm::Exception ToCdmException(CdmPromise::Exception exception) {}

CdmMessageType ToMediaMessageType(cdm::MessageType message_type) {}

cdm::MessageType ToCdmMessageType(CdmMessageType message_type) {}

cdm::StreamType ToCdmStreamType(Decryptor::StreamType stream_type) {}

Decryptor::Status ToMediaDecryptorStatus(cdm::Status status) {}

// Audio Converters

cdm::AudioCodec ToCdmAudioCodec(AudioCodec codec) {}

SampleFormat ToMediaSampleFormat(cdm::AudioFormat format) {}

// Video Converters

cdm::VideoCodec ToCdmVideoCodec(VideoCodec codec) {}

VideoCodec ToMediaVideoCodec(cdm::VideoCodec codec) {}

cdm::VideoCodecProfile ToCdmVideoCodecProfile(VideoCodecProfile profile) {}

VideoCodecProfile ToMediaVideoCodecProfile(cdm::VideoCodecProfile profile) {}

cdm::VideoFormat ToCdmVideoFormat(VideoPixelFormat format) {}

VideoPixelFormat ToMediaVideoFormat(cdm::VideoFormat format) {}

// Aggregate Types

// Warning: The returned config contains raw pointers to the extra data in the
// input |config|. Hence, the caller must make sure the input |config| outlives
// the returned config.
cdm::AudioDecoderConfig_2 ToCdmAudioDecoderConfig(
    const AudioDecoderConfig& config) {}

// Warning: The returned config contains raw pointers to the extra data in the
// input |config|. Hence, the caller must make sure the input |config| outlives
// the returned config.
cdm::VideoDecoderConfig_3 ToCdmVideoDecoderConfig(
    const VideoDecoderConfig& config) {}

// Fill |input_buffer| based on the values in |encrypted|. |subsamples|
// is used to hold some of the data. |input_buffer| will contain pointers
// to data contained in |encrypted| and |subsamples|, so the lifetime of
// |input_buffer| must be <= the lifetime of |encrypted| and |subsamples|.
void ToCdmInputBuffer(const DecoderBuffer& encrypted_buffer,
                      std::vector<cdm::SubsampleEntry>* subsamples,
                      cdm::InputBuffer_2* input_buffer) {}

}  // namespace media