From fa7a6d967adf418cc59f41f6b8f308acbab776be Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Tue, 26 Mar 2019 12:27:42 -0700 Subject: [PATCH] Allow CMAF file extensions Extensions cmfv, cmfa, cmft are now supported and recognized as CONTAINER_MOV. Fixes #574. Change-Id: I728feefaba91f862966af49c780bbac8068722f2 --- packager/media/base/container_names.cc | 11 +++++++---- packager/media/base/container_names_unittest.cc | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packager/media/base/container_names.cc b/packager/media/base/container_names.cc index a07a026a26..78d028c8ac 100644 --- a/packager/media/base/container_names.cc +++ b/packager/media/base/container_names.cc @@ -1736,11 +1736,14 @@ MediaContainerName DetermineContainerFromFormatName( return CONTAINER_EAC3; } else if (base::EqualsCaseInsensitiveASCII(format_name, "webm")) { return CONTAINER_WEBM; - } else if (base::EqualsCaseInsensitiveASCII(format_name, "m4a") || - base::EqualsCaseInsensitiveASCII(format_name, "m4v") || + } else if (base::EqualsCaseInsensitiveASCII(format_name, "cmfa") || + base::EqualsCaseInsensitiveASCII(format_name, "cmft") || + base::EqualsCaseInsensitiveASCII(format_name, "cmfv") || + base::EqualsCaseInsensitiveASCII(format_name, "m4a") || base::EqualsCaseInsensitiveASCII(format_name, "m4s") || - base::EqualsCaseInsensitiveASCII(format_name, "mp4") || - base::EqualsCaseInsensitiveASCII(format_name, "mov")) { + base::EqualsCaseInsensitiveASCII(format_name, "m4v") || + base::EqualsCaseInsensitiveASCII(format_name, "mov") || + base::EqualsCaseInsensitiveASCII(format_name, "mp4")) { return CONTAINER_MOV; } else if (base::EqualsCaseInsensitiveASCII(format_name, "ts") || base::EqualsCaseInsensitiveASCII(format_name, "mpeg2ts")) { diff --git a/packager/media/base/container_names_unittest.cc b/packager/media/base/container_names_unittest.cc index f4d065fda5..a9abb7516b 100644 --- a/packager/media/base/container_names_unittest.cc +++ b/packager/media/base/container_names_unittest.cc @@ -92,6 +92,9 @@ TEST(ContainerNamesTest, FromFormatName) { EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("mov")); EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("mp4")); EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("Mp4")); + EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("cmfa")); + EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("cmft")); + EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("cmfv")); EXPECT_EQ(CONTAINER_MPEG2TS, DetermineContainerFromFormatName("ts")); EXPECT_EQ(CONTAINER_MPEG2TS, DetermineContainerFromFormatName("mpeg2ts")); EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFormatName("cat"));