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 #include "media/filters/chunk_demuxer.h" | 5 #include "media/filters/chunk_demuxer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 475 } |
476 | 476 |
477 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK); | 477 base::ResetAndReturn(&seek_cb_).Run(PIPELINE_OK); |
478 } | 478 } |
479 | 479 |
480 // Demuxer implementation. | 480 // Demuxer implementation. |
481 base::Time ChunkDemuxer::GetTimelineOffset() const { | 481 base::Time ChunkDemuxer::GetTimelineOffset() const { |
482 return timeline_offset_; | 482 return timeline_offset_; |
483 } | 483 } |
484 | 484 |
485 DemuxerStream* ChunkDemuxer::GetStream(DemuxerStream::Type type) { | 485 std::vector<DemuxerStream*> ChunkDemuxer::GetStreams() { |
486 DCHECK_NE(type, DemuxerStream::TEXT); | |
487 base::AutoLock auto_lock(lock_); | 486 base::AutoLock auto_lock(lock_); |
488 | 487 |
489 // TODO(servolk): For now return only the first enabled audio/video stream, | 488 std::vector<DemuxerStream*> result; |
490 // since this GetStream method is part of the implementation of the | 489 for (const auto& s : audio_streams_) |
491 // DemuxerStreamProvider interface that is used in many places and can't be | 490 result.push_back(s.get()); |
492 // changed easily. It will be fixed later, when we add support for multiple | |
493 // streams/tracks in DemuxerStreamProvider, tracked by crbug.com/646669 | |
494 if (type == DemuxerStream::AUDIO) | |
495 for (const auto& s : audio_streams_) | |
496 if (s->enabled()) | |
497 return s.get(); | |
498 | 491 |
499 if (type == DemuxerStream::VIDEO) | 492 for (const auto& s : video_streams_) |
500 for (const auto& s : video_streams_) | 493 result.push_back(s.get()); |
501 if (s->enabled()) | |
502 return s.get(); | |
503 | 494 |
504 return NULL; | 495 return result; |
505 } | 496 } |
506 | 497 |
507 TimeDelta ChunkDemuxer::GetStartTime() const { | 498 TimeDelta ChunkDemuxer::GetStartTime() const { |
508 return TimeDelta(); | 499 return TimeDelta(); |
509 } | 500 } |
510 | 501 |
511 int64_t ChunkDemuxer::GetMemoryUsage() const { | 502 int64_t ChunkDemuxer::GetMemoryUsage() const { |
512 base::AutoLock auto_lock(lock_); | 503 base::AutoLock auto_lock(lock_); |
513 int64_t mem = 0; | 504 int64_t mem = 0; |
514 for (const auto& s : audio_streams_) | 505 for (const auto& s : audio_streams_) |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 } | 1298 } |
1308 | 1299 |
1309 void ChunkDemuxer::ShutdownAllStreams() { | 1300 void ChunkDemuxer::ShutdownAllStreams() { |
1310 for (auto itr = source_state_map_.begin(); itr != source_state_map_.end(); | 1301 for (auto itr = source_state_map_.begin(); itr != source_state_map_.end(); |
1311 ++itr) { | 1302 ++itr) { |
1312 itr->second->Shutdown(); | 1303 itr->second->Shutdown(); |
1313 } | 1304 } |
1314 } | 1305 } |
1315 | 1306 |
1316 } // namespace media | 1307 } // namespace media |
OLD | NEW |