blob: f3b297eac425a03b0746fdc19c684e05042a1357 [file] [log] [blame]
Phil Burk5ed503c2017-02-01 09:38:15 -08001/*
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 BINDING_IAAUDIOSERVICE_H
18#define BINDING_IAAUDIOSERVICE_H
19
20#include <stdint.h>
21#include <utils/RefBase.h>
22#include <binder/TextOutput.h>
23#include <binder/IInterface.h>
24
25#include <aaudio/AAudio.h>
26
27#include "binding/AAudioServiceDefinitions.h"
28#include "binding/AudioEndpointParcelable.h"
29#include "binding/AAudioStreamRequest.h"
30#include "binding/AAudioStreamConfiguration.h"
31
32
33namespace android {
34
35// Interface (our AIDL) - Shared by server and client
36class IAAudioService : public IInterface {
37public:
38
39 DECLARE_META_INTERFACE(AAudioService);
40
Phil Burk3df348f2017-02-08 11:41:55 -080041 /**
42 * @param request info needed to create the stream
43 * @param configuration contains information about the created stream
44 * @return handle to the stream or a negative error
45 */
Phil Burk5ed503c2017-02-01 09:38:15 -080046 virtual aaudio_handle_t openStream(aaudio::AAudioStreamRequest &request,
47 aaudio::AAudioStreamConfiguration &configuration) = 0;
48
49 virtual aaudio_result_t closeStream(aaudio_handle_t streamHandle) = 0;
50
51 /* Get an immutable description of the in-memory queues
52 * used to communicate with the underlying HAL or Service.
53 */
54 virtual aaudio_result_t getStreamDescription(aaudio_handle_t streamHandle,
55 aaudio::AudioEndpointParcelable &parcelable) = 0;
56
57 /**
58 * Start the flow of data.
59 */
60 virtual aaudio_result_t startStream(aaudio_handle_t streamHandle) = 0;
61
62 /**
63 * Stop the flow of data such that start() can resume without loss of data.
64 */
65 virtual aaudio_result_t pauseStream(aaudio_handle_t streamHandle) = 0;
66
67 /**
68 * Discard any data held by the underlying HAL or Service.
69 */
70 virtual aaudio_result_t flushStream(aaudio_handle_t streamHandle) = 0;
71
72 /**
73 * Manage the specified thread as a low latency audio thread.
74 */
75 virtual aaudio_result_t registerAudioThread(aaudio_handle_t streamHandle, pid_t clientThreadId,
76 aaudio_nanoseconds_t periodNanoseconds) = 0;
77
78 virtual aaudio_result_t unregisterAudioThread(aaudio_handle_t streamHandle,
79 pid_t clientThreadId) = 0;
80};
81
82class BnAAudioService : public BnInterface<IAAudioService> {
83public:
84 virtual status_t onTransact(uint32_t code, const Parcel& data,
85 Parcel* reply, uint32_t flags = 0);
86
87};
88
89} /* namespace android */
90
91#endif //BINDING_IAAUDIOSERVICE_H