Add ContainerType to MuxerListener

Container type should be passed to MuxerListener

Change-Id: I4941f17d68fab1565c6105a73e50fa9885bbd304
This commit is contained in:
Rintaro Kuroiwa 2014-01-28 00:32:09 -08:00
parent 522048b0d9
commit 6d68f778ee
6 changed files with 23 additions and 8 deletions

View File

@ -17,8 +17,12 @@ namespace event {
// to add GetStatus() method somewhere (maybe in MuxerListener, maybe not). // to add GetStatus() method somewhere (maybe in MuxerListener, maybe not).
class MuxerListener { class MuxerListener {
public: public:
MuxerListener() {}; enum ContainerType {
virtual ~MuxerListener() {}; kContainerUnknown = 0,
kContainerMp4,
kContainerMpeg2ts,
kContainerWebM
};
// Called when muxing starts. This event happens before any other events. // Called when muxing starts. This event happens before any other events.
// For MPEG DASH Live profile, the initialization segment information is // For MPEG DASH Live profile, the initialization segment information is
@ -27,7 +31,8 @@ class MuxerListener {
// specified in |stream_infos|. // specified in |stream_infos|.
virtual void OnMediaStart(const MuxerOptions& muxer_options, virtual void OnMediaStart(const MuxerOptions& muxer_options,
const std::vector<StreamInfo*>& stream_infos, const std::vector<StreamInfo*>& 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 // Called when all files are written out and the muxer object does not output
// any more files. // any more files.
@ -57,6 +62,9 @@ class MuxerListener {
virtual void OnNewSegment(uint64 start_time, virtual void OnNewSegment(uint64 start_time,
uint64 duration, uint64 duration,
uint64 segment_file_size) = 0; uint64 segment_file_size) = 0;
protected:
MuxerListener() {};
virtual ~MuxerListener() {};
}; };
} // namespace event } // namespace event

View File

@ -37,7 +37,8 @@ void VodMediaInfoDumpMuxerListener::SetContentProtectionSchemeIdUri(
void VodMediaInfoDumpMuxerListener::OnMediaStart( void VodMediaInfoDumpMuxerListener::OnMediaStart(
const MuxerOptions& muxer_options, const MuxerOptions& muxer_options,
const std::vector<StreamInfo*>& stream_infos, const std::vector<StreamInfo*>& stream_infos,
uint32 time_scale) { uint32 time_scale,
ContainerType container_type) {
DLOG(INFO) DLOG(INFO)
<< "VodMediaInfoDumpMuxerListener does not care about OnMediaStart."; << "VodMediaInfoDumpMuxerListener does not care about OnMediaStart.";
} }

View File

@ -35,7 +35,8 @@ class VodMediaInfoDumpMuxerListener : public MuxerListener {
// MuxerListener implementation. // MuxerListener implementation.
virtual void OnMediaStart(const MuxerOptions& muxer_options, virtual void OnMediaStart(const MuxerOptions& muxer_options,
const std::vector<StreamInfo*>& stream_infos, const std::vector<StreamInfo*>& stream_infos,
uint32 time_scale) OVERRIDE; uint32 time_scale,
ContainerType container_type) OVERRIDE;
virtual void OnMediaEnd(const std::vector<StreamInfo*>& stream_infos, virtual void OnMediaEnd(const std::vector<StreamInfo*>& stream_infos,
bool has_init_range, bool has_init_range,

View File

@ -23,7 +23,8 @@ VodMpdNotifyMuxerListener::~VodMpdNotifyMuxerListener() {}
void VodMpdNotifyMuxerListener::OnMediaStart( void VodMpdNotifyMuxerListener::OnMediaStart(
const MuxerOptions& muxer_options, const MuxerOptions& muxer_options,
const std::vector<StreamInfo*>& stream_infos, const std::vector<StreamInfo*>& stream_infos,
uint32 time_scale) {} uint32 time_scale,
ContainerType container_type) {}
void VodMpdNotifyMuxerListener::OnMediaEnd( void VodMpdNotifyMuxerListener::OnMediaEnd(
const std::vector<StreamInfo*>& stream_infos, const std::vector<StreamInfo*>& stream_infos,

View File

@ -24,7 +24,8 @@ class VodMpdNotifyMuxerListener : public MuxerListener {
// MuxerListener implementation. // MuxerListener implementation.
virtual void OnMediaStart(const MuxerOptions& muxer_options, virtual void OnMediaStart(const MuxerOptions& muxer_options,
const std::vector<StreamInfo*>& stream_infos, const std::vector<StreamInfo*>& stream_infos,
uint32 time_scale) OVERRIDE; uint32 time_scale,
ContainerType container_type) OVERRIDE;
virtual void OnMediaEnd(const std::vector<StreamInfo*>& stream_infos, virtual void OnMediaEnd(const std::vector<StreamInfo*>& stream_infos,
bool has_init_range, bool has_init_range,

View File

@ -284,7 +284,10 @@ void MP4Muxer::FireOnMediaStartEvent() {
std::vector<StreamInfo*> stream_info_vec; std::vector<StreamInfo*> stream_info_vec;
GetStreamInfo(&stream_info_vec); GetStreamInfo(&stream_info_vec);
const uint32 timescale = segmenter_->GetReferenceTimeScale(); 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() { void MP4Muxer::FireOnMediaEndEvent() {