blob: 51b7df800baa200b88427f04175bcd97565c69a6 [file] [log] [blame]
Mikhail Naganov10548292016-10-31 10:39:47 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_StreamOut_H_
18#define HIDL_GENERATED_android_hardware_audio_V2_0_StreamOut_H_
19
20#include <android/hardware/audio/2.0/IStreamOut.h>
21#include <hidl/Status.h>
22
23#include <hidl/MQDescriptor.h>
24
25#include "Stream.h"
26
27namespace android {
28namespace hardware {
29namespace audio {
30namespace V2_0 {
31namespace implementation {
32
33using ::android::hardware::audio::common::V2_0::AudioChannelMask;
34using ::android::hardware::audio::common::V2_0::AudioDevice;
35using ::android::hardware::audio::common::V2_0::AudioFormat;
36using ::android::hardware::audio::V2_0::AudioDrain;
37using ::android::hardware::audio::V2_0::DeviceAddress;
38using ::android::hardware::audio::V2_0::IStream;
39using ::android::hardware::audio::V2_0::IStreamOut;
40using ::android::hardware::audio::V2_0::IStreamOutCallback;
41using ::android::hardware::audio::V2_0::ParameterValue;
42using ::android::hardware::audio::V2_0::Result;
43using ::android::hardware::audio::V2_0::TimeSpec;
44using ::android::hardware::Return;
45using ::android::hardware::Void;
46using ::android::hardware::hidl_vec;
47using ::android::hardware::hidl_string;
48using ::android::sp;
49
50struct StreamOut : public IStreamOut {
51 StreamOut(audio_hw_device_t* device, audio_stream_out_t* stream);
52
53 // Methods from ::android::hardware::audio::V2_0::IStream follow.
54 Return<uint64_t> getFrameSize() override;
55 Return<uint64_t> getFrameCount() override;
56 Return<uint64_t> getBufferSize() override;
57 Return<uint32_t> getSampleRate() override;
58 Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
59 Return<Result> setSampleRate(uint32_t sampleRateHz) override;
60 Return<AudioChannelMask> getChannelMask() override;
61 Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
62 Return<Result> setChannelMask(AudioChannelMask mask) override;
63 Return<AudioFormat> getFormat() override;
64 Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override;
65 Return<Result> setFormat(AudioFormat format) override;
66 Return<void> getAudioProperties(getAudioProperties_cb _hidl_cb) override;
67 Return<Result> addEffect(uint64_t effectId) override;
68 Return<Result> removeEffect(uint64_t effectId) override;
69 Return<Result> standby() override;
70 Return<AudioDevice> getDevice() override;
71 Return<Result> setDevice(const DeviceAddress& address) override;
72 Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
73 Return<Result> setHwAvSync(uint32_t hwAvSync) override;
74 Return<void> getParameters(
75 const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) override;
76 Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
77 Return<void> debugDump(const native_handle_t* fd) override;
78
79 // Methods from ::android::hardware::audio::V2_0::IStreamOut follow.
80 Return<uint32_t> getLatency() override;
81 Return<Result> setVolume(float left, float right) override;
82 Return<void> write(const hidl_vec<uint8_t>& data, write_cb _hidl_cb) override;
83 Return<void> getRenderPosition(getRenderPosition_cb _hidl_cb) override;
84 Return<void> getNextWriteTimestamp(getNextWriteTimestamp_cb _hidl_cb) override;
85 Return<Result> setCallback(const sp<IStreamOutCallback>& callback) override;
86 Return<void> supportsPauseAndResume(supportsPauseAndResume_cb _hidl_cb) override;
87 Return<Result> pause() override;
88 Return<Result> resume() override;
89 Return<bool> supportsDrain() override;
90 Return<Result> drain(AudioDrain type) override;
91 Return<Result> flush() override;
92 Return<void> getPresentationPosition(getPresentationPosition_cb _hidl_cb) override;
93
94 private:
95 audio_hw_device_t *mDevice;
96 audio_stream_out_t *mStream;
97 sp<Stream> mStreamCommon;
98 // Do not store sp<> to avoid creating a reference loop if the entity that holds
99 // onto the output stream owns or implements the callback.
100 wp<IStreamOutCallback> mCallback;
101
102 virtual ~StreamOut();
103
104 static int asyncCallback(stream_callback_event_t event, void *param, void *cookie);
105};
106
107} // namespace implementation
108} // namespace V2_0
109} // namespace audio
110} // namespace hardware
111} // namespace android
112
113#endif // HIDL_GENERATED_android_hardware_audio_V2_0_StreamOut_H_