blob: ad00fe2572bfb26f6e80100c45d7a0ba7e8cd800 [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_OBOESERVICEDEFINITIONS_H
18#define BINDING_OBOESERVICEDEFINITIONS_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
27using android::NO_ERROR;
28using android::IBinder;
29
Phil Burk204a1632017-01-03 17:23:43 -080030namespace android {
31
32enum oboe_commands_t {
33 OPEN_STREAM = IBinder::FIRST_CALL_TRANSACTION,
34 CLOSE_STREAM,
35 GET_STREAM_DESCRIPTION,
36 START_STREAM,
37 PAUSE_STREAM,
38 FLUSH_STREAM,
39 REGISTER_AUDIO_THREAD,
40 UNREGISTER_AUDIO_THREAD,
41 TICKLE
42};
43
44} // namespace android
45
Phil Burk828bea52017-01-03 17:22:09 -080046namespace oboe {
47
48enum oboe_commands_t {
49 OPEN_STREAM = IBinder::FIRST_CALL_TRANSACTION,
50 CLOSE_STREAM,
51 GET_STREAM_DESCRIPTION,
52 START_STREAM,
53 PAUSE_STREAM,
54 FLUSH_STREAM,
55 REGISTER_AUDIO_THREAD,
56 UNREGISTER_AUDIO_THREAD,
57 TICKLE
58};
59
60// TODO Expand this to include all the open parameters.
61typedef struct OboeServiceStreamInfo_s {
62 int32_t deviceId;
63 int32_t samplesPerFrame; // number of channels
64 oboe_sample_rate_t sampleRate;
65 oboe_audio_format_t audioFormat;
66} OboeServiceStreamInfo;
67
68// This must be a fixed width so it can be in shared memory.
69enum RingbufferFlags : uint32_t {
70 NONE = 0,
71 RATE_ISOCHRONOUS = 0x0001,
72 RATE_ASYNCHRONOUS = 0x0002,
73 COHERENCY_DMA = 0x0004,
74 COHERENCY_ACQUIRE_RELEASE = 0x0008,
75 COHERENCY_AUTO = 0x0010,
76};
77
78// This is not passed through Binder.
79// Client side code will convert Binder data and fill this descriptor.
80typedef struct RingBufferDescriptor_s {
81 uint8_t* dataAddress; // offset from read or write block
82 int64_t* writeCounterAddress;
83 int64_t* readCounterAddress;
84 int32_t bytesPerFrame; // index is in frames
85 int32_t framesPerBurst; // for ISOCHRONOUS queues
86 int32_t capacityInFrames; // zero if unused
87 RingbufferFlags flags;
88} RingBufferDescriptor;
89
90// This is not passed through Binder.
91// Client side code will convert Binder data and fill this descriptor.
92typedef struct EndpointDescriptor_s {
93 // Set capacityInFrames to zero if Queue is unused.
94 RingBufferDescriptor upMessageQueueDescriptor; // server to client
95 RingBufferDescriptor downMessageQueueDescriptor; // client to server
96 RingBufferDescriptor upDataQueueDescriptor; // eg. record
97 RingBufferDescriptor downDataQueueDescriptor; // eg. playback
98} EndpointDescriptor;
99
100} // namespace oboe
101
102#endif //BINDING_OBOESERVICEDEFINITIONS_H