chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc

// Copyright 2021 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/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h"

#include "base/time/time.h"
#include "media/base/timestamp_constants.h"
#include "mojo/public/cpp/bindings/optional_as_pointer.h"

#if BUILDFLAG(USE_V4L2_CODEC)
#include "media/gpu/v4l2/v4l2_status.h"
#elif BUILDFLAG(USE_VAAPI)
#include "media/gpu/vaapi/vaapi_status.h"
#endif

// This file contains a variety of conservative compile-time assertions that
// help us detect changes that may break the backward compatibility requirement
// of the StableVideoDecoder API. Specifically, we have static_asserts() that
// ensure the type of the media struct member is *exactly* the same as the
// corresponding mojo struct member. If this changes, we must be careful to
// validate ranges and avoid implicit conversions.
//
// If you need to make any changes to this file, please consult with
// [email protected] first.

namespace mojo {

// static
gfx::ColorSpace::PrimaryID
StructTraits<media::stable::mojom::ColorSpaceDataView,
             gfx::ColorSpace>::primaries(const gfx::ColorSpace& input) {}

// static
gfx::ColorSpace::TransferID
StructTraits<media::stable::mojom::ColorSpaceDataView,
             gfx::ColorSpace>::transfer(const gfx::ColorSpace& input) {}

// static
gfx::ColorSpace::MatrixID
StructTraits<media::stable::mojom::ColorSpaceDataView, gfx::ColorSpace>::matrix(
    const gfx::ColorSpace& input) {}

// static
gfx::ColorSpace::RangeID
StructTraits<media::stable::mojom::ColorSpaceDataView, gfx::ColorSpace>::range(
    const gfx::ColorSpace& input) {}

// static
base::span<const float> StructTraits<
    media::stable::mojom::ColorSpaceDataView,
    gfx::ColorSpace>::custom_primary_matrix(const gfx::ColorSpace& input) {}

// static
base::span<const float>
StructTraits<media::stable::mojom::ColorSpaceDataView,
             gfx::ColorSpace>::transfer_params(const gfx::ColorSpace& input) {}

// static
bool StructTraits<media::stable::mojom::ColorSpaceDataView, gfx::ColorSpace>::
    Read(media::stable::mojom::ColorSpaceDataView input,
         gfx::ColorSpace* output) {}

// static
gfx::PointF StructTraits<media::stable::mojom::ColorVolumeMetadataDataView,
                         gfx::HdrMetadataSmpteSt2086>::
    primary_r(const gfx::HdrMetadataSmpteSt2086& input) {}

// static
gfx::PointF StructTraits<media::stable::mojom::ColorVolumeMetadataDataView,
                         gfx::HdrMetadataSmpteSt2086>::
    primary_g(const gfx::HdrMetadataSmpteSt2086& input) {}

// static
gfx::PointF StructTraits<media::stable::mojom::ColorVolumeMetadataDataView,
                         gfx::HdrMetadataSmpteSt2086>::
    primary_b(const gfx::HdrMetadataSmpteSt2086& input) {}

// static
gfx::PointF StructTraits<media::stable::mojom::ColorVolumeMetadataDataView,
                         gfx::HdrMetadataSmpteSt2086>::
    white_point(const gfx::HdrMetadataSmpteSt2086& input) {}

// static
float StructTraits<media::stable::mojom::ColorVolumeMetadataDataView,
                   gfx::HdrMetadataSmpteSt2086>::
    luminance_max(const gfx::HdrMetadataSmpteSt2086& input) {}

// static
float StructTraits<media::stable::mojom::ColorVolumeMetadataDataView,
                   gfx::HdrMetadataSmpteSt2086>::
    luminance_min(const gfx::HdrMetadataSmpteSt2086& input) {}

// static
bool StructTraits<media::stable::mojom::ColorVolumeMetadataDataView,
                  gfx::HdrMetadataSmpteSt2086>::
    Read(media::stable::mojom::ColorVolumeMetadataDataView data,
         gfx::HdrMetadataSmpteSt2086* output) {}

// static
base::TimeDelta StructTraits<media::stable::mojom::DecoderBufferDataView,
                             scoped_refptr<media::DecoderBuffer>>::
    timestamp(const scoped_refptr<media::DecoderBuffer>& input) {}

// static
base::TimeDelta StructTraits<media::stable::mojom::DecoderBufferDataView,
                             scoped_refptr<media::DecoderBuffer>>::
    duration(const scoped_refptr<media::DecoderBuffer>& input) {}

// static
bool StructTraits<media::stable::mojom::DecoderBufferDataView,
                  scoped_refptr<media::DecoderBuffer>>::
    is_end_of_stream(const scoped_refptr<media::DecoderBuffer>& input) {}

// static
uint32_t StructTraits<media::stable::mojom::DecoderBufferDataView,
                      scoped_refptr<media::DecoderBuffer>>::
    data_size(const scoped_refptr<media::DecoderBuffer>& input) {}

// static
bool StructTraits<media::stable::mojom::DecoderBufferDataView,
                  scoped_refptr<media::DecoderBuffer>>::
    is_key_frame(const scoped_refptr<media::DecoderBuffer>& input) {}

// static
std::vector<uint8_t> StructTraits<media::stable::mojom::DecoderBufferDataView,
                                  scoped_refptr<media::DecoderBuffer>>::
    raw_side_data(const scoped_refptr<media::DecoderBuffer>& input) {}

// static
std::unique_ptr<media::DecryptConfig>
StructTraits<media::stable::mojom::DecoderBufferDataView,
             scoped_refptr<media::DecoderBuffer>>::
    decrypt_config(const scoped_refptr<media::DecoderBuffer>& input) {}

// static
base::TimeDelta StructTraits<media::stable::mojom::DecoderBufferDataView,
                             scoped_refptr<media::DecoderBuffer>>::
    front_discard(const scoped_refptr<media::DecoderBuffer>& input) {}

// static
base::TimeDelta StructTraits<media::stable::mojom::DecoderBufferDataView,
                             scoped_refptr<media::DecoderBuffer>>::
    back_discard(const scoped_refptr<media::DecoderBuffer>& input) {}

// static
std::optional<media::DecoderBufferSideData>
StructTraits<media::stable::mojom::DecoderBufferDataView,
             scoped_refptr<media::DecoderBuffer>>::
    side_data(const scoped_refptr<media::DecoderBuffer>& input) {}

// static
bool StructTraits<media::stable::mojom::DecoderBufferDataView,
                  scoped_refptr<media::DecoderBuffer>>::
    Read(media::stable::mojom::DecoderBufferDataView input,
         scoped_refptr<media::DecoderBuffer>* output) {}

// static
uint64_t StructTraits<media::stable::mojom::DecoderBufferSideDataDataView,
                      media::DecoderBufferSideData>::
    secure_handle(media::DecoderBufferSideData input) {}

// static
std::vector<uint32_t> StructTraits<
    media::stable::mojom::DecoderBufferSideDataDataView,
    media::DecoderBufferSideData>::spatial_layers(media::DecoderBufferSideData
                                                      input) {}

// static
std::vector<uint8_t> StructTraits<
    media::stable::mojom::DecoderBufferSideDataDataView,
    media::DecoderBufferSideData>::alpha_data(media::DecoderBufferSideData
                                                  input) {}

// static
bool StructTraits<media::stable::mojom::DecoderBufferSideDataDataView,
                  media::DecoderBufferSideData>::
    Read(media::stable::mojom::DecoderBufferSideDataDataView input,
         media::DecoderBufferSideData* output) {}

// static
media::EncryptionScheme
StructTraits<media::stable::mojom::DecryptConfigDataView,
             std::unique_ptr<media::DecryptConfig>>::
    encryption_scheme(const std::unique_ptr<media::DecryptConfig>& input) {}

// static
const std::string& StructTraits<media::stable::mojom::DecryptConfigDataView,
                                std::unique_ptr<media::DecryptConfig>>::
    key_id(const std::unique_ptr<media::DecryptConfig>& input) {}

// static
const std::string& StructTraits<media::stable::mojom::DecryptConfigDataView,
                                std::unique_ptr<media::DecryptConfig>>::
    iv(const std::unique_ptr<media::DecryptConfig>& input) {}

// static
const std::vector<media::SubsampleEntry>&
StructTraits<media::stable::mojom::DecryptConfigDataView,
             std::unique_ptr<media::DecryptConfig>>::
    subsamples(const std::unique_ptr<media::DecryptConfig>& input) {}

// static
const std::optional<media::EncryptionPattern>&
StructTraits<media::stable::mojom::DecryptConfigDataView,
             std::unique_ptr<media::DecryptConfig>>::
    encryption_pattern(const std::unique_ptr<media::DecryptConfig>& input) {}

// static
bool StructTraits<media::stable::mojom::DecryptConfigDataView,
                  std::unique_ptr<media::DecryptConfig>>::
    Read(media::stable::mojom::DecryptConfigDataView input,
         std::unique_ptr<media::DecryptConfig>* output) {}

// static
uint32_t StructTraits<
    media::stable::mojom::HDRMetadataDataView,
    gfx::HDRMetadata>::max_content_light_level(const gfx::HDRMetadata& input) {}

// static
uint32_t
StructTraits<media::stable::mojom::HDRMetadataDataView, gfx::HDRMetadata>::
    max_frame_average_light_level(const gfx::HDRMetadata& input) {}

// static
gfx::HdrMetadataSmpteSt2086 StructTraits<
    media::stable::mojom::HDRMetadataDataView,
    gfx::HDRMetadata>::color_volume_metadata(const gfx::HDRMetadata& input) {}

// static
bool StructTraits<media::stable::mojom::HDRMetadataDataView, gfx::HDRMetadata>::
    Read(media::stable::mojom::HDRMetadataDataView data,
         gfx::HDRMetadata* output) {}

// static
int32_t
StructTraits<media::stable::mojom::MediaLogRecordDataView,
             media::MediaLogRecord>::id(const media::MediaLogRecord& input) {}

// static
media::MediaLogRecord::Type
StructTraits<media::stable::mojom::MediaLogRecordDataView,
             media::MediaLogRecord>::type(const media::MediaLogRecord& input) {}

// static
const base::Value::Dict& StructTraits<
    media::stable::mojom::MediaLogRecordDataView,
    media::MediaLogRecord>::params(const media::MediaLogRecord& input) {}

// static
base::TimeTicks
StructTraits<media::stable::mojom::MediaLogRecordDataView,
             media::MediaLogRecord>::time(const media::MediaLogRecord& input) {}

// static
bool StructTraits<media::stable::mojom::MediaLogRecordDataView,
                  media::MediaLogRecord>::
    Read(media::stable::mojom::MediaLogRecordDataView data,
         media::MediaLogRecord* output) {}

// static
const gfx::GpuMemoryBufferId& StructTraits<
    media::stable::mojom::NativeGpuMemoryBufferHandleDataView,
    gfx::GpuMemoryBufferHandle>::id(const gfx::GpuMemoryBufferHandle& input) {}

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
// static
gfx::NativePixmapHandle StructTraits<
    media::stable::mojom::NativeGpuMemoryBufferHandleDataView,
    gfx::GpuMemoryBufferHandle>::platform_handle(gfx::GpuMemoryBufferHandle&
                                                     input) {}
#endif  // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)

// static
bool StructTraits<media::stable::mojom::NativeGpuMemoryBufferHandleDataView,
                  gfx::GpuMemoryBufferHandle>::
    Read(media::stable::mojom::NativeGpuMemoryBufferHandleDataView data,
         gfx::GpuMemoryBufferHandle* output) {}

// static
media::stable::mojom::StatusCode StructTraits<
    media::stable::mojom::StatusDataDataView,
    media::internal::StatusData>::code(const media::internal::StatusData&
                                           input) {}

// static
std::string StructTraits<media::stable::mojom::StatusDataDataView,
                         media::internal::StatusData>::
    group(const media::internal::StatusData& input) {}

// static
std::string StructTraits<media::stable::mojom::StatusDataDataView,
                         media::internal::StatusData>::
    message(const media::internal::StatusData& input) {}

// static
const base::Value::List& StructTraits<media::stable::mojom::StatusDataDataView,
                                      media::internal::StatusData>::
    frames(const media::internal::StatusData& input) {}

// static
std::optional<media::internal::StatusData> StructTraits<
    media::stable::mojom::StatusDataDataView,
    media::internal::StatusData>::cause(const media::internal::StatusData&
                                            input) {}

// static
const base::Value& StructTraits<media::stable::mojom::StatusDataDataView,
                                media::internal::StatusData>::
    data(const media::internal::StatusData& input) {}

// static
bool StructTraits<media::stable::mojom::StatusDataDataView,
                  media::internal::StatusData>::
    Read(media::stable::mojom::StatusDataDataView data,
         media::internal::StatusData* output) {}

// static
mojo::OptionalAsPointer<const media::internal::StatusData> StructTraits<
    media::stable::mojom::StatusDataView,
    media::DecoderStatus>::internal(const media::DecoderStatus& input) {}

// static
bool StructTraits<media::stable::mojom::StatusDataView, media::DecoderStatus>::
    Read(media::stable::mojom::StatusDataView data,
         media::DecoderStatus* output) {}

// static
media::VideoCodecProfile
StructTraits<media::stable::mojom::SupportedVideoDecoderConfigDataView,
             media::SupportedVideoDecoderConfig>::
    profile_min(const media::SupportedVideoDecoderConfig& input) {}

// static
media::VideoCodecProfile
StructTraits<media::stable::mojom::SupportedVideoDecoderConfigDataView,
             media::SupportedVideoDecoderConfig>::
    profile_max(const media::SupportedVideoDecoderConfig& input) {}

// static
const gfx::Size&
StructTraits<media::stable::mojom::SupportedVideoDecoderConfigDataView,
             media::SupportedVideoDecoderConfig>::
    coded_size_min(const media::SupportedVideoDecoderConfig& input) {}

// static
const gfx::Size&
StructTraits<media::stable::mojom::SupportedVideoDecoderConfigDataView,
             media::SupportedVideoDecoderConfig>::
    coded_size_max(const media::SupportedVideoDecoderConfig& input) {}

// static
bool StructTraits<media::stable::mojom::SupportedVideoDecoderConfigDataView,
                  media::SupportedVideoDecoderConfig>::
    allow_encrypted(const media::SupportedVideoDecoderConfig& input) {}

// static
bool StructTraits<media::stable::mojom::SupportedVideoDecoderConfigDataView,
                  media::SupportedVideoDecoderConfig>::
    require_encrypted(const media::SupportedVideoDecoderConfig& input) {}

// static
bool StructTraits<media::stable::mojom::SupportedVideoDecoderConfigDataView,
                  media::SupportedVideoDecoderConfig>::
    Read(media::stable::mojom::SupportedVideoDecoderConfigDataView input,
         media::SupportedVideoDecoderConfig* output) {}

// static
uint32_t StructTraits<
    media::stable::mojom::SubsampleEntryDataView,
    media::SubsampleEntry>::clear_bytes(const ::media::SubsampleEntry& input) {}

// static
uint32_t StructTraits<
    media::stable::mojom::SubsampleEntryDataView,
    media::SubsampleEntry>::cypher_bytes(const ::media::SubsampleEntry& input) {}

// static
bool StructTraits<media::stable::mojom::SubsampleEntryDataView,
                  media::SubsampleEntry>::
    Read(media::stable::mojom::SubsampleEntryDataView input,
         media::SubsampleEntry* output) {}

// static
media::VideoCodec StructTraits<
    media::stable::mojom::VideoDecoderConfigDataView,
    media::VideoDecoderConfig>::codec(const media::VideoDecoderConfig& input) {}

// static
media::VideoCodecProfile StructTraits<
    media::stable::mojom::VideoDecoderConfigDataView,
    media::VideoDecoderConfig>::profile(const media::VideoDecoderConfig&
                                            input) {}

// static
bool StructTraits<media::stable::mojom::VideoDecoderConfigDataView,
                  media::VideoDecoderConfig>::
    has_alpha(const media::VideoDecoderConfig& input) {}

// static
const gfx::Size& StructTraits<media::stable::mojom::VideoDecoderConfigDataView,
                              media::VideoDecoderConfig>::
    coded_size(const media::VideoDecoderConfig& input) {}

// static
const gfx::Rect& StructTraits<media::stable::mojom::VideoDecoderConfigDataView,
                              media::VideoDecoderConfig>::
    visible_rect(const media::VideoDecoderConfig& input) {}

// static
const gfx::Size& StructTraits<media::stable::mojom::VideoDecoderConfigDataView,
                              media::VideoDecoderConfig>::
    natural_size(const media::VideoDecoderConfig& input) {}

// static
const std::vector<uint8_t>& StructTraits<
    media::stable::mojom::VideoDecoderConfigDataView,
    media::VideoDecoderConfig>::extra_data(const media::VideoDecoderConfig&
                                               input) {}

// static
media::EncryptionScheme
StructTraits<media::stable::mojom::VideoDecoderConfigDataView,
             media::VideoDecoderConfig>::
    encryption_scheme(const media::VideoDecoderConfig& input) {}

// static
const gfx::ColorSpace
StructTraits<media::stable::mojom::VideoDecoderConfigDataView,
             media::VideoDecoderConfig>::
    color_space_info(const media::VideoDecoderConfig& input) {}

// static
const std::optional<gfx::HDRMetadata>& StructTraits<
    media::stable::mojom::VideoDecoderConfigDataView,
    media::VideoDecoderConfig>::hdr_metadata(const media::VideoDecoderConfig&
                                                 input) {}

// static
uint32_t StructTraits<
    media::stable::mojom::VideoDecoderConfigDataView,
    media::VideoDecoderConfig>::level(const media::VideoDecoderConfig& input) {}

// static
bool StructTraits<media::stable::mojom::VideoDecoderConfigDataView,
                  media::VideoDecoderConfig>::
    Read(media::stable::mojom::VideoDecoderConfigDataView input,
         media::VideoDecoderConfig* output) {}

// static
bool StructTraits<media::stable::mojom::VideoFrameMetadataDataView,
                  media::VideoFrameMetadata>::
    protected_video(const media::VideoFrameMetadata& input) {}

// static
bool StructTraits<media::stable::mojom::VideoFrameMetadataDataView,
                  media::VideoFrameMetadata>::
    hw_protected(const media::VideoFrameMetadata& input) {}

// static
bool StructTraits<media::stable::mojom::VideoFrameMetadataDataView,
                  media::VideoFrameMetadata>::
    needs_detiling(const media::VideoFrameMetadata& input) {}

// static
bool StructTraits<media::stable::mojom::VideoFrameMetadataDataView,
                  media::VideoFrameMetadata>::
    Read(media::stable::mojom::VideoFrameMetadataDataView input,
         media::VideoFrameMetadata* output) {}

}  // namespace mojo