| Index: media/filters/chunk_demuxer.h
|
| diff --git a/media/filters/chunk_demuxer.h b/media/filters/chunk_demuxer.h
|
| index a3d64264fa7be0d4a197a474367fbba0b88fc9dc..e469aa96b5cb1a3d38fbdd4866abdac6bcd23d8e 100644
|
| --- a/media/filters/chunk_demuxer.h
|
| +++ b/media/filters/chunk_demuxer.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_
|
| #define MEDIA_FILTERS_CHUNK_DEMUXER_H_
|
|
|
| +#include <deque>
|
| #include <map>
|
| #include <string>
|
| #include <utility>
|
| @@ -19,10 +20,106 @@
|
|
|
| namespace media {
|
|
|
| -class ChunkDemuxerStream;
|
| class FFmpegURLProtocol;
|
| class SourceState;
|
|
|
| +class ChunkDemuxerStream : public DemuxerStream {
|
| + public:
|
| + typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue;
|
| +
|
| + explicit ChunkDemuxerStream(Type type);
|
| + virtual ~ChunkDemuxerStream();
|
| +
|
| + // ChunkDemuxerStream control methods.
|
| + void StartReturningData();
|
| + void AbortReads();
|
| + void CompletePendingReadIfPossible();
|
| + void Shutdown();
|
| +
|
| + // SourceBufferStream manipulation methods.
|
| + void Seek(base::TimeDelta time);
|
| + bool IsSeekWaitingForData() const;
|
| +
|
| + // Add buffers to this stream. Buffers are stored in SourceBufferStreams,
|
| + // which handle ordering and overlap resolution.
|
| + // Returns true if buffers were successfully added.
|
| + bool Append(const StreamParser::BufferQueue& buffers);
|
| +
|
| + // Removes buffers between |start| and |end| according to the steps
|
| + // in the "Coded Frame Removal Algorithm" in the Media Source
|
| + // Extensions Spec.
|
| + // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#sourcebuffer-coded-frame-removal
|
| + //
|
| + // |duration| is the current duration of the presentation. It is
|
| + // required by the computation outlined in the spec.
|
| + void Remove(base::TimeDelta start, base::TimeDelta end,
|
| + base::TimeDelta duration);
|
| +
|
| + // Signal to the stream that duration has changed to |duration|.
|
| + void OnSetDuration(base::TimeDelta duration);
|
| +
|
| + // Returns the range of buffered data in this stream, capped at |duration|.
|
| + Ranges<base::TimeDelta> GetBufferedRanges(base::TimeDelta duration) const;
|
| +
|
| + // Returns the duration of the buffered data.
|
| + // Returns base::TimeDelta() if the stream has no buffered data.
|
| + base::TimeDelta GetBufferedDuration() const;
|
| +
|
| + // Signal to the stream that buffers handed in through subsequent calls to
|
| + // Append() belong to a media segment that starts at |start_timestamp|.
|
| + void OnNewMediaSegment(base::TimeDelta start_timestamp);
|
| +
|
| + // Called when midstream config updates occur.
|
| + // Returns true if the new config is accepted.
|
| + // Returns false if the new config should trigger an error.
|
| + bool UpdateAudioConfig(const AudioDecoderConfig& config, const LogCB& log_cb);
|
| + bool UpdateVideoConfig(const VideoDecoderConfig& config, const LogCB& log_cb);
|
| + void UpdateTextConfig(const TextTrackConfig& config, const LogCB& log_cb);
|
| +
|
| + void MarkEndOfStream();
|
| + void UnmarkEndOfStream();
|
| +
|
| + // DemuxerStream methods.
|
| + virtual void Read(const ReadCB& read_cb) OVERRIDE;
|
| + virtual Type type() OVERRIDE;
|
| + virtual void EnableBitstreamConverter() OVERRIDE;
|
| + virtual AudioDecoderConfig audio_decoder_config() OVERRIDE;
|
| + virtual VideoDecoderConfig video_decoder_config() OVERRIDE;
|
| +
|
| + // Returns the text track configuration. It is an error to call this method
|
| + // if type() != TEXT.
|
| + TextTrackConfig text_track_config();
|
| +
|
| + // Sets the memory limit, in bytes, on the SourceBufferStream.
|
| + void set_memory_limit_for_testing(int memory_limit) {
|
| + stream_->set_memory_limit_for_testing(memory_limit);
|
| + }
|
| +
|
| + private:
|
| + enum State {
|
| + UNINITIALIZED,
|
| + RETURNING_DATA_FOR_READS,
|
| + RETURNING_ABORT_FOR_READS,
|
| + SHUTDOWN,
|
| + };
|
| +
|
| + // Assigns |state_| to |state|
|
| + void ChangeState_Locked(State state);
|
| +
|
| + void CompletePendingReadIfPossible_Locked();
|
| +
|
| + // Specifies the type of the stream.
|
| + Type type_;
|
| +
|
| + scoped_ptr<SourceBufferStream> stream_;
|
| +
|
| + mutable base::Lock lock_;
|
| + State state_;
|
| + ReadCB read_cb_;
|
| +
|
| + DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream);
|
| +};
|
| +
|
| // Demuxer implementation that allows chunks of media data to be passed
|
| // from JavaScript to the media stack.
|
| class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
|
|
|