Use TsMuxer in driver program

- The driver program can output ts files.

Change-Id: I190ba17ded91a0be48cc0a1a8b15e44d20800eec
This commit is contained in:
Rintaro Kuroiwa 2016-04-06 01:26:48 -07:00
parent 300c23104e
commit a50b5787dc
3 changed files with 15 additions and 4 deletions

View File

@ -32,6 +32,7 @@
#include "packager/media/event/mpd_notify_muxer_listener.h" #include "packager/media/event/mpd_notify_muxer_listener.h"
#include "packager/media/event/vod_media_info_dump_muxer_listener.h" #include "packager/media/event/vod_media_info_dump_muxer_listener.h"
#include "packager/media/file/file.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/mp4/mp4_muxer.h"
#include "packager/media/formats/webm/webm_muxer.h" #include "packager/media/formats/webm/webm_muxer.h"
#include "packager/mpd/base/dash_iop_mpd_notifier.h" #include "packager/mpd/base/dash_iop_mpd_notifier.h"
@ -207,6 +208,8 @@ scoped_ptr<Muxer> CreateOutputMuxer(const MuxerOptions& options,
MediaContainerName container) { MediaContainerName container) {
if (container == CONTAINER_WEBM) { if (container == CONTAINER_WEBM) {
return scoped_ptr<Muxer>(new webm::WebMMuxer(options)); return scoped_ptr<Muxer>(new webm::WebMMuxer(options));
} else if (container == CONTAINER_MPEG2TS) {
return scoped_ptr<Muxer>(new mp2t::TsMuxer(options));
} else { } else {
DCHECK_EQ(container, CONTAINER_MOV); DCHECK_EQ(container, CONTAINER_MOV);
return scoped_ptr<Muxer>(new mp4::MP4Muxer(options)); return scoped_ptr<Muxer>(new mp4::MP4Muxer(options));

View File

@ -1719,9 +1719,11 @@ MediaContainerName DetermineContainerFromFormatName(
base::EqualsCaseInsensitiveASCII(format_name, "mp4") || base::EqualsCaseInsensitiveASCII(format_name, "mp4") ||
base::EqualsCaseInsensitiveASCII(format_name, "mov")) { base::EqualsCaseInsensitiveASCII(format_name, "mov")) {
return CONTAINER_MOV; return CONTAINER_MOV;
} else { } else if (base::EqualsCaseInsensitiveASCII(format_name, "ts") ||
return CONTAINER_UNKNOWN; base::EqualsCaseInsensitiveASCII(format_name, "mpeg2ts")) {
return CONTAINER_MPEG2TS;
} }
return CONTAINER_UNKNOWN;
} }
MediaContainerName DetermineContainerFromFileName( MediaContainerName DetermineContainerFromFileName(
@ -1736,9 +1738,11 @@ MediaContainerName DetermineContainerFromFileName(
base::EndsWith(file_name, ".m4v", base::EndsWith(file_name, ".m4v",
base::CompareCase::INSENSITIVE_ASCII)) { base::CompareCase::INSENSITIVE_ASCII)) {
return CONTAINER_MOV; return CONTAINER_MOV;
} else { } else if (base::EndsWith(file_name, ".ts",
return CONTAINER_UNKNOWN; base::CompareCase::INSENSITIVE_ASCII)) {
return CONTAINER_MPEG2TS;
} }
return CONTAINER_UNKNOWN;
} }
} // namespace media } // namespace media

View File

@ -91,6 +91,8 @@ TEST(ContainerNamesTest, FromFormatName) {
EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("mov")); EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("mov"));
EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("mp4")); EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFormatName("mp4"));
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("cat"));
EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFormatName("amp4")); EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFormatName("amp4"));
EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFormatName(" mp4")); 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("a file .m4V"));
EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFileName("2_more-files.mp4")); EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFileName("2_more-files.mp4"));
EXPECT_EQ(CONTAINER_MOV, DetermineContainerFromFileName("foo.bar.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.gif"));
EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFileName("a bad.m4v-")); EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFileName("a bad.m4v-"));
EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFileName("a.m4v.")); EXPECT_EQ(CONTAINER_UNKNOWN, DetermineContainerFromFileName("a.m4v."));