• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2021 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 "gtest/gtest.h"
17 #include "common/any.h"
18 #define private public
19 #define protected public
20 
21 #include "plugin/plugins/ffmpeg_adapter/utils/ffmpeg_utils.h"
22 
23 namespace OHOS {
24 namespace Media {
25 namespace Test {
26 using namespace Plugin;
27 
TEST(ChannelLayoutTest,test_convert_from_ffmpeg_mono)28 TEST(ChannelLayoutTest, test_convert_from_ffmpeg_mono)
29 {
30     int channels = 1;
31     uint64_t ffChannelLayout = 0x4;
32 
33     AudioChannelLayout channelLayout = Ffmpeg::ConvertChannelLayoutFromFFmpeg(channels, ffChannelLayout);
34     EXPECT_EQ(AudioChannelLayout::MONO, channelLayout);
35 }
36 
TEST(ChannelLayoutTest,test_convert_from_ffmpeg_stereo)37 TEST(ChannelLayoutTest, test_convert_from_ffmpeg_stereo)
38 {
39     int channels = 2;
40     uint64_t ffChannelLayout = 0x3;
41 
42     AudioChannelLayout channelLayout = Ffmpeg::ConvertChannelLayoutFromFFmpeg(channels, ffChannelLayout);
43     EXPECT_EQ(AudioChannelLayout::STEREO, channelLayout);
44 }
45 } // namespace Test
46 } // namespace Media
47 } // namespace OHOS