OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "media/formats/mp4/dolby_vision.h" |
| 6 |
| 7 #include "media/base/video_codecs.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 namespace media { |
| 11 namespace mp4 { |
| 12 |
| 13 class DolbyVisionConfigurationTest : public testing::Test {}; |
| 14 |
| 15 TEST_F(DolbyVisionConfigurationTest, Profile0Level1ELTrackTest) { |
| 16 DolbyVisionConfiguration dv_config; |
| 17 uint8_t data[] = {0x00, 0x00, 0x00, 0x0E}; |
| 18 |
| 19 dv_config.Parse(data, sizeof(data)); |
| 20 |
| 21 EXPECT_EQ(dv_config.dv_version_major, 0); |
| 22 EXPECT_EQ(dv_config.dv_version_minor, 0); |
| 23 EXPECT_EQ(dv_config.codec_profile, DOLBYVISION_PROFILE0); |
| 24 EXPECT_EQ(dv_config.dv_level, 1); |
| 25 EXPECT_EQ(dv_config.rpu_present_flag, 1); |
| 26 EXPECT_EQ(dv_config.el_present_flag, 1); |
| 27 EXPECT_EQ(dv_config.bl_present_flag, 0); |
| 28 } |
| 29 |
| 30 TEST_F(DolbyVisionConfigurationTest, Profile4Level2ELTrackWithBLTest) { |
| 31 DolbyVisionConfiguration dv_config; |
| 32 uint8_t data[] = {0x00, 0x00, 0x08, 0x16}; |
| 33 |
| 34 dv_config.Parse(data, sizeof(data)); |
| 35 |
| 36 EXPECT_EQ(dv_config.dv_version_major, 0); |
| 37 EXPECT_EQ(dv_config.dv_version_minor, 0); |
| 38 EXPECT_EQ(dv_config.codec_profile, DOLBYVISION_PROFILE4); |
| 39 EXPECT_EQ(dv_config.dv_level, 2); |
| 40 EXPECT_EQ(dv_config.rpu_present_flag, 1); |
| 41 EXPECT_EQ(dv_config.el_present_flag, 1); |
| 42 EXPECT_EQ(dv_config.bl_present_flag, 0); |
| 43 } |
| 44 |
| 45 TEST_F(DolbyVisionConfigurationTest, Profile5Test) { |
| 46 DolbyVisionConfiguration dv_config; |
| 47 uint8_t data[] = {0x00, 0x00, 0x0A, 0x17}; |
| 48 |
| 49 dv_config.Parse(data, sizeof(data)); |
| 50 |
| 51 EXPECT_EQ(dv_config.dv_version_major, 0); |
| 52 EXPECT_EQ(dv_config.dv_version_minor, 0); |
| 53 EXPECT_EQ(dv_config.codec_profile, DOLBYVISION_PROFILE5); |
| 54 EXPECT_EQ(dv_config.dv_level, 2); |
| 55 EXPECT_EQ(dv_config.rpu_present_flag, 1); |
| 56 EXPECT_EQ(dv_config.el_present_flag, 1); |
| 57 EXPECT_EQ(dv_config.bl_present_flag, 1); |
| 58 } |
| 59 |
| 60 TEST_F(DolbyVisionConfigurationTest, ParseNotEnoughData) { |
| 61 DolbyVisionConfiguration dv_config; |
| 62 uint8_t data[] = {0x00, 0x00, 0x0C}; |
| 63 |
| 64 EXPECT_FALSE(dv_config.Parse(data, sizeof(data))); |
| 65 } |
| 66 |
| 67 } // namespace mp4 |
| 68 } // namespace media |
OLD | NEW |