• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 AVCODEC_SERVER_H
17 #define AVCODEC_SERVER_H
18 
19 #include "avcodec_server_manager.h"
20 #include "avcodec_service_stub.h"
21 #include "nocopyable.h"
22 #include "system_ability.h"
23 
24 
25 namespace OHOS {
26 namespace MediaAVCodec {
27 class AVCodecServer : public SystemAbility, public AVCodecServiceStub {
28     DECLARE_SYSTEM_ABILITY(AVCodecServer);
29 public:
30     explicit AVCodecServer(int32_t systemAbilityId, bool runOnCreate = true);
31     ~AVCodecServer();
32 
33     // IStandardAVCodecService override
34     int32_t GetSubSystemAbility(IStandardAVCodecService::AVCodecSystemAbility subSystemId,
35                                 const sptr<IRemoteObject> &listener, sptr<IRemoteObject> &stubObject) override;
36 
37 protected:
38     // SystemAbility override
39     void OnDump() override;
40     void OnStart() override;
41     int32_t OnIdle(const SystemAbilityOnDemandReason& idleReason) override;
42     void OnStop() override;
43     std::optional<AVCodecServerManager::StubType> SwitchSystemId(
44         IStandardAVCodecService::AVCodecSystemAbility subSystemId);
45     int32_t Dump(int32_t fd, const std::vector<std::u16string> &args) override;
46 
47 private:
48     void OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) override;
49 
50     std::mutex stateMutex_;
51 };
52 } // namespace MediaAVCodec
53 } // namespace OHOS
54 #endif // AVCODEC_SERVER_H