• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 #ifndef AVCODEC_LIST_UNIT_TEST_H
16 #define AVCODEC_LIST_UNIT_TEST_H
17 
18 #include "gtest/gtest.h"
19 #include "avcodec_mock.h"
20 #include "enum_mock.h"
21 
22 namespace OHOS {
23 namespace Media {
24 constexpr uint32_t DEFAULT_WIDTH = 1920;
25 constexpr uint32_t DEFAULT_HEIGHT = 1080;
26 constexpr uint32_t MIN_WIDTH = 2;
27 constexpr uint32_t MIN_HEIGHT = 2;
28 constexpr uint32_t MAX_WIDTH = 3840;
29 constexpr uint32_t MAX_HEIGHT = 2160;
30 constexpr uint32_t MAX_FRAME_RATE = 30;
31 constexpr uint32_t MAX_VIDEO_BITRATE = 3000000;
32 constexpr uint32_t MAX_AUDIO_BITRATE = 384000;
33 constexpr uint32_t DEFAULT_SAMPLE_RATE = 8000;
34 constexpr uint32_t MAX_CHANNEL_COUNT = 2;
35 constexpr uint32_t MAX_CHANNEL_COUNT_VORBIS = 7;
36 class AVCodecListUnitTest : public testing::Test {
37 public:
38     static void SetUpTestCase(void);
39     static void TearDownTestCase(void);
40     void SetUp(void);
41     void TearDown(void);
42 protected:
43     std::shared_ptr<AVCodecListMock> avCodecList_ = nullptr;
44     std::shared_ptr<EnumMock> enum_ = nullptr;
45     void CheckAVDecH264(const std::shared_ptr<VideoCapsMock> &videoCaps) const;
46     void CheckAVDecH263(const std::shared_ptr<VideoCapsMock> &videoCaps) const;
47     void CheckAVDecMpeg2Video(const std::shared_ptr<VideoCapsMock> &videoCaps) const;
48     void CheckAVDecMpeg4(const std::shared_ptr<VideoCapsMock> &videoCaps) const;
49     void CheckAVEncMpeg4(const std::shared_ptr<VideoCapsMock> &videoCaps) const;
50     void CheckVideoCaps(const std::shared_ptr<VideoCapsMock> &videoCaps) const;
51     void CheckVideoCapsArray(const std::vector<std::shared_ptr<VideoCapsMock>> &videoCapsArray) const;
52     void CheckAVDecMP3(const std::shared_ptr<AudioCapsMock> &audioCaps) const;
53     void CheckAVDecAAC(const std::shared_ptr<AudioCapsMock> &audioCaps) const;
54     void CheckAVDecVorbis(const std::shared_ptr<AudioCapsMock> &audioCaps) const;
55     void CheckAVDecFlac(const std::shared_ptr<AudioCapsMock> &audioCaps) const;
56     void CheckAVDecOpus(const std::shared_ptr<AudioCapsMock> &audioCaps) const;
57     void CheckAVEncAAC(const std::shared_ptr<AudioCapsMock> &audioCaps) const;
58     void CheckAVEncOpus(const std::shared_ptr<AudioCapsMock> &audioCaps) const;
59     void CheckAudioCaps(const std::shared_ptr<AudioCapsMock> &audioCaps) const;
60     void CheckAudioCapsArray(const std::vector<std::shared_ptr<AudioCapsMock>> &audioCapsArray) const;
61     std::string codecMimeKey_;
62     std::string bitrateKey_;
63     std::string widthKey_;
64     std::string heightKey_;
65     std::string pixelFormatKey_;
66     std::string frameRateKey_;
67     std::string channelCountKey_;
68     std::string sampleRateKey_;
69 };
70 }
71 }
72 #endif
73