• 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 CODECLIST_SERVICE_STUB_H
17 #define CODECLIST_SERVICE_STUB_H
18 
19 #include <map>
20 #include <shared_mutex>
21 #include "i_standard_codeclist_service.h"
22 #include "avcodec_death_recipient.h"
23 #include "codeclist_server.h"
24 #include "nocopyable.h"
25 #include "avcodec_parcel.h"
26 #include "codeclist_parcel.h"
27 
28 namespace OHOS {
29 namespace MediaAVCodec {
30 class CodecListServiceStub : public IRemoteStub<IStandardCodecListService>, public NoCopyable {
31 public:
32     static sptr<CodecListServiceStub> Create();
33     virtual ~CodecListServiceStub();
34 
35     int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
36     std::string FindDecoder(const Media::Format &format) override;
37     std::string FindEncoder(const Media::Format &format) override;
38     int32_t GetCapability(CapabilityData &capabilityData, const std::string &mime, const bool isEncoder,
39                           const AVCodecCategory &category) override;
40     int32_t DestroyStub() override;
41 
42 private:
43     CodecListServiceStub();
44     int32_t Init();
45     int32_t DoFindDecoder(MessageParcel &data, MessageParcel &reply);
46     int32_t DoFindEncoder(MessageParcel &data, MessageParcel &reply);
47     int32_t DoGetCapability(MessageParcel &data, MessageParcel &reply);
48     int32_t DoDestroyStub(MessageParcel &data, MessageParcel &reply);
49     std::shared_ptr<ICodecListService> codecListServer_ = nullptr;
50     using CodecListStubFunc = int32_t (CodecListServiceStub::*)(MessageParcel &data, MessageParcel &reply);
51     std::shared_mutex mutex_;
52 };
53 } // namespace MediaAVCodec
54 } // namespace OHOS
55 #endif // CODECLIST_SERVICE_STUB_H
56