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 AVBUFFER_MOCK_H 17 #define AVBUFFER_MOCK_H 18 19 #include <string> 20 #include "avformat_mock.h" 21 #include "native_avbuffer.h" 22 #include "nocopyable.h" 23 #include "surface.h" 24 25 namespace OHOS { 26 namespace Media { 27 class AVBufferMock : public NoCopyable { 28 public: 29 virtual ~AVBufferMock() = default; 30 virtual uint8_t *GetAddr() = 0; 31 virtual int32_t GetCapacity() = 0; 32 virtual int32_t GetBufferAttr(OH_AVCodecBufferAttr &attr) = 0; 33 virtual int32_t SetBufferAttr(const OH_AVCodecBufferAttr &attr) = 0; 34 virtual std::shared_ptr<FormatMock> GetParameter() = 0; 35 virtual int32_t SetParameter(const std::shared_ptr<FormatMock> &format) = 0; 36 virtual sptr<SurfaceBuffer> GetNativeBuffer() = 0; 37 virtual int32_t Destroy() = 0; 38 }; 39 40 class __attribute__((visibility("default"))) AVBufferMockFactory { 41 public: 42 static std::shared_ptr<AVBufferMock> CreateAVBuffer(const int32_t &capacity); 43 44 private: 45 AVBufferMockFactory() = delete; 46 ~AVBufferMockFactory() = delete; 47 }; 48 } // namespace Media 49 } // namespace OHOS 50 #endif // AVBUFFER_MOCK_H