From b6e127416b8c56363b701d7452db0395e2a585de Mon Sep 17 00:00:00 2001 From: Rintaro Kuroiwa Date: Fri, 6 Dec 2013 18:49:28 -0800 Subject: [PATCH] MuxerListener interface Muxer event handler interface. Change-Id: Iee4b43c49ae9a105bbadb61b6ae9ed2e66bfaba2 --- media/event/muxer_listener.h | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 media/event/muxer_listener.h diff --git a/media/event/muxer_listener.h b/media/event/muxer_listener.h new file mode 100644 index 0000000000..a82d7c7cbe --- /dev/null +++ b/media/event/muxer_listener.h @@ -0,0 +1,63 @@ +// Event handler for events fired by Muxer. +#ifndef MEDIA_EVENT_MUXER_LISTENER_H_ +#define MEDIA_EVENT_MUXER_LISTENER_H_ + +#include + +#include "base/basictypes.h" + +namespace media { + +class MuxerOptions; +class StreamInfo; + +namespace event { + +class MuxerListener { + public: + MuxerListener() {}; + virtual ~MuxerListener() {}; + + // Called when muxing starts. This event happens before any other events. + // For MPEG DASH Live profile, the initialization segment information is + // available from StreamInfo. + // |time_scale| is a reference time scale regardless of the time scale(s) + // specified in |stream_infos|. + virtual void OnMediaStart(const MuxerOptions& muxer_options, + const std::vector& stream_infos, + uint32 time_scale) = 0; + + // Called when all files are written out and the muxer object does not output + // any more files. + // Note: This event might not be very interesting to MPEG DASH Live profile. + // |init_range_{start,end}| is the byte range of initialization segment, in + // the media file. If |has_init_range| is false, these values are ignored. + // |index_range_{start,end}| is the byte range of segment index, in the media + // file. If |has_index_range| is false, these values are ignored. + // Both ranges are inclusive. + // Media length of |duration_seconds|. + // |file_size| of the media in bytes. + virtual void OnMediaEnd(const std::vector& stream_infos, + bool has_init_range, + uint64 init_range_start, + uint64 init_range_end, + bool has_index_range, + uint64 index_range_start, + uint64 index_range_end, + float duration_seconds, + uint64 file_size) = 0; + + // Called when a segment has been muxed and the file has been written. + // Note: For video on demand (VOD), this would be for subsegments. + // |start_time| and |duration| are relative to time scale specified + // OnMediaStart(). + // |segment_file_size| in bytes. + virtual void OnNewSegment(uint64 start_time, + uint64 duration, + uint64 segment_file_size) = 0; +}; + +} // namespace event +} // namespace media + +#endif // MEDIA_EVENT_MUXER_LISTENER_H_