1 /*
2  * Copyright (c) 2023-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 #include <string>
17 #include "gtest/gtest.h"
18 #include "plugin/plugins/ffmpeg_adapter/video_encoder/ffmpeg_vid_enc_config.h"
19 
20 namespace OHOS {
21 namespace Media {
22 namespace Test {
23 using namespace OHOS::Media::Plugin;
24 using namespace testing::ext;
25 
26 HWTEST(TestFFmpegVidEncConfig, test_video_encoder_parameter, TestSize.Level1)
27 {
28     std::map<Tag, ValueType> meta {};
29     AVCodecContext avCodecContext {};
30     ValueType  value;
31     meta.insert(std::make_pair(Tag::SECTION_VIDEO_UNIVERSAL_START, value));
32     avCodecContext.codec_type = AVMEDIA_TYPE_VIDEO;
33     Ffmpeg::ConfigVideoEncoder((AVCodecContext &) avCodecContext, meta);
34     ValueType val = 3;
35     auto status = Ffmpeg::GetVideoEncoderParameters(avCodecContext, Tag::SECTION_VIDEO_UNIVERSAL_START, val);
36     EXPECT_EQ(Status::ERROR_INVALID_PARAMETER, status);
37 }
38 } // namespace Test
39 } // namespace Media
40 } // namespace OHOS
41