• 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 RECORDERPROFILES_SERVICE_STUB_H
17 #define RECORDERPROFILES_SERVICE_STUB_H
18 
19 #include <map>
20 #include "i_standard_recorder_profiles_service.h"
21 #include "media_death_recipient.h"
22 #include "recorder_profiles_server.h"
23 #include "nocopyable.h"
24 #include "media_parcel.h"
25 #include "recorder_profiles_parcel.h"
26 
27 namespace OHOS {
28 namespace Media {
29 class RecorderProfilesServiceStub : public IRemoteStub<IStandardRecorderProfilesService>, public NoCopyable {
30 public:
31     static sptr<RecorderProfilesServiceStub> Create();
32     virtual ~RecorderProfilesServiceStub();
33 
34     int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
35     bool IsAudioRecorderConfigSupported(const RecorderProfilesData &profile) override;
36     bool HasVideoRecorderProfile(int32_t sourceId, int32_t qualityLevel) override;
37     std::vector<RecorderProfilesData> GetAudioRecorderCapsInfo() override;
38     std::vector<RecorderProfilesData> GetVideoRecorderCapsInfo() override;
39     RecorderProfilesData GetVideoRecorderProfileInfo(int32_t sourceId, int32_t qualityLevel) override;
40     int32_t DestroyStub() override;
41 
42 private:
43     RecorderProfilesServiceStub();
44     int32_t Init();
45     int32_t IsAudioRecorderConfigSupported(MessageParcel &data, MessageParcel &reply);
46     int32_t HasVideoRecorderProfile(MessageParcel &data, MessageParcel &reply);
47     int32_t GetAudioRecorderCapsInfo(MessageParcel &data, MessageParcel &reply);
48     int32_t GetVideoRecorderCapsInfo(MessageParcel &data, MessageParcel &reply);
49     int32_t GetVideoRecorderProfileInfo(MessageParcel &data, MessageParcel &reply);
50     int32_t DestroyStub(MessageParcel &data, MessageParcel &reply);
51     std::shared_ptr<IRecorderProfilesService> mediaProfileServer_ = nullptr;
52     using MediaProfileStubFunc = int32_t(RecorderProfilesServiceStub::*)(MessageParcel &data, MessageParcel &reply);
53     std::map<uint32_t, MediaProfileStubFunc> mediaProfileFuncs_;
54     std::mutex mutex_;
55 };
56 }  // namespace Media
57 }  // namespace OHOS
58 #endif  // RECORDERPROFILES_SERVICE_STUB_H
59