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