| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Demuxer implementation. | 55 // Demuxer implementation. |
| 56 virtual void Initialize(DemuxerHost* host, | 56 virtual void Initialize(DemuxerHost* host, |
| 57 const PipelineStatusCB& cb) OVERRIDE; | 57 const PipelineStatusCB& cb) OVERRIDE; |
| 58 virtual void Stop(const base::Closure& callback) OVERRIDE; | 58 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 59 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; | 59 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
| 60 virtual void OnAudioRendererDisabled() OVERRIDE; | 60 virtual void OnAudioRendererDisabled() OVERRIDE; |
| 61 virtual DemuxerStream* GetStream(DemuxerStream::Type type) OVERRIDE; | 61 virtual DemuxerStream* GetStream(DemuxerStream::Type type) OVERRIDE; |
| 62 virtual base::TimeDelta GetStartTime() const OVERRIDE; | 62 virtual base::TimeDelta GetStartTime() const OVERRIDE; |
| 63 | 63 |
| 64 // Methods used by an external object to control this demuxer. | 64 // Methods used by an external object to control this demuxer. |
| 65 // |
| 66 // Indicates that a new Seek() call is on its way. Any pending Reads on the |
| 67 // DemuxerStream objects should be aborted immediately inside this call and |
| 68 // future Read calls should return kAborted until the Seek() call occurs. |
| 69 // This method MUST ALWAYS be called before Seek() is called to signal that |
| 70 // the next Seek() call represents the seek point we actually want to return |
| 71 // data for. |
| 65 void StartWaitingForSeek(); | 72 void StartWaitingForSeek(); |
| 73 |
| 74 // Indicates that a Seek() call is on its way, but another seek has been |
| 75 // requested that will override the impending Seek() call. Any pending Reads |
| 76 // on the DemuxerStream objects should be aborted immediately inside this call |
| 77 // and future Read calls should return kAborted until the next |
| 78 // StartWaitingForSeek() call. This method also arranges for the next Seek() |
| 79 // call received before a StartWaitingForSeek() call to immediately call its |
| 80 // callback without waiting for any data. |
| 66 void CancelPendingSeek(); | 81 void CancelPendingSeek(); |
| 67 | 82 |
| 68 // Registers a new |id| to use for AppendData() calls. |type| indicates | 83 // Registers a new |id| to use for AppendData() calls. |type| indicates |
| 69 // the MIME type for the data that we intend to append for this ID. | 84 // the MIME type for the data that we intend to append for this ID. |
| 70 // kOk is returned if the demuxer has enough resources to support another ID | 85 // kOk is returned if the demuxer has enough resources to support another ID |
| 71 // and supports the format indicated by |type|. | 86 // and supports the format indicated by |type|. |
| 72 // kNotSupported is returned if |type| is not a supported format. | 87 // kNotSupported is returned if |type| is not a supported format. |
| 73 // kReachedIdLimit is returned if the demuxer cannot handle another ID right | 88 // kReachedIdLimit is returned if the demuxer cannot handle another ID right |
| 74 // now. | 89 // now. |
| 75 Status AddId(const std::string& id, const std::string& type, | 90 Status AddId(const std::string& id, const std::string& type, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 184 |
| 170 // Sets |duration_| to |new_duration|, sets |user_specified_duration_| to -1 | 185 // Sets |duration_| to |new_duration|, sets |user_specified_duration_| to -1 |
| 171 // and notifies |host_|. | 186 // and notifies |host_|. |
| 172 void UpdateDuration(base::TimeDelta new_duration); | 187 void UpdateDuration(base::TimeDelta new_duration); |
| 173 | 188 |
| 174 // Returns the ranges representing the buffered data in the demuxer. | 189 // Returns the ranges representing the buffered data in the demuxer. |
| 175 Ranges<base::TimeDelta> GetBufferedRanges() const; | 190 Ranges<base::TimeDelta> GetBufferedRanges() const; |
| 176 | 191 |
| 177 mutable base::Lock lock_; | 192 mutable base::Lock lock_; |
| 178 State state_; | 193 State state_; |
| 194 bool cancel_next_seek_; |
| 179 | 195 |
| 180 DemuxerHost* host_; | 196 DemuxerHost* host_; |
| 181 base::Closure open_cb_; | 197 base::Closure open_cb_; |
| 182 NeedKeyCB need_key_cb_; | 198 NeedKeyCB need_key_cb_; |
| 183 AddTextTrackCB add_text_track_cb_; | 199 AddTextTrackCB add_text_track_cb_; |
| 184 // Callback used to report error strings that can help the web developer | 200 // Callback used to report error strings that can help the web developer |
| 185 // figure out what is wrong with the content. | 201 // figure out what is wrong with the content. |
| 186 LogCB log_cb_; | 202 LogCB log_cb_; |
| 187 | 203 |
| 188 PipelineStatusCB init_cb_; | 204 PipelineStatusCB init_cb_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 211 // removed with RemoveID() but can not be re-added (yet). | 227 // removed with RemoveID() but can not be re-added (yet). |
| 212 std::string source_id_audio_; | 228 std::string source_id_audio_; |
| 213 std::string source_id_video_; | 229 std::string source_id_video_; |
| 214 | 230 |
| 215 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 231 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
| 216 }; | 232 }; |
| 217 | 233 |
| 218 } // namespace media | 234 } // namespace media |
| 219 | 235 |
| 220 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 236 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
| OLD | NEW |