anbox-platform-sdk 1.28.0
Anbox Platform SDK API documentation
audio_processor.h
Go to the documentation of this file.
1/*
2 * This file is part of Anbox Platform SDK
3 *
4 * Copyright 2021 Canonical Ltd.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef ANBOX_SDK_AUDIO_PROCESSOR_H_
20#define ANBOX_SDK_AUDIO_PROCESSOR_H_
21
23
24#include <stdint.h>
25#include <stddef.h>
26#include <unistd.h>
27#include <errno.h>
28
29namespace anbox {
35 public:
36 AudioProcessor() = default;
37 virtual ~AudioProcessor() = default;
38 AudioProcessor(const AudioProcessor &) = delete;
40
51 [[deprecated("Replaced by AudioProcessor::write_data")]]
52 virtual size_t process_data(const uint8_t* data, size_t size) = 0;
53
64 virtual ssize_t write_data(const uint8_t* data, size_t size) {
65 (void) data;
66 (void) size;
67 return -EIO;
68 }
69
80 virtual ssize_t read_data(uint8_t* data, size_t size) {
81 (void) data;
82 (void) size;
83 return -EIO;
84 }
85
97 virtual int standby(AnboxAudioStreamType type) {
98 (void) type;
99 return 0;
100 }
101
111 virtual int activate(AnboxAudioStreamType type) {
112 (void) type;
113 return 0;
114 }
115
127 virtual bool need_silence_on_standby() const {
128 return false;
129 }
130};
131} // namespace anbox
132
133#endif
AudioProcessor allows processing audio data from the Android container and perform audio processing l...
virtual ssize_t write_data(const uint8_t *data, size_t size)
Write a chunk of audio data.
virtual ~AudioProcessor()=default
AudioProcessor(const AudioProcessor &)=delete
virtual size_t process_data(const uint8_t *data, size_t size)=0
Process a chunk of audio data.
virtual ssize_t read_data(uint8_t *data, size_t size)
Read a chunk of audio data.
virtual bool need_silence_on_standby() const
Produce a silent audio stream on need while the audio output stream goes into the standby state.
virtual int activate(AnboxAudioStreamType type)
Notify the platform when an audio stream is in activation mode.
virtual int standby(AnboxAudioStreamType type)
Notify the platform when an audio stream is in standby mode.
AudioProcessor & operator=(const AudioProcessor &)=delete
AnboxAudioStreamType
AnboxAudioStreamType describes the audio stream type.
Definition types.h:174