| 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 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 12 #include "media/base/byte_queue.h" | 12 #include "media/base/byte_queue.h" |
| 13 #include "media/base/demuxer.h" | 13 #include "media/base/demuxer.h" |
| 14 #include "media/base/stream_parser.h" | 14 #include "media/base/stream_parser.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 class ChunkDemuxerClient; | 18 class ChunkDemuxerClient; |
| 19 class ChunkDemuxerStream; | 19 class ChunkDemuxerStream; |
| 20 class FFmpegURLProtocol; | 20 class FFmpegURLProtocol; |
| 21 | 21 |
| 22 // Demuxer implementation that allows chunks of media data to be passed | 22 // Demuxer implementation that allows chunks of media data to be passed |
| 23 // from JavaScript to the media stack. | 23 // from JavaScript to the media stack. |
| 24 class MEDIA_EXPORT ChunkDemuxer : public Demuxer, public StreamParserHost { | 24 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { |
| 25 public: | 25 public: |
| 26 enum Status { | 26 enum Status { |
| 27 kOk, // ID added w/o error. | 27 kOk, // ID added w/o error. |
| 28 kNotSupported, // Type specified is not supported. | 28 kNotSupported, // Type specified is not supported. |
| 29 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. | 29 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 explicit ChunkDemuxer(ChunkDemuxerClient* client); | 32 explicit ChunkDemuxer(ChunkDemuxerClient* client); |
| 33 virtual ~ChunkDemuxer(); | 33 virtual ~ChunkDemuxer(); |
| 34 | 34 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 void ChangeState_Locked(State new_state); | 81 void ChangeState_Locked(State new_state); |
| 82 | 82 |
| 83 // Reports an error and puts the demuxer in a state where it won't accept more | 83 // Reports an error and puts the demuxer in a state where it won't accept more |
| 84 // data. | 84 // data. |
| 85 void ReportError_Locked(PipelineStatus error); | 85 void ReportError_Locked(PipelineStatus error); |
| 86 | 86 |
| 87 void OnStreamParserInitDone(bool success, base::TimeDelta duration); | 87 void OnStreamParserInitDone(bool success, base::TimeDelta duration); |
| 88 | 88 |
| 89 // StreamParserHost implementation. | 89 // StreamParser callbacks. |
| 90 virtual bool OnNewConfigs(const AudioDecoderConfig& audio_config, | 90 bool OnNewConfigs(const AudioDecoderConfig& audio_config, |
| 91 const VideoDecoderConfig& video_config) OVERRIDE; | 91 const VideoDecoderConfig& video_config); |
| 92 virtual bool OnAudioBuffers(const BufferQueue& buffer) OVERRIDE; | 92 bool OnAudioBuffers(const StreamParser::BufferQueue& buffer); |
| 93 virtual bool OnVideoBuffers(const BufferQueue& buffer) OVERRIDE; | 93 bool OnVideoBuffers(const StreamParser::BufferQueue& buffer); |
| 94 | 94 |
| 95 base::Lock lock_; | 95 base::Lock lock_; |
| 96 State state_; | 96 State state_; |
| 97 | 97 |
| 98 DemuxerHost* host_; | 98 DemuxerHost* host_; |
| 99 ChunkDemuxerClient* client_; | 99 ChunkDemuxerClient* client_; |
| 100 PipelineStatusCB init_cb_; | 100 PipelineStatusCB init_cb_; |
| 101 PipelineStatusCB seek_cb_; | 101 PipelineStatusCB seek_cb_; |
| 102 | 102 |
| 103 scoped_refptr<ChunkDemuxerStream> audio_; | 103 scoped_refptr<ChunkDemuxerStream> audio_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 115 | 115 |
| 116 // TODO(acolwell): Remove this when fixing http://crbug.com/122909 | 116 // TODO(acolwell): Remove this when fixing http://crbug.com/122909 |
| 117 std::string source_id_; | 117 std::string source_id_; |
| 118 | 118 |
| 119 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 119 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 } // namespace media | 122 } // namespace media |
| 123 | 123 |
| 124 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 124 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
| OLD | NEW |