1 /* 2 * Copyright (c) 2022 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 OHOS_AVSESSION_MANAGER_H 17 #define OHOS_AVSESSION_MANAGER_H 18 19 #include <functional> 20 #include <string> 21 #include <memory> 22 23 #include "audio_system_manager.h" 24 #include "av_session.h" 25 #include "avsession_controller.h" 26 #include "avsession_info.h" 27 #include "key_event.h" 28 29 namespace OHOS::AVSession { 30 class AVSessionManager { 31 public: 32 static AVSessionManager& GetInstance(); 33 34 virtual std::shared_ptr<AVSession> CreateSession(const std::string& tag, int32_t type, 35 const AppExecFwk::ElementName& elementName) = 0; 36 37 virtual int32_t GetAllSessionDescriptors(std::vector<AVSessionDescriptor>& descriptors) = 0; 38 39 virtual int32_t GetActivatedSessionDescriptors(std::vector<AVSessionDescriptor>& activatedSessions) = 0; 40 41 virtual int32_t GetSessionDescriptorsBySessionId(const std::string& sessionId, AVSessionDescriptor& descriptor) = 0; 42 43 virtual int32_t CreateController(const std::string& sessionId, 44 std::shared_ptr<AVSessionController>& controller) = 0; 45 46 virtual int32_t RegisterSessionListener(const std::shared_ptr<SessionListener>& listener) = 0; 47 48 virtual int32_t RegisterServiceDeathCallback(const DeathCallback& callback) = 0; 49 50 virtual int32_t UnregisterServiceDeathCallback() = 0; 51 52 virtual int32_t SendSystemAVKeyEvent(const MMI::KeyEvent& keyEvent) = 0; 53 54 virtual int32_t SendSystemControlCommand(const AVControlCommand& command) = 0; 55 56 virtual int32_t CastAudio(const SessionToken& token, 57 const std::vector<AudioStandard::AudioDeviceDescriptor>& descriptors) = 0; 58 59 virtual int32_t CastAudioForAll(const std::vector<AudioStandard::AudioDeviceDescriptor>& descriptors) = 0; 60 }; 61 } // namespace OHOS::AVSession 62 #endif // OHOS_AVSESSION_MANAGER_H