1 /* 2 * Copyright (c) 2024 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 PARSER_SAMPLE_H 17 #define PARSER_SAMPLE_H 18 19 #include "avdemuxer.h" 20 #include "avsource.h" 21 22 namespace OHOS { 23 namespace MediaAVCodec { 24 using AVBuffer = OHOS::Media::AVBuffer; 25 using AVAllocator = OHOS::Media::AVAllocator; 26 using AVAllocatorFactory = OHOS::Media::AVAllocatorFactory; 27 using MemoryFlag = OHOS::Media::MemoryFlag; 28 using FormatDataType = OHOS::Media::FormatDataType; 29 class ParserSample { 30 public: 31 ParserSample() = default; 32 ~ParserSample(); 33 const char *filePath = "/data/test/fuzz_create.mp4"; 34 void RunReferenceParser(int64_t pts, int64_t ptsForPtsIndex, int64_t frameIndex, uint32_t createSize); 35 private: 36 int CreateDemuxer(uint32_t buffersize, int64_t ptsForPtsIndex, int64_t frameIndex); 37 int fd; 38 int32_t gTrackCount; 39 std::shared_ptr<OHOS::Media::AVBuffer> avBuffer; 40 std::shared_ptr<AVSource> source = nullptr; 41 std::shared_ptr<AVDemuxer> demuxer = nullptr; 42 }; 43 } // namespace MediaAVCodec 44 } // namespace OHOS 45 46 #endif // PARSER_SAMPLE_H