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_STREAM_MANAGER_H 17 #define I_STREAM_MANAGER_H 18 19 #include "i_renderer_stream.h" 20 #include "i_capturer_stream.h" 21 22 namespace OHOS { 23 namespace AudioStandard { 24 enum ManagerType : int32_t { 25 PLAYBACK = 0, 26 DUP_PLAYBACK, 27 DUAL_PLAYBACK, 28 DIRECT_PLAYBACK, 29 VOIP_PLAYBACK, 30 RECORDER, 31 }; 32 33 class IStreamManager { 34 public: 35 ~IStreamManager() = default; 36 37 static IStreamManager &GetPlaybackManager(ManagerType managerType = PLAYBACK); 38 static IStreamManager &GetRecorderManager(); 39 static IStreamManager &GetDupPlaybackManager(); 40 static IStreamManager &GetDualPlaybackManager(); 41 42 virtual int32_t CreateRender(AudioProcessConfig processConfig, std::shared_ptr<IRendererStream> &stream) = 0; 43 virtual int32_t ReleaseRender(uint32_t streamIndex_) = 0; 44 virtual int32_t StartRender(uint32_t streamIndex) = 0; 45 virtual int32_t StopRender(uint32_t streamIndex) = 0; 46 virtual int32_t PauseRender(uint32_t streamIndex) = 0; 47 virtual int32_t TriggerStartIfNecessary() = 0; 48 virtual int32_t GetStreamCount() const noexcept = 0; 49 virtual int32_t CreateCapturer(AudioProcessConfig processConfig, std::shared_ptr<ICapturerStream> &stream) = 0; 50 virtual int32_t ReleaseCapturer(uint32_t streamIndex_) = 0; 51 }; 52 } // namespace AudioStandard 53 } // namespace OHOS 54 #endif // I_STREAM_MANAGER_H 55