• 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 OHOS_DRM_MEDIA_KEY_SYSTEMP_FACTORY_IMPL_H
17 #define OHOS_DRM_MEDIA_KEY_SYSTEMP_FACTORY_IMPL_H
18 
19 #include "media_key_system_impl.h"
20 #include "system_ability_definition.h"
21 #include "ipc_skeleton.h"
22 #include "iservice_registry.h"
23 #include "nocopyable.h"
24 #include "i_mediakeysystemfactory_service.h"
25 #include "drm_death_recipient.h"
26 #include "drm_log.h"
27 
28 namespace OHOS {
29 namespace DrmStandard {
30 class MediaKeySystemFactoryImpl : public RefBase {
31 public:
32     MediaKeySystemFactoryImpl();
33     ~MediaKeySystemFactoryImpl();
34     void Init();
35     static sptr<MediaKeySystemFactoryImpl> &GetInstance();
36     bool IsMediaKeySystemSupported(std::string &uuid);
37     bool IsMediaKeySystemSupported(std::string &uuid, std::string &mimeType);
38     bool IsMediaKeySystemSupported(std::string &uuid, std::string &mimeType,
39         IMediaKeySessionService::ContentProtectionLevel securityLevel);
40     int32_t CreateMediaKeySystem(std::string &uuid, sptr<MediaKeySystemImpl> *mediaKeySystemImpl);
41     int32_t keySystemNumber = 0;
42 
43 private:
44     void MediaKeySystemServerDied(pid_t pid);
45     std::mutex mutex_;
46     static sptr<MediaKeySystemFactoryImpl> mediaKeySystemFactoryImpl_;
47     sptr<OHOS::DrmStandard::IMediaKeySystemFactoryService> serviceProxy_;
48     sptr<DrmDeathRecipient> deathRecipient_;
49 };
50 } // DrmStandard
51 } // OHOS
52 #endif // OHOS_DRM_MEDIA_KEY_SYSTEMP_FACTORY_IMPL_H