• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 AVFORMAT_CAPI_MOCK_H
17 #define AVFORMAT_CAPI_MOCK_H
18 
19 #include "avformat_mock.h"
20 #include "native_avformat.h"
21 
22 namespace OHOS {
23 namespace MediaAVCodec {
24 class AVFormatCapiMock : public FormatMock {
25 public:
AVFormatCapiMock(OH_AVFormat * format)26     explicit AVFormatCapiMock(OH_AVFormat *format) : format_(format) {}
27     AVFormatCapiMock();
28     ~AVFormatCapiMock();
29     bool PutIntValue(const std::string_view &key, int32_t value) override;
30     bool GetIntValue(const std::string_view &key, int32_t &value) override;
31     bool PutStringValue(const std::string_view &key, const std::string_view &value) override;
32     bool GetStringValue(const std::string_view &key, std::string &value) override;
33     void Destroy() override;
34     bool PutLongValue(const std::string_view &key, int64_t value) override;
35     bool GetLongValue(const std::string_view &key, int64_t &value) override;
36     bool PutFloatValue(const std::string_view &key, float value) override;
37     bool GetFloatValue(const std::string_view &key, float &value) override;
38     bool PutDoubleValue(const std::string_view &key, double value) override;
39     bool GetDoubleValue(const std::string_view &key, double &value) override;
40     bool GetBuffer(const std::string_view &key, uint8_t **addr, size_t &size) override;
41     bool PutBuffer(const std::string_view &key, const uint8_t *addr, size_t size) override;
42     void InitTrackFormat() override;
43     void InitAudioTrackFormat(const std::string_view &mimeType, int32_t sampleRate, int32_t channelCount) override;
44     void InitVideoTrackFormat(const std::string_view &mimeType, int32_t width, int32_t height) override;
45     const char *DumpInfo() override;
46     bool AVFormat_Copy(struct OH_AVFormat *to, struct OH_AVFormat *from);
47     OH_AVFormat *GetFormat();
48 
49 private:
50     OH_AVFormat *format_;
51 };
52 }  // namespace MediaAVCodec
53 }  // namespace OHOS
54 #endif // AVFORMAT_CAPI_MOCK_H