• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_PROXY_H
17 #define OHOS_AVSESSION_PROXY_H
18 
19 #include "iav_session.h"
20 #include "iremote_proxy.h"
21 #include "want_agent.h"
22 #include "avsession_log.h"
23 #include "avsession_errors.h"
24 #include "avmeta_data.h"
25 #include "avplayback_state.h"
26 
27 namespace OHOS::AVSession {
28 class AVSessionProxy : public IRemoteProxy<IAVSession> {
29 public:
30     explicit AVSessionProxy(const sptr<IRemoteObject>& impl);
31 
32     ~AVSessionProxy() override;
33 
34     std::string GetSessionId() override;
35 
36     int32_t GetAVMetaData(AVMetaData& meta) override;
37 
38     int32_t SetAVMetaData(const AVMetaData& meta) override;
39 
40     int32_t GetAVPlaybackState(AVPlaybackState& state) override;
41 
42     int32_t SetAVPlaybackState(const AVPlaybackState& state) override;
43 
44     int32_t SetLaunchAbility(const AbilityRuntime::WantAgent::WantAgent& ability) override;
45 
46     std::shared_ptr<AVSessionController> GetController() override;
47 
48     int32_t RegisterCallback(const std::shared_ptr<AVSessionCallback>& callback) override;
49 
50     int32_t Activate() override;
51 
52     int32_t Deactivate() override;
53 
54     bool IsActive() override;
55 
56     int32_t Destroy() override;
57 
58     int32_t AddSupportCommand(const int32_t cmd) override;
59 
60     int32_t DeleteSupportCommand(const int32_t cmd) override;
61 
62 protected:
63     int32_t RegisterCallbackInner(const sptr<IAVSessionCallback>& callback) override;
64     sptr<IRemoteObject> GetControllerInner() override;
65 
66 private:
67     sptr<IAVSessionCallback> callback_;
68     static inline BrokerDelegator<AVSessionProxy> delegator_;
69     bool isDestroyed_ = {};
70     std::shared_ptr<AVSessionController> controller_;
71 };
72 }
73 #endif // OHOS_AVSESSION_PROXY_H