1 /* 2 * Copyright 2017 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 AUDIO_INPUT_STREAM_OPENSL_ES_H_ 18 #define AUDIO_INPUT_STREAM_OPENSL_ES_H_ 19 20 21 #include "oboe/Oboe.h" 22 #include "EngineOpenSLES.h" 23 #include "AudioStreamOpenSLES.h" 24 25 namespace oboe { 26 27 /** 28 * INTERNAL USE ONLY 29 */ 30 31 class AudioInputStreamOpenSLES : public AudioStreamOpenSLES { 32 public: 33 AudioInputStreamOpenSLES(); 34 explicit AudioInputStreamOpenSLES(const AudioStreamBuilder &builder); 35 36 virtual ~AudioInputStreamOpenSLES(); 37 38 Result open() override; 39 Result close() override; 40 41 Result requestStart() override; 42 Result requestPause() override; 43 Result requestFlush() override; 44 Result requestStop() override; 45 46 protected: 47 Result requestStop_l(); 48 49 Result updateServiceFrameCounter() override; 50 51 void updateFramesWritten() override; 52 53 private: 54 55 SLuint32 channelCountToChannelMask(int chanCount) const; 56 57 Result setRecordState_l(SLuint32 newState); 58 59 SLRecordItf mRecordInterface = nullptr; 60 }; 61 62 } // namespace oboe 63 64 #endif //AUDIO_INPUT_STREAM_OPENSL_ES_H_ 65