1 /* 2 * Copyright (c) 2025 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 AV_CODEC_PROXY_FUZZER_H 17 #define AV_CODEC_PROXY_FUZZER_H 18 19 #include "av_codec_proxy.h" 20 #include <fuzzer/FuzzedDataProvider.h> 21 22 namespace OHOS { 23 namespace CameraStandard { 24 25 class CoderCallback : public MediaCodecCallback { 26 public: CoderCallback()27 CoderCallback() {} ~CoderCallback()28 ~CoderCallback() {} OnError(MediaAVCodec::AVCodecErrorType errorType,int32_t errorCode)29 void OnError(MediaAVCodec::AVCodecErrorType errorType, int32_t errorCode) {} OnOutputFormatChanged(const Format & format)30 void OnOutputFormatChanged(const Format &format) {} OnInputBufferAvailable(uint32_t index,std::shared_ptr<AVBuffer> buffer)31 void OnInputBufferAvailable(uint32_t index, std::shared_ptr<AVBuffer> buffer) {} OnOutputBufferAvailable(uint32_t index,std::shared_ptr<AVBuffer> buffer)32 void OnOutputBufferAvailable(uint32_t index, std::shared_ptr<AVBuffer> buffer) {} 33 }; 34 35 class AVSourceTest : public AVSource { 36 public: AVSourceTest()37 AVSourceTest() {} ~AVSourceTest()38 ~AVSourceTest() {} GetSourceFormat(OHOS::Media::Format & format)39 int32_t GetSourceFormat(OHOS::Media::Format &format) 40 { 41 return 0; 42 } GetTrackFormat(OHOS::Media::Format & format,uint32_t trackIndex)43 int32_t GetTrackFormat(OHOS::Media::Format &format, uint32_t trackIndex) 44 { 45 return 0; 46 } GetUserMeta(OHOS::Media::Format & format)47 int32_t GetUserMeta(OHOS::Media::Format &format) 48 { 49 return 0; 50 } 51 }; 52 53 class AvCodecProxyFuzzer { 54 public: 55 static void AvCodecProxyFuzzerTest1(FuzzedDataProvider& fdp); 56 static void AvCodecProxyFuzzerTest2(FuzzedDataProvider& fdp); 57 static void AvCodecProxyFuzzerTest3(FuzzedDataProvider& fdp); 58 static void AvCodecProxyFuzzerTest4(FuzzedDataProvider& fdp); 59 static std::shared_ptr<AVCodecProxy> avCodecProxyFuzz_; 60 }; 61 62 } // CameraStandard 63 } // OHOS 64 #endif // AV_CODEC_PROXY_FUZZER_H