1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
media / mojo / mojom / encoded_audio_buffer_traits.h [blame]
// 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.
#ifndef MEDIA_MOJO_MOJOM_ENCODED_AUDIO_BUFFER_TRAITS_H_
#define MEDIA_MOJO_MOJOM_ENCODED_AUDIO_BUFFER_TRAITS_H_
#include "media/base/audio_encoder.h"
#include "media/base/ipc/media_param_traits.h"
#include "media/mojo/mojom/audio_encoder.mojom.h"
#include "media/mojo/mojom/media_types.mojom.h"
namespace mojo {
template <>
struct StructTraits<media::mojom::EncodedAudioBufferDataView,
media::EncodedAudioBuffer> {
static const base::span<const uint8_t> data(
const media::EncodedAudioBuffer& input) {
if (input.encoded_data.empty()) {
return base::span<const uint8_t>();
}
return input.encoded_data;
}
static const base::TimeDelta timestamp(
const media::EncodedAudioBuffer& input) {
return input.timestamp - base::TimeTicks();
}
static const base::TimeDelta duration(
const media::EncodedAudioBuffer& input) {
return input.duration;
}
static const media::AudioParameters params(
const media::EncodedAudioBuffer& input) {
return input.params;
}
static bool Read(media::mojom::EncodedAudioBufferDataView input,
media::EncodedAudioBuffer* output);
};
} // namespace mojo
#endif // MEDIA_MOJO_MOJOM_ENCODED_AUDIO_BUFFER_TRAITS_H_