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