blob: e2a9c15825bd3a1b8d38db79c70d20002e03d334 [file] [log] [blame]
Phil Burk828bea52017-01-03 17:22:09 -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_IOBOEAUDIOSERVICE_H
18#define BINDING_IOBOEAUDIOSERVICE_H
19
20#include <stdint.h>
21#include <utils/RefBase.h>
22#include <binder/TextOutput.h>
23#include <binder/IInterface.h>
24
25#include <oboe/OboeAudio.h>
26
27#include "binding/OboeServiceDefinitions.h"
28#include "binding/AudioEndpointParcelable.h"
29#include "binding/OboeStreamRequest.h"
30#include "binding/OboeStreamConfiguration.h"
31
Phil Burk828bea52017-01-03 17:22:09 -080032
33namespace android {
34
35// Interface (our AIDL) - Shared by server and client
36class IOboeAudioService : public IInterface {
37public:
38
39 DECLARE_META_INTERFACE(OboeAudioService);
40
Phil Burkdec33ab2017-01-17 14:48:16 -080041 virtual oboe_handle_t openStream(oboe::OboeStreamRequest &request,
42 oboe::OboeStreamConfiguration &configuration) = 0;
Phil Burk828bea52017-01-03 17:22:09 -080043
Phil Burkdec33ab2017-01-17 14:48:16 -080044 virtual oboe_result_t closeStream(oboe_handle_t streamHandle) = 0;
Phil Burk828bea52017-01-03 17:22:09 -080045
46 /* Get an immutable description of the in-memory queues
47 * used to communicate with the underlying HAL or Service.
48 */
49 virtual oboe_result_t getStreamDescription(oboe_handle_t streamHandle,
Phil Burkdec33ab2017-01-17 14:48:16 -080050 oboe::AudioEndpointParcelable &parcelable) = 0;
Phil Burk828bea52017-01-03 17:22:09 -080051
52 /**
53 * Start the flow of data.
54 */
55 virtual oboe_result_t startStream(oboe_handle_t streamHandle) = 0;
56
57 /**
58 * Stop the flow of data such that start() can resume without loss of data.
59 */
60 virtual oboe_result_t pauseStream(oboe_handle_t streamHandle) = 0;
61
62 /**
63 * Discard any data held by the underlying HAL or Service.
64 */
65 virtual oboe_result_t flushStream(oboe_handle_t streamHandle) = 0;
66
67 /**
68 * Manage the specified thread as a low latency audio thread.
69 */
70 virtual oboe_result_t registerAudioThread(oboe_handle_t streamHandle, pid_t clientThreadId,
71 oboe_nanoseconds_t periodNanoseconds) = 0;
72
73 virtual oboe_result_t unregisterAudioThread(oboe_handle_t streamHandle,
74 pid_t clientThreadId) = 0;
Phil Burk828bea52017-01-03 17:22:09 -080075};
76
77class BnOboeAudioService : public BnInterface<IOboeAudioService> {
78public:
79 virtual status_t onTransact(uint32_t code, const Parcel& data,
80 Parcel* reply, uint32_t flags = 0);
81
82};
83
84} /* namespace android */
85
86#endif //BINDING_IOBOEAUDIOSERVICE_H