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 AVMUXER_MOCK_H
17 #define AVMUXER_MOCK_H
18 
19 #include <string>
20 #include "native_averrors.h"
21 #include "avformat_mock.h"
22 #include "native_avcodec_base.h"
23 #include "nocopyable.h"
24 
25 namespace OHOS {
26 namespace MediaAVCodec {
27 class AVMuxerMock : public NoCopyable {
28 public:
29     virtual ~AVMuxerMock() = default;
30     virtual int32_t Destroy() = 0;
31     virtual int32_t Start() = 0;
32     virtual int32_t Stop() = 0;
33     virtual int32_t AddTrack(int32_t &trackIndex, std::shared_ptr<FormatMock> &trackFormat) = 0;
34     virtual int32_t WriteSample(uint32_t trackIndex, const uint8_t *sample,
35         const OH_AVCodecBufferAttr &info)  = 0;
36     virtual int32_t WriteSampleBuffer(uint32_t trackIndex, const OH_AVBuffer *sample)  = 0;
37     virtual int32_t SetRotation(int32_t rotation) = 0;
38     virtual int32_t SetTimedMetadata() = 0;
39 };
40 
41 class __attribute__((visibility("default"))) AVMuxerMockFactory {
42 public:
43     static std::shared_ptr<AVMuxerMock> CreateMuxer(int32_t fd, const OH_AVOutputFormat &format);
44 private:
45     AVMuxerMockFactory() = delete;
46     ~AVMuxerMockFactory() = delete;
47 };
48 }  // namespace MediaAVCodec
49 }  // namespace OHOS
50 #endif // AVMUXER_MOCK_H