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_INNER_MOCK_H
17 #define AVBUFFER_INNER_MOCK_H
18 
19 #include "avbuffer_mock.h"
20 #include "buffer/avbuffer.h"
21 
22 namespace OHOS {
23 namespace Media {
24 class AVBufferInnerMock : public AVBufferMock {
25 public:
AVBufferInnerMock(const std::shared_ptr<AVBuffer> & buffer)26     explicit AVBufferInnerMock(const std::shared_ptr<AVBuffer> &buffer) : buffer_(buffer) {}
27     ~AVBufferInnerMock() = default;
28     uint8_t *GetAddr() override;
29     int32_t GetCapacity() override;
30     int32_t GetBufferAttr(OH_AVCodecBufferAttr &attr) override;
31     int32_t SetBufferAttr(const OH_AVCodecBufferAttr &attr) override;
32     std::shared_ptr<FormatMock> GetParameter() override;
33     int32_t SetParameter(const std::shared_ptr<FormatMock> &format) override;
34     sptr<SurfaceBuffer> GetNativeBuffer() override;
35     int32_t Destroy() override;
36     std::shared_ptr<AVBuffer> &GetAVBuffer();
37 
38 private:
39     std::shared_ptr<AVBuffer> buffer_;
40 };
41 } // namespace Media
42 } // namespace OHOS
43 #endif // AVBUFFER_NATIVE_MOCK_H