1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef I_CAPTURER_STREAM_H 17 #define I_CAPTURER_STREAM_H 18 19 #include "i_stream.h" 20 #include "audio_info.h" 21 #include "audio_stream_info.h" 22 23 namespace OHOS { 24 namespace AudioStandard { 25 class IReadCallback { 26 public: 27 virtual int32_t OnReadData(size_t length) = 0; 28 }; 29 30 class ICapturerStream : public IStream { 31 public: 32 virtual ~ICapturerStream() = default; 33 virtual int32_t GetStreamFramesRead(uint64_t &framesRead) = 0; 34 virtual int32_t GetCurrentTimeStamp(uint64_t ×tamp) = 0; 35 virtual int32_t GetLatency(uint64_t &latency) = 0; 36 37 virtual void RegisterReadCallback(const std::weak_ptr<IReadCallback> &callback) = 0; 38 virtual int32_t GetMinimumBufferSize(size_t &minBufferSize) const = 0; 39 virtual void GetByteSizePerFrame(size_t &byteSizePerFrame) const = 0; 40 virtual void GetSpanSizePerFrame(size_t &spanSizeInFrame) const = 0; 41 virtual int32_t DropBuffer() = 0; 42 virtual void AbortCallback(int32_t abortTimes) = 0; 43 }; 44 } // namespace AudioStandard 45 } // namespace OHOS 46 #endif // I_CAPTURER_STREAM_H 47