From 6d68f778ee070bae268f1253edca69540098a905 Mon Sep 17 00:00:00 2001 From: Rintaro Kuroiwa Date: Tue, 28 Jan 2014 00:32:09 -0800 Subject: [PATCH] Add ContainerType to MuxerListener Container type should be passed to MuxerListener Change-Id: I4941f17d68fab1565c6105a73e50fa9885bbd304 --- media/event/muxer_listener.h | 14 +++++++++++--- media/event/vod_media_info_dump_muxer_listener.cc | 3 ++- media/event/vod_media_info_dump_muxer_listener.h | 3 ++- media/event/vod_mpd_notify_muxer_listener.cc | 3 ++- media/event/vod_mpd_notify_muxer_listener.h | 3 ++- media/mp4/mp4_muxer.cc | 5 ++++- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/media/event/muxer_listener.h b/media/event/muxer_listener.h index 0abfaeb1b2..d24b811a96 100644 --- a/media/event/muxer_listener.h +++ b/media/event/muxer_listener.h @@ -17,8 +17,12 @@ namespace event { // to add GetStatus() method somewhere (maybe in MuxerListener, maybe not). class MuxerListener { public: - MuxerListener() {}; - virtual ~MuxerListener() {}; + enum ContainerType { + kContainerUnknown = 0, + kContainerMp4, + kContainerMpeg2ts, + kContainerWebM + }; // Called when muxing starts. This event happens before any other events. // For MPEG DASH Live profile, the initialization segment information is @@ -27,7 +31,8 @@ class MuxerListener { // specified in |stream_infos|. virtual void OnMediaStart(const MuxerOptions& muxer_options, const std::vector& stream_infos, - uint32 time_scale) = 0; + uint32 time_scale, + ContainerType container_type) = 0; // Called when all files are written out and the muxer object does not output // any more files. @@ -57,6 +62,9 @@ class MuxerListener { virtual void OnNewSegment(uint64 start_time, uint64 duration, uint64 segment_file_size) = 0; + protected: + MuxerListener() {}; + virtual ~MuxerListener() {}; }; } // namespace event diff --git a/media/event/vod_media_info_dump_muxer_listener.cc b/media/event/vod_media_info_dump_muxer_listener.cc index 504121c7e2..eb1e379656 100644 --- a/media/event/vod_media_info_dump_muxer_listener.cc +++ b/media/event/vod_media_info_dump_muxer_listener.cc @@ -37,7 +37,8 @@ void VodMediaInfoDumpMuxerListener::SetContentProtectionSchemeIdUri( void VodMediaInfoDumpMuxerListener::OnMediaStart( const MuxerOptions& muxer_options, const std::vector& stream_infos, - uint32 time_scale) { + uint32 time_scale, + ContainerType container_type) { DLOG(INFO) << "VodMediaInfoDumpMuxerListener does not care about OnMediaStart."; } diff --git a/media/event/vod_media_info_dump_muxer_listener.h b/media/event/vod_media_info_dump_muxer_listener.h index d5206e92f8..bf941f9735 100644 --- a/media/event/vod_media_info_dump_muxer_listener.h +++ b/media/event/vod_media_info_dump_muxer_listener.h @@ -35,7 +35,8 @@ class VodMediaInfoDumpMuxerListener : public MuxerListener { // MuxerListener implementation. virtual void OnMediaStart(const MuxerOptions& muxer_options, const std::vector& stream_infos, - uint32 time_scale) OVERRIDE; + uint32 time_scale, + ContainerType container_type) OVERRIDE; virtual void OnMediaEnd(const std::vector& stream_infos, bool has_init_range, diff --git a/media/event/vod_mpd_notify_muxer_listener.cc b/media/event/vod_mpd_notify_muxer_listener.cc index 490842fb45..a9708a5086 100644 --- a/media/event/vod_mpd_notify_muxer_listener.cc +++ b/media/event/vod_mpd_notify_muxer_listener.cc @@ -23,7 +23,8 @@ VodMpdNotifyMuxerListener::~VodMpdNotifyMuxerListener() {} void VodMpdNotifyMuxerListener::OnMediaStart( const MuxerOptions& muxer_options, const std::vector& stream_infos, - uint32 time_scale) {} + uint32 time_scale, + ContainerType container_type) {} void VodMpdNotifyMuxerListener::OnMediaEnd( const std::vector& stream_infos, diff --git a/media/event/vod_mpd_notify_muxer_listener.h b/media/event/vod_mpd_notify_muxer_listener.h index 34b68beee3..bdb2e940c0 100644 --- a/media/event/vod_mpd_notify_muxer_listener.h +++ b/media/event/vod_mpd_notify_muxer_listener.h @@ -24,7 +24,8 @@ class VodMpdNotifyMuxerListener : public MuxerListener { // MuxerListener implementation. virtual void OnMediaStart(const MuxerOptions& muxer_options, const std::vector& stream_infos, - uint32 time_scale) OVERRIDE; + uint32 time_scale, + ContainerType container_type) OVERRIDE; virtual void OnMediaEnd(const std::vector& stream_infos, bool has_init_range, diff --git a/media/mp4/mp4_muxer.cc b/media/mp4/mp4_muxer.cc index 93625fb6d7..74d0217dc9 100644 --- a/media/mp4/mp4_muxer.cc +++ b/media/mp4/mp4_muxer.cc @@ -284,7 +284,10 @@ void MP4Muxer::FireOnMediaStartEvent() { std::vector stream_info_vec; GetStreamInfo(&stream_info_vec); const uint32 timescale = segmenter_->GetReferenceTimeScale(); - muxer_listener()->OnMediaStart(options(), stream_info_vec, timescale); + muxer_listener()->OnMediaStart(options(), + stream_info_vec, + timescale, + event::MuxerListener::kContainerMp4); } void MP4Muxer::FireOnMediaEndEvent() {