1 /* 2 * Copyright (C) 2022 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 AVFORMAT_NATIVE_MOCK_H 17 #define AVFORMAT_NATIVE_MOCK_H 18 19 #include "avcodec_mock.h" 20 #include "format.h" 21 22 namespace OHOS { 23 namespace Media { 24 class AVFormatNativeMock : public FormatMock { 25 public: AVFormatNativeMock(const Format & format)26 explicit AVFormatNativeMock(const Format &format) : format_(format) {} 27 AVFormatNativeMock() = default; 28 bool PutIntValue(const std::string_view &key, int32_t value) override; 29 bool GetIntValue(const std::string_view &key, int32_t &value) override; 30 bool PutStringValue(const std::string_view &key, const std::string_view &value) override; 31 bool GetStringValue(const std::string_view &key, std::string &value) override; 32 void Destroy() override; 33 bool PutLongValue(const std::string_view &key, int64_t value) override; 34 bool GetLongValue(const std::string_view &key, int64_t &value) override; 35 bool PutFloatValue(const std::string_view &key, float value) override; 36 bool GetFloatValue(const std::string_view &key, float &value) override; 37 bool PutDoubleValue(const std::string_view &key, double value) override; 38 bool GetDoubleValue(const std::string_view &key, double &value) override; 39 bool GetBuffer(const std::string_view &key, uint8_t **addr, size_t &size) override; 40 bool PutBuffer(const std::string_view &key, const uint8_t *addr, size_t size) override; 41 const char *DumpInfo() override; 42 Format &GetFormat(); 43 44 private: 45 Format format_; 46 char *dumpInfo_ = nullptr; 47 }; 48 } // Media 49 } // OHOS 50 #endif // AVFORMAT_NATIVE_MOCK_H