blob: 9bca2d4b50da3f26a16638a77cc9f8b97e8c3d11 [file] [log] [blame]
Glenn Kastenf91df1b2014-03-13 14:59:31 -07001/*
2 * Copyright (C) 2014 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 ANDROID_AUDIO_FAST_CAPTURE_STATE_H
18#define ANDROID_AUDIO_FAST_CAPTURE_STATE_H
19
20#include <media/nbaio/NBAIO.h>
21#include "FastThreadState.h"
22#include <private/media/AudioTrackShared.h>
23
24namespace android {
25
26// Represent a single state of the fast capture
27struct FastCaptureState : FastThreadState {
28 FastCaptureState();
29 /*virtual*/ ~FastCaptureState();
30
31 // all pointer fields use raw pointers; objects are owned and ref-counted by RecordThread
Glenn Kastene4a7ce22015-03-03 11:23:17 -080032 NBAIO_Source* mInputSource; // HAL input device, must already be negotiated
Glenn Kastenf91df1b2014-03-13 14:59:31 -070033 // FIXME by renaming, could pull up these fields to FastThreadState
34 int mInputSourceGen; // increment when mInputSource is assigned
Glenn Kastene4a7ce22015-03-03 11:23:17 -080035 NBAIO_Sink* mPipeSink; // after reading from input source, write to this pipe sink
Glenn Kastenf91df1b2014-03-13 14:59:31 -070036 int mPipeSinkGen; // increment when mPipeSink is assigned
37 size_t mFrameCount; // number of frames per fast capture buffer
Glenn Kastene4a7ce22015-03-03 11:23:17 -080038 audio_track_cblk_t* mCblk; // control block for the single fast client, or NULL
Glenn Kastenf91df1b2014-03-13 14:59:31 -070039
40 // Extends FastThreadState::Command
41 static const Command
42 // The following commands also process configuration changes, and can be "or"ed:
Glenn Kastene4a7ce22015-03-03 11:23:17 -080043 READ = 0x8, // read from input source
44 WRITE = 0x10, // write to pipe sink
45 READ_WRITE = 0x18; // read from input source and write to pipe sink
Glenn Kastenf91df1b2014-03-13 14:59:31 -070046
Glenn Kastend702a562015-03-02 15:51:38 -080047 // never returns NULL; asserts if command is invalid
48 static const char *commandToString(Command command);
Glenn Kastenf91df1b2014-03-13 14:59:31 -070049}; // struct FastCaptureState
50
51} // namespace android
52
53#endif // ANDROID_AUDIO_FAST_CAPTURE_STATE_H