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 AVMETADATA_SERVICE_PROXY_FUZZER_H 17 #define AVMETADATA_SERVICE_PROXY_FUZZER_H 18 19 #include "stub_common.h" 20 #include "i_standard_avmetadatahelper_service.h" 21 22 namespace OHOS { 23 namespace Media { 24 class AVMetadataServiceProxyFuzzer : public IRemoteProxy<IStandardAVMetadataHelperService> { 25 public: 26 static sptr<AVMetadataServiceProxyFuzzer> Create(); 27 explicit AVMetadataServiceProxyFuzzer(const sptr<IRemoteObject> &impl); ~AVMetadataServiceProxyFuzzer()28 virtual ~AVMetadataServiceProxyFuzzer() {} 29 void SendRequest(uint32_t code, uint8_t *inputData, size_t size, bool isFuzz); SetSource(const std::string & uri,int32_t usage)30 int32_t SetSource(const std::string &uri, int32_t usage) override 31 { 32 return 0; 33 } SetSource(int32_t fd,int64_t offset,int64_t size,int32_t usage)34 int32_t SetSource(int32_t fd, int64_t offset, int64_t size, int32_t usage) override 35 { 36 return 0; 37 } SetSource(const sptr<IRemoteObject> & object)38 int32_t SetSource(const sptr<IRemoteObject> &object) override 39 { 40 return 0; 41 } ResolveMetadata(int32_t key)42 std::string ResolveMetadata(int32_t key) override 43 { 44 return std::string(""); 45 } ResolveMetadataMap()46 std::unordered_map<int32_t, std::string> ResolveMetadataMap() override 47 { 48 std::unordered_map<int32_t, std::string> metadata; 49 return metadata; 50 } GetAVMetadata()51 std::shared_ptr<Meta> GetAVMetadata() override 52 { 53 return nullptr; 54 } FetchArtPicture()55 std::shared_ptr<AVSharedMemory> FetchArtPicture() override 56 { 57 return nullptr; 58 } FetchFrameAtTime(int64_t timeUs,int32_t option,const OutputConfiguration & param)59 std::shared_ptr<AVSharedMemory> FetchFrameAtTime( 60 int64_t timeUs, int32_t option, const OutputConfiguration ¶m) override 61 { 62 return nullptr; 63 } FetchFrameYuv(int64_t timeUs,int32_t option,const OutputConfiguration & param)64 std::shared_ptr<AVBuffer> FetchFrameYuv( 65 int64_t timeUs, int32_t option, const OutputConfiguration ¶m) override 66 { 67 return nullptr; 68 } Release()69 void Release() override 70 { 71 return; 72 } DestroyStub()73 int32_t DestroyStub() override 74 { 75 return 0; 76 } SetHelperCallback()77 int32_t SetHelperCallback() override 78 { 79 return 0; 80 } SetListenerObject(const sptr<IRemoteObject> & object)81 int32_t SetListenerObject(const sptr<IRemoteObject> &object) override 82 { 83 return 0; 84 } GetTimeByFrameIndex(uint32_t index,uint64_t & time)85 int32_t GetTimeByFrameIndex(uint32_t index, uint64_t &time) override 86 { 87 return 0; 88 } GetFrameIndexByTime(uint64_t time,uint32_t & index)89 int32_t GetFrameIndexByTime(uint64_t time, uint32_t &index) override 90 { 91 return 0; 92 } 93 static int32_t SetUriSourceStatic(AVMetadataServiceProxyFuzzer* ptr, uint8_t *inputData, size_t size, bool isFuzz); 94 static int32_t SetFdSourceStatic(AVMetadataServiceProxyFuzzer* ptr, uint8_t *inputData, size_t size, bool isFuzz); 95 static int32_t ResolveMetadataStatic(AVMetadataServiceProxyFuzzer* ptr, uint8_t *inputData, size_t size, 96 bool isFuzz); 97 static int32_t ResolveMetadataMapStatic(AVMetadataServiceProxyFuzzer* ptr, uint8_t *inputData, size_t size, 98 bool isFuzz); 99 static int32_t GetAVMetadataStatic(AVMetadataServiceProxyFuzzer* ptr, uint8_t *inputData, size_t size, bool isFuzz); 100 static int32_t FetchArtPictureStatic(AVMetadataServiceProxyFuzzer* ptr, uint8_t *inputData, size_t size, 101 bool isFuzz); 102 static int32_t FetchFrameAtTimeStatic(AVMetadataServiceProxyFuzzer* ptr, uint8_t *inputData, size_t size, 103 bool isFuzz); 104 static int32_t ReleaseStatic(AVMetadataServiceProxyFuzzer* ptr, uint8_t *inputData, size_t size, bool isFuzz); 105 static int32_t DestroyStubStatic(AVMetadataServiceProxyFuzzer* ptr, uint8_t *inputData, size_t size, bool isFuzz); 106 private: 107 int32_t SendRequest(uint32_t code, MessageParcel &inputData, MessageParcel &reply, MessageOption &option); 108 static inline BrokerDelegator<AVMetadataServiceProxyFuzzer> delegator_; 109 }; 110 } 111 } 112 #endif // AVMETADATA_SERVICE_PROXY_FUZZER_H 113