diff --git a/packager/app/packager_main.cc b/packager/app/packager_main.cc index e450e5d334..308b913421 100644 --- a/packager/app/packager_main.cc +++ b/packager/app/packager_main.cc @@ -32,6 +32,7 @@ #include "packager/media/event/mpd_notify_muxer_listener.h" #include "packager/media/event/vod_media_info_dump_muxer_listener.h" #include "packager/media/file/file.h" +#include "packager/media/formats/mp2t/ts_muxer.h" #include "packager/media/formats/mp4/mp4_muxer.h" #include "packager/media/formats/webm/webm_muxer.h" #include "packager/mpd/base/dash_iop_mpd_notifier.h" @@ -207,6 +208,8 @@ scoped_ptr CreateOutputMuxer(const MuxerOptions& options, MediaContainerName container) { if (container == CONTAINER_WEBM) { return scoped_ptr(new webm::WebMMuxer(options)); + } else if (container == CONTAINER_MPEG2TS) { + return scoped_ptr(new mp2t::TsMuxer(options)); } else { DCHECK_EQ(container, CONTAINER_MOV); return scoped_ptr(new mp4::MP4Muxer(options)); diff --git a/packager/media/base/container_names.cc b/packager/media/base/container_names.cc index 769caa4d55..d49ed30a5d 100644 --- a/packager/media/base/container_names.cc +++ b/packager/media/base/container_names.cc @@ -1719,9 +1719,11 @@ MediaContainerName DetermineContainerFromFormatName( base::EqualsCaseInsensitiveASCII(format_name, "mp4") || base::EqualsCaseInsensitiveASCII(format_name, "mov")) { return CONTAINER_MOV; - } else { - return CONTAINER_UNKNOWN; + } else if (base::EqualsCaseInsensitiveASCII(format_name, "ts") || + base::EqualsCaseInsensitiveASCII(format_name, "mpeg2ts")) { + return CONTAINER_MPEG2TS; } + return CONTAINER_UNKNOWN; } MediaContainerName DetermineContainerFromFileName( @@ -1736,9 +1738,11 @@ MediaContainerName DetermineContainerFromFileName( base::EndsWith(file_name, ".m4v", base::CompareCase::INSENSITIVE_ASCII)) { return CONTAINER_MOV; - } else { - return CONTAINER_UNKNOWN; + } else if (base::EndsWith(file_name, ".ts", + base::CompareCase::INSENSITIVE_ASCII)) { + return CONTAINER_MPEG2TS; } + return CONTAINER_UNKNOWN; } } // namespace media diff --git a/packager/media/base/container_names_unittest.cc b/packager/media/base/container_names_unittest.cc index 402d94149e..1506aa1002 100644 --- a/packager/media/base/container_names_unittest.cc +++ b/packager/media/base/container_names_unittest.cc @@ -91,6 +91,8 @@ TEST(ContainerNamesTest, FromFormatName) { EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("mov")); EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("mp4")); EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("Mp4")); + EXPECT_EQ(CONTAINER_MPEG2TS, DetermineContainerFromFormatName("ts")); + EXPECT_EQ(CONTAINER_MPEG2TS, DetermineContainerFromFormatName("mpeg2ts")); EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFormatName("cat")); EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFormatName("amp4")); EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFormatName(" mp4")); @@ -105,6 +107,8 @@ TEST(ContainerNamesTest, FromFileName) { EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFileName("a file .m4V")); EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFileName("2_more-files.mp4")); EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFileName("foo.bar.MP4")); + EXPECT_EQ(CONTAINER_MPEG2TS, DetermineContainerFromFileName("a.ts")); + EXPECT_EQ(CONTAINER_MPEG2TS, DetermineContainerFromFileName("a.TS")); EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFileName("a_bad.gif")); EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFileName("a bad.m4v-")); EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFileName("a.m4v."));