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_H 17 #define OHOS_AVSESSION_H 18 19 #include <string> 20 #include <memory> 21 22 #include "avsession_info.h" 23 #include "want_agent.h" 24 #include "avsession_controller.h" 25 26 namespace OHOS::AVSession { 27 class AVSession { 28 public: 29 enum { 30 SESSION_TYPE_INVALID = -1, 31 SESSION_TYPE_AUDIO = 0, 32 SESSION_TYPE_VIDEO = 1 33 }; 34 35 virtual std::string GetSessionId() = 0; 36 37 virtual int32_t GetAVMetaData(AVMetaData& meta) = 0; 38 39 virtual int32_t SetAVMetaData(const AVMetaData& meta) = 0; 40 41 virtual int32_t GetAVPlaybackState(AVPlaybackState& state) = 0; 42 43 virtual int32_t SetAVPlaybackState(const AVPlaybackState& state) = 0; 44 45 virtual int32_t SetLaunchAbility(const AbilityRuntime::WantAgent::WantAgent& ability) = 0; 46 47 virtual std::shared_ptr<AVSessionController> GetController() = 0; 48 49 virtual int32_t RegisterCallback(const std::shared_ptr<AVSessionCallback>& callback) = 0; 50 51 virtual int32_t Activate() = 0; 52 53 virtual int32_t Deactivate() = 0; 54 55 virtual bool IsActive() = 0; 56 57 virtual int32_t Destroy() = 0; 58 59 virtual int32_t AddSupportCommand(const int32_t cmd) = 0; 60 61 virtual int32_t DeleteSupportCommand(const int32_t cmd) = 0; 62 63 virtual ~AVSession() = default; 64 }; 65 } // namespace OHOS::AVSession 66 #endif // OHOS_AVSESSION_H