| // Copyright 2021 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. |
| |
| #ifndef MEDIA_MOJO_MOJOM_CDM_CAPABILITY_MOJOM_TRAITS_H_ |
| #define MEDIA_MOJO_MOJOM_CDM_CAPABILITY_MOJOM_TRAITS_H_ |
| |
| #include <vector> |
| |
| #include "base/containers/flat_set.h" |
| #include "media/base/audio_codecs.h" |
| #include "media/base/content_decryption_module.h" |
| #include "media/base/encryption_scheme.h" |
| #include "media/base/video_codecs.h" |
| #include "media/cdm/cdm_capability.h" |
| #include "media/mojo/mojom/key_system_support.mojom.h" |
| |
| namespace mojo { |
| |
| template <> |
| struct StructTraits<media::mojom::CdmCapabilityDataView, media::CdmCapability> { |
| static const std::vector<media::AudioCodec>& audio_codecs( |
| const media::CdmCapability& input) { |
| return input.audio_codecs; |
| } |
| |
| static const media::CdmCapability::VideoCodecMap& video_codecs( |
| const media::CdmCapability& input) { |
| return input.video_codecs; |
| } |
| |
| // List of encryption schemes supported by the CDM (e.g. cenc). |
| static const base::flat_set<media::EncryptionScheme>& encryption_schemes( |
| const media::CdmCapability& input) { |
| return input.encryption_schemes; |
| } |
| |
| // List of session types supported by the CDM. |
| static const base::flat_set<media::CdmSessionType>& session_types( |
| const media::CdmCapability& input) { |
| return input.session_types; |
| } |
| |
| static bool Read(media::mojom::CdmCapabilityDataView input, |
| media::CdmCapability* output); |
| }; |
| |
| } // namespace mojo |
| |
| #endif // MEDIA_MOJO_MOJOM_CDM_CAPABILITY_MOJOM_TRAITS_H_ |