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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 // kReachedIdLimit is returned if the demuxer cannot handle another ID right | 201 // kReachedIdLimit is returned if the demuxer cannot handle another ID right |
202 // now. | 202 // now. |
203 Status AddId(const std::string& id, const std::string& type, | 203 Status AddId(const std::string& id, const std::string& type, |
204 std::vector<std::string>& codecs); | 204 std::vector<std::string>& codecs); |
205 | 205 |
206 // Notifies a caller via |tracks_updated_cb| that the set of media tracks | 206 // Notifies a caller via |tracks_updated_cb| that the set of media tracks |
207 // for a given |id| has changed. | 207 // for a given |id| has changed. |
208 void SetTracksWatcher(const std::string& id, | 208 void SetTracksWatcher(const std::string& id, |
209 const MediaTracksUpdatedCB& tracks_updated_cb); | 209 const MediaTracksUpdatedCB& tracks_updated_cb); |
210 | 210 |
211 // Notifies the demuxer that a track id has been assigned to a media track. | |
212 // If |track| is null the association for this |track_id| is removed. | |
wolenetz
2016/03/30 00:31:32
who owns the memory pointed to by |track|?
servolk
2016/03/30 01:13:13
It doesn't matter, because we don't actually care
wolenetz
2016/03/30 20:15:55
Hmm. Using a pointer just as an ID is not clear an
| |
213 void OnTrackIdAssigned(unsigned track_id, const MediaTrack* track) override; | |
214 | |
215 // Finds a DemuxerStream corresponding to the given blink |track_id|. Note | |
216 // that the input track id is blink track id and not bytestream track id. | |
217 const DemuxerStream* GetDemuxerStreamByTrackId( | |
218 unsigned track_id) const override; | |
219 | |
211 // Removed an ID & associated resources that were previously added with | 220 // Removed an ID & associated resources that were previously added with |
212 // AddId(). | 221 // AddId(). |
213 void RemoveId(const std::string& id); | 222 void RemoveId(const std::string& id); |
214 | 223 |
215 // Gets the currently buffered ranges for the specified ID. | 224 // Gets the currently buffered ranges for the specified ID. |
216 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; | 225 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; |
217 | 226 |
218 // Appends media data to the source buffer associated with |id|, applying | 227 // Appends media data to the source buffer associated with |id|, applying |
219 // and possibly updating |*timestamp_offset| during coded frame processing. | 228 // and possibly updating |*timestamp_offset| during coded frame processing. |
220 // |append_window_start| and |append_window_end| correspond to the MSE spec's | 229 // |append_window_start| and |append_window_end| correspond to the MSE spec's |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 // Returns true if any stream has seeked to a time without buffered data. | 320 // Returns true if any stream has seeked to a time without buffered data. |
312 bool IsSeekWaitingForData_Locked() const; | 321 bool IsSeekWaitingForData_Locked() const; |
313 | 322 |
314 // Returns true if all streams can successfully call EndOfStream, | 323 // Returns true if all streams can successfully call EndOfStream, |
315 // false if any can not. | 324 // false if any can not. |
316 bool CanEndOfStream_Locked() const; | 325 bool CanEndOfStream_Locked() const; |
317 | 326 |
318 // MediaSourceState callbacks. | 327 // MediaSourceState callbacks. |
319 void OnSourceInitDone(const StreamParser::InitParameters& params); | 328 void OnSourceInitDone(const StreamParser::InitParameters& params); |
320 | 329 |
321 // Creates a DemuxerStream for the specified |type|. | 330 // Creates a DemuxerStream for the specified |media_track|. |
322 // Returns a new ChunkDemuxerStream instance if a stream of this type | 331 // Returns a new ChunkDemuxerStream instance if a stream of this type |
323 // has not been created before. Returns NULL otherwise. | 332 // has not been created before. Returns NULL otherwise. |
324 ChunkDemuxerStream* CreateDemuxerStream(DemuxerStream::Type type); | 333 ChunkDemuxerStream* CreateDemuxerStream(const MediaTrack& media_track); |
325 | 334 |
326 void OnNewTextTrack(ChunkDemuxerStream* text_stream, | 335 void OnNewTextTrack(ChunkDemuxerStream* text_stream, |
327 const TextTrackConfig& config); | 336 const TextTrackConfig& config); |
328 | 337 |
329 // Returns true if |source_id| is valid, false otherwise. | 338 // Returns true if |source_id| is valid, false otherwise. |
330 bool IsValidId(const std::string& source_id) const; | 339 bool IsValidId(const std::string& source_id) const; |
331 | 340 |
332 // Increases |duration_| to |new_duration|, if |new_duration| is higher. | 341 // Increases |duration_| to |new_duration|, if |new_duration| is higher. |
333 void IncreaseDurationIfNecessary(base::TimeDelta new_duration); | 342 void IncreaseDurationIfNecessary(base::TimeDelta new_duration); |
334 | 343 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 PipelineStatusCB init_cb_; | 383 PipelineStatusCB init_cb_; |
375 // Callback to execute upon seek completion. | 384 // Callback to execute upon seek completion. |
376 // TODO(wolenetz/acolwell): Protect against possible double-locking by first | 385 // TODO(wolenetz/acolwell): Protect against possible double-locking by first |
377 // releasing |lock_| before executing this callback. See | 386 // releasing |lock_| before executing this callback. See |
378 // http://crbug.com/308226 | 387 // http://crbug.com/308226 |
379 PipelineStatusCB seek_cb_; | 388 PipelineStatusCB seek_cb_; |
380 | 389 |
381 scoped_ptr<ChunkDemuxerStream> audio_; | 390 scoped_ptr<ChunkDemuxerStream> audio_; |
382 scoped_ptr<ChunkDemuxerStream> video_; | 391 scoped_ptr<ChunkDemuxerStream> video_; |
383 | 392 |
393 std::map<unsigned, const MediaTrack*> track_id_to_track_map_; | |
394 std::map<const MediaTrack*, const DemuxerStream*> track_to_stream_map_; | |
395 | |
384 base::TimeDelta duration_; | 396 base::TimeDelta duration_; |
385 | 397 |
386 // The duration passed to the last SetDuration(). If | 398 // The duration passed to the last SetDuration(). If |
387 // SetDuration() is never called or an AppendData() call or | 399 // SetDuration() is never called or an AppendData() call or |
388 // a EndOfStream() call changes |duration_|, then this | 400 // a EndOfStream() call changes |duration_|, then this |
389 // variable is set to < 0 to indicate that the |duration_| represents | 401 // variable is set to < 0 to indicate that the |duration_| represents |
390 // the actual duration instead of a user specified value. | 402 // the actual duration instead of a user specified value. |
391 double user_specified_duration_; | 403 double user_specified_duration_; |
392 | 404 |
393 base::Time timeline_offset_; | 405 base::Time timeline_offset_; |
(...skipping 10 matching lines...) Expand all Loading... | |
404 | 416 |
405 // Indicates that splice frame generation is enabled. | 417 // Indicates that splice frame generation is enabled. |
406 const bool splice_frames_enabled_; | 418 const bool splice_frames_enabled_; |
407 | 419 |
408 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 420 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
409 }; | 421 }; |
410 | 422 |
411 } // namespace media | 423 } // namespace media |
412 | 424 |
413 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 425 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
OLD | NEW |