1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_MOJO_MOJOM_AUDIO_DECODER_CONFIG_MOJOM_TRAITS_H_
6 #define MEDIA_MOJO_MOJOM_AUDIO_DECODER_CONFIG_MOJOM_TRAITS_H_
8 #include "media/base/audio_decoder_config.h"
9 #include "media/base/ipc/media_param_traits.h"
10 #include "media/mojo/mojom/media_types.mojom.h"
15 struct StructTraits<media::mojom::AudioDecoderConfigDataView,
16 media::AudioDecoderConfig> {
17 static media::AudioCodec codec(const media::AudioDecoderConfig& input) {
21 static media::SampleFormat sample_format(
22 const media::AudioDecoderConfig& input) {
23 return input.sample_format();
26 static media::ChannelLayout channel_layout(
27 const media::AudioDecoderConfig& input) {
28 return input.channel_layout();
31 static int samples_per_second(const media::AudioDecoderConfig& input) {
32 return input.samples_per_second();
35 static const std::vector<uint8_t>& extra_data(
36 const media::AudioDecoderConfig& input) {
37 return input.extra_data();
40 static media::EncryptionScheme encryption_scheme(
41 const media::AudioDecoderConfig& input) {
42 return input.encryption_scheme();
45 static base::TimeDelta seek_preroll(const media::AudioDecoderConfig& input) {
46 return input.seek_preroll();
49 static int codec_delay(const media::AudioDecoderConfig& input) {
50 return input.codec_delay();
53 static media::AudioCodecProfile profile(
54 const media::AudioDecoderConfig& input) {
55 return input.profile();
58 static media::ChannelLayout target_output_channel_layout(
59 const media::AudioDecoderConfig& input) {
60 return input.target_output_channel_layout();
63 static media::SampleFormat target_output_sample_format(
64 const media::AudioDecoderConfig& input) {
65 return input.target_output_sample_format();
68 static bool should_discard_decoder_delay(
69 const media::AudioDecoderConfig& input) {
70 return input.should_discard_decoder_delay();
73 static const std::vector<uint8_t>& aac_extra_data(
74 const media::AudioDecoderConfig& input) {
75 return input.aac_extra_data();
78 static bool Read(media::mojom::AudioDecoderConfigDataView input,
79 media::AudioDecoderConfig* output);
84 #endif // MEDIA_MOJO_MOJOM_AUDIO_DECODER_CONFIG_MOJOM_TRAITS_H_