| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 5 #ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
| 6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| 11 #include "media/base/byte_queue.h" | 11 #include "media/base/byte_queue.h" |
| 12 #include "media/base/demuxer.h" | 12 #include "media/base/demuxer.h" |
| 13 #include "media/base/stream_parser.h" | 13 #include "media/base/stream_parser.h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 | 16 |
| 17 class ChunkDemuxerClient; | 17 class ChunkDemuxerClient; |
| 18 class ChunkDemuxerStream; | 18 class ChunkDemuxerStream; |
| 19 class FFmpegURLProtocol; | 19 class FFmpegURLProtocol; |
| 20 | 20 |
| 21 // Demuxer implementation that allows chunks of media data to be passed | 21 // Demuxer implementation that allows chunks of media data to be passed |
| 22 // from JavaScript to the media stack. | 22 // from JavaScript to the media stack. |
| 23 class MEDIA_EXPORT ChunkDemuxer : public Demuxer, public StreamParserHost { | 23 class MEDIA_EXPORT ChunkDemuxer : public Demuxer, public StreamParserHost { |
| 24 public: | 24 public: |
| 25 explicit ChunkDemuxer(ChunkDemuxerClient* client); | 25 explicit ChunkDemuxer(ChunkDemuxerClient* client); |
| 26 virtual ~ChunkDemuxer(); | |
| 27 | 26 |
| 28 // Demuxer implementation. | 27 // Demuxer implementation. |
| 29 virtual void Initialize(DemuxerHost* host, | 28 virtual void Initialize(DemuxerHost* host, |
| 30 const PipelineStatusCB& cb) OVERRIDE; | 29 const PipelineStatusCB& cb) OVERRIDE; |
| 31 virtual void Stop(const base::Closure& callback) OVERRIDE; | 30 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 32 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 31 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
| 33 virtual void OnAudioRendererDisabled() OVERRIDE; | 32 virtual void OnAudioRendererDisabled() OVERRIDE; |
| 34 virtual scoped_refptr<DemuxerStream> GetStream( | 33 virtual scoped_refptr<DemuxerStream> GetStream( |
| 35 DemuxerStream::Type type) OVERRIDE; | 34 DemuxerStream::Type type) OVERRIDE; |
| 36 virtual base::TimeDelta GetStartTime() const OVERRIDE; | 35 virtual base::TimeDelta GetStartTime() const OVERRIDE; |
| 37 virtual int GetBitrate() OVERRIDE; | 36 virtual int GetBitrate() OVERRIDE; |
| 38 virtual bool IsLocalSource() OVERRIDE; | 37 virtual bool IsLocalSource() OVERRIDE; |
| 39 virtual bool IsSeekable() OVERRIDE; | 38 virtual bool IsSeekable() OVERRIDE; |
| 40 | 39 |
| 41 // Methods used by an external object to control this demuxer. | 40 // Methods used by an external object to control this demuxer. |
| 42 void FlushData(); | 41 void FlushData(); |
| 43 | 42 |
| 44 // Appends media data to the stream. Returns false if this method | 43 // Appends media data to the stream. Returns false if this method |
| 45 // is called in an invalid state. | 44 // is called in an invalid state. |
| 46 bool AppendData(const uint8* data, size_t length); | 45 bool AppendData(const uint8* data, size_t length); |
| 47 void EndOfStream(PipelineStatus status); | 46 void EndOfStream(PipelineStatus status); |
| 48 bool HasEnded(); | 47 bool HasEnded(); |
| 49 void Shutdown(); | 48 void Shutdown(); |
| 50 | 49 |
| 51 private: | 50 private: |
| 51 virtual ~ChunkDemuxer(); |
| 52 |
| 52 enum State { | 53 enum State { |
| 53 WAITING_FOR_INIT, | 54 WAITING_FOR_INIT, |
| 54 INITIALIZING, | 55 INITIALIZING, |
| 55 INITIALIZED, | 56 INITIALIZED, |
| 56 ENDED, | 57 ENDED, |
| 57 PARSE_ERROR, | 58 PARSE_ERROR, |
| 58 SHUTDOWN, | 59 SHUTDOWN, |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 void ChangeState_Locked(State new_state); | 62 void ChangeState_Locked(State new_state); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 bool seek_waits_for_data_; | 95 bool seek_waits_for_data_; |
| 95 | 96 |
| 96 ByteQueue byte_queue_; | 97 ByteQueue byte_queue_; |
| 97 | 98 |
| 98 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 99 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 } // namespace media | 102 } // namespace media |
| 102 | 103 |
| 103 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 104 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
| OLD | NEW |