• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef AVCODECLIST_SERVICE_STUB_H
17 #define AVCODECLIST_SERVICE_STUB_H
18 
19 #include <map>
20 #include "i_standard_avcodeclist_service.h"
21 #include "media_death_recipient.h"
22 #include "avcodeclist_server.h"
23 #include "nocopyable.h"
24 #include "media_parcel.h"
25 #include "avcodeclist_parcel.h"
26 
27 namespace OHOS {
28 namespace Media {
29 class AVCodecListServiceStub : public IRemoteStub<IStandardAVCodecListService>, public NoCopyable {
30 public:
31     static sptr<AVCodecListServiceStub> Create();
32     virtual ~AVCodecListServiceStub();
33 
34     int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
35     std::string FindVideoDecoder(const Format &format) override;
36     std::string FindVideoEncoder(const Format &format) override;
37     std::string FindAudioDecoder(const Format &format) override;
38     std::string FindAudioEncoder(const Format &format) override;
39     std::vector<CapabilityData>  GetCodecCapabilityInfos() override;
40     int32_t DestroyStub() override;
41 
42 private:
43     AVCodecListServiceStub();
44     int32_t Init();
45     int32_t FindVideoDecoder(MessageParcel &data, MessageParcel &reply);
46     int32_t FindVideoEncoder(MessageParcel &data, MessageParcel &reply);
47     int32_t FindAudioDecoder(MessageParcel &data, MessageParcel &reply);
48     int32_t FindAudioEncoder(MessageParcel &data, MessageParcel &reply);
49     int32_t GetCodecCapabilityInfos(MessageParcel &data, MessageParcel &reply);
50     int32_t DestroyStub(MessageParcel &data, MessageParcel &reply);
51     std::shared_ptr<IAVCodecListService> codecListServer_ = nullptr;
52     using AVCodecListStubFunc = int32_t(AVCodecListServiceStub::*)(MessageParcel &data, MessageParcel &reply);
53     std::map<uint32_t, AVCodecListStubFunc> codecListFuncs_;
54     std::mutex mutex_;
55 };
56 } // namespace Media
57 } // namespace OHOS
58 #endif // AVCODECLIST_SERVICE_STUB_H
59