1 /*
2  * Copyright (C) 2021 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 #include "media_local.h"
17 #include "media_errors.h"
18 #include "media_log.h"
19 #include "avcodec_server.h"
20 #include "avmetadatahelper_server.h"
21 #include "player_server.h"
22 #include "recorder_server.h"
23 #include "avcodeclist_server.h"
24 #include "recorder_profiles_server.h"
25 #include "screen_capture_server.h"
26 
27 namespace OHOS {
28 namespace Media {
GetInstance()29 IMediaService &MediaServiceFactory::GetInstance()
30 {
31     static MediaLocal instance;
32     return instance;
33 }
34 
GetMonitorProxy()35 sptr<IStandardMonitorService> MediaLocal::GetMonitorProxy()
36 {
37     return MonitorServiceStub::GetInstance();
38 }
39 
CreateRecorderService()40 std::shared_ptr<IRecorderService> MediaLocal::CreateRecorderService()
41 {
42     return RecorderServer::Create();
43 }
44 
CreateTransCoderService()45 std::shared_ptr<ITransCoderService> MediaLocal::CreateTransCoderService()
46 {
47     return TransCoderServer::Create();
48 }
49 
CreatePlayerService()50 std::shared_ptr<IPlayerService> MediaLocal::CreatePlayerService()
51 {
52     return PlayerServer::Create();
53 }
54 
CreateAVMetadataHelperService()55 std::shared_ptr<IAVMetadataHelperService> MediaLocal::CreateAVMetadataHelperService()
56 {
57     return AVMetadataHelperServer::Create();
58 }
59 
CreateAVCodecService()60 std::shared_ptr<IAVCodecService> MediaLocal::CreateAVCodecService()
61 {
62     return AVCodecServer::Create();
63 }
64 
CreateAVCodecListService()65 std::shared_ptr<IAVCodecListService> MediaLocal::CreateAVCodecListService()
66 {
67     return AVCodecListServer::Create();
68 }
69 
CreateRecorderProfilesService()70 std::shared_ptr<IRecorderProfilesService> MediaLocal::CreateRecorderProfilesService()
71 {
72     return RecorderProfilesServer::Create();
73 }
74 
CreateScreenCaptureService()75 std::shared_ptr<IScreenCaptureService> MediaLocal::CreateScreenCaptureService()
76 {
77     return ScreenCaptureServer::Create();
78 }
79 
DestroyRecorderService(std::shared_ptr<IRecorderService> recorder)80 int32_t MediaLocal::DestroyRecorderService(std::shared_ptr<IRecorderService> recorder)
81 {
82     (void)recorder;
83     return MSERR_OK;
84 }
85 
DestroyTransCoderService(std::shared_ptr<ITransCoderService> transCoder)86 int32_t MediaLocal::DestroyTransCoderService(std::shared_ptr<ITransCoderService> transCoder)
87 {
88     (void)transCoder;
89     return MSERR_OK;
90 }
91 
DestroyPlayerService(std::shared_ptr<IPlayerService> player)92 int32_t MediaLocal::DestroyPlayerService(std::shared_ptr<IPlayerService> player)
93 {
94     (void)player;
95     return MSERR_OK;
96 }
97 
DestroyAVMetadataHelperService(std::shared_ptr<IAVMetadataHelperService> avMetadataHelper)98 int32_t MediaLocal::DestroyAVMetadataHelperService(std::shared_ptr<IAVMetadataHelperService> avMetadataHelper)
99 {
100     (void)avMetadataHelper;
101     return MSERR_OK;
102 }
103 
DestroyAVCodecService(std::shared_ptr<IAVCodecService> avCodec)104 int32_t MediaLocal::DestroyAVCodecService(std::shared_ptr<IAVCodecService> avCodec)
105 {
106     (void)avCodec;
107     return MSERR_OK;
108 }
109 
DestroyAVCodecListService(std::shared_ptr<IAVCodecListService> avCodecList)110 int32_t MediaLocal::DestroyAVCodecListService(std::shared_ptr<IAVCodecListService> avCodecList)
111 {
112     (void)avCodecList;
113     return MSERR_OK;
114 }
115 
DestroyMediaProfileService(std::shared_ptr<IRecorderProfilesService> recorderProfiles)116 int32_t MediaLocal::DestroyMediaProfileService(std::shared_ptr<IRecorderProfilesService> recorderProfiles)
117 {
118     (void)recorderProfiles;
119     return MSERR_OK;
120 }
121 
DestroyScreenCaptureService(std::shared_ptr<IScreenCaptureService> screenCapture)122 int32_t MediaLocal::DestroyScreenCaptureService(std::shared_ptr<IScreenCaptureService> screenCapture)
123 {
124     (void)screenCapture;
125     return MSERR_OK;
126 }
127 } // namespace Media
128 } // namespace OHOS
129