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/ffmpeg_demuxer.h" | 5 #include "media/filters/ffmpeg_demuxer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 CHECK(blocking_thread_.Start()); | 642 CHECK(blocking_thread_.Start()); |
643 base::PostTaskAndReplyWithResult( | 643 base::PostTaskAndReplyWithResult( |
644 blocking_thread_.message_loop_proxy().get(), | 644 blocking_thread_.message_loop_proxy().get(), |
645 FROM_HERE, | 645 FROM_HERE, |
646 base::Bind(&FFmpegGlue::OpenContext, base::Unretained(glue_.get())), | 646 base::Bind(&FFmpegGlue::OpenContext, base::Unretained(glue_.get())), |
647 base::Bind(&FFmpegDemuxer::OnOpenContextDone, | 647 base::Bind(&FFmpegDemuxer::OnOpenContextDone, |
648 weak_factory_.GetWeakPtr(), | 648 weak_factory_.GetWeakPtr(), |
649 status_cb)); | 649 status_cb)); |
650 } | 650 } |
651 | 651 |
| 652 base::Time FFmpegDemuxer::GetTimelineOffset() const { |
| 653 return timeline_offset_; |
| 654 } |
| 655 |
652 DemuxerStream* FFmpegDemuxer::GetStream(DemuxerStream::Type type) { | 656 DemuxerStream* FFmpegDemuxer::GetStream(DemuxerStream::Type type) { |
653 DCHECK(task_runner_->BelongsToCurrentThread()); | 657 DCHECK(task_runner_->BelongsToCurrentThread()); |
654 return GetFFmpegStream(type); | 658 return GetFFmpegStream(type); |
655 } | 659 } |
656 | 660 |
657 FFmpegDemuxerStream* FFmpegDemuxer::GetFFmpegStream( | 661 FFmpegDemuxerStream* FFmpegDemuxer::GetFFmpegStream( |
658 DemuxerStream::Type type) const { | 662 DemuxerStream::Type type) const { |
659 StreamVector::const_iterator iter; | 663 StreamVector::const_iterator iter; |
660 for (iter = streams_.begin(); iter != streams_.end(); ++iter) { | 664 for (iter = streams_.begin(); iter != streams_.end(); ++iter) { |
661 if (*iter && (*iter)->type() == type) { | 665 if (*iter && (*iter)->type() == type) { |
662 return *iter; | 666 return *iter; |
663 } | 667 } |
664 } | 668 } |
665 return NULL; | 669 return NULL; |
666 } | 670 } |
667 | 671 |
668 base::Time FFmpegDemuxer::GetTimelineOffset() const { | |
669 return timeline_offset_; | |
670 } | |
671 | |
672 Demuxer::Liveness FFmpegDemuxer::GetLiveness() const { | 672 Demuxer::Liveness FFmpegDemuxer::GetLiveness() const { |
673 DCHECK(task_runner_->BelongsToCurrentThread()); | 673 DCHECK(task_runner_->BelongsToCurrentThread()); |
674 return liveness_; | 674 return liveness_; |
675 } | 675 } |
676 | 676 |
677 void FFmpegDemuxer::AddTextStreams() { | 677 void FFmpegDemuxer::AddTextStreams() { |
678 DCHECK(task_runner_->BelongsToCurrentThread()); | 678 DCHECK(task_runner_->BelongsToCurrentThread()); |
679 | 679 |
680 for (StreamVector::size_type idx = 0; idx < streams_.size(); ++idx) { | 680 for (StreamVector::size_type idx = 0; idx < streams_.size(); ++idx) { |
681 FFmpegDemuxerStream* stream = streams_[idx]; | 681 FFmpegDemuxerStream* stream = streams_[idx]; |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 } | 1227 } |
1228 for (size_t i = 0; i < buffered.size(); ++i) | 1228 for (size_t i = 0; i < buffered.size(); ++i) |
1229 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); | 1229 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); |
1230 } | 1230 } |
1231 | 1231 |
1232 void FFmpegDemuxer::OnDataSourceError() { | 1232 void FFmpegDemuxer::OnDataSourceError() { |
1233 host_->OnDemuxerError(PIPELINE_ERROR_READ); | 1233 host_->OnDemuxerError(PIPELINE_ERROR_READ); |
1234 } | 1234 } |
1235 | 1235 |
1236 } // namespace media | 1236 } // namespace media |
OLD | NEW |