chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.h

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

#ifndef MEDIA_MOJO_MOJOM_VIDEO_ENCODE_ACCELERATOR_MOJOM_TRAITS_H_
#define MEDIA_MOJO_MOJOM_VIDEO_ENCODE_ACCELERATOR_MOJOM_TRAITS_H_

#include "base/notreached.h"
#include "media/base/bitrate.h"
#include "media/base/ipc/media_param_traits.h"
#include "media/base/video_bitrate_allocation.h"
#include "media/base/video_encoder.h"
#include "media/mojo/mojom/media_types.mojom-shared.h"
#include "media/mojo/mojom/video_encode_accelerator.mojom-shared.h"
#include "media/video/video_encode_accelerator.h"
#include "mojo/public/cpp/bindings/union_traits.h"
#include "ui/gfx/geometry/mojom/geometry_mojom_traits.h"

namespace mojo {
template <>
struct EnumTraits<media::mojom::VideoEncodeAcceleratorSupportedRateControlMode,
                  media::VideoEncodeAccelerator::SupportedRateControlMode> {};

template <>
struct StructTraits<
    media::mojom::VideoEncodeAcceleratorSupportedProfileDataView,
    media::VideoEncodeAccelerator::SupportedProfile> {};

template <>
class StructTraits<media::mojom::VariableBitratePeakDataView, uint32_t> {};

template <>
class StructTraits<media::mojom::VideoBitrateAllocationDataView,
                   media::VideoBitrateAllocation> {};

template <>
class StructTraits<media::mojom::VideoEncodeOptionsDataView,
                   media::VideoEncoder::EncodeOptions> {};

template <>
struct UnionTraits<media::mojom::OptionalMetadataDataView,
                   media::BitstreamBufferMetadata> {};

template <>
class StructTraits<media::mojom::BitstreamBufferMetadataDataView,
                   media::BitstreamBufferMetadata> {};

template <>
class StructTraits<media::mojom::DropFrameMetadataDataView,
                   media::DropFrameMetadata> {};
template <>
class StructTraits<media::mojom::H264MetadataDataView, media::H264Metadata> {};

template <>
class StructTraits<media::mojom::H265MetadataDataView, media::H265Metadata> {};

template <>
class StructTraits<media::mojom::Vp8MetadataDataView, media::Vp8Metadata> {};

template <>
class StructTraits<media::mojom::Vp9MetadataDataView, media::Vp9Metadata> {};

template <>
class StructTraits<media::mojom::Av1MetadataDataView, media::Av1Metadata> {};

template <>
struct EnumTraits<media::mojom::VideoEncodeAcceleratorConfig_StorageType,
                  media::VideoEncodeAccelerator::Config::StorageType> {};

template <>
struct EnumTraits<media::mojom::VideoEncodeAcceleratorConfig_EncoderType,
                  media::VideoEncodeAccelerator::Config::EncoderType> {};

template <>
struct EnumTraits<media::mojom::VideoEncodeAcceleratorConfig_ContentType,
                  media::VideoEncodeAccelerator::Config::ContentType> {};

template <>
struct StructTraits<media::mojom::SpatialLayerDataView,
                    media::VideoEncodeAccelerator::Config::SpatialLayer> {};

template <>
struct StructTraits<media::mojom::ConstantBitrateDataView, media::Bitrate> {};

template <>
struct StructTraits<media::mojom::VariableBitrateDataView, media::Bitrate> {};

template <>
struct StructTraits<media::mojom::ExternalBitrateDataView, media::Bitrate> {};

template <>
struct UnionTraits<media::mojom::BitrateDataView, media::Bitrate> {};

template <>
struct StructTraits<media::mojom::VideoEncodeAcceleratorConfigDataView,
                    media::VideoEncodeAccelerator::Config> {};

}  // namespace mojo

#endif  // MEDIA_MOJO_MOJOM_VIDEO_ENCODE_ACCELERATOR_MOJOM_TRAITS_H_