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/bind.h" | 10 #include "base/bind.h" |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 561 |
562 int64 filesize_in_bytes = 0; | 562 int64 filesize_in_bytes = 0; |
563 GetSize(&filesize_in_bytes); | 563 GetSize(&filesize_in_bytes); |
564 bitrate_ = CalculateBitrate(format_context_, max_duration, filesize_in_bytes); | 564 bitrate_ = CalculateBitrate(format_context_, max_duration, filesize_in_bytes); |
565 if (bitrate_ > 0) | 565 if (bitrate_ > 0) |
566 data_source_->SetBitrate(bitrate_); | 566 data_source_->SetBitrate(bitrate_); |
567 | 567 |
568 status_cb.Run(PIPELINE_OK); | 568 status_cb.Run(PIPELINE_OK); |
569 } | 569 } |
570 | 570 |
571 | |
572 int FFmpegDemuxer::GetBitrate() { | |
573 DCHECK(format_context_) << "Initialize() has not been called"; | |
574 return bitrate_; | |
575 } | |
576 | |
577 void FFmpegDemuxer::SeekTask(base::TimeDelta time, const PipelineStatusCB& cb) { | 571 void FFmpegDemuxer::SeekTask(base::TimeDelta time, const PipelineStatusCB& cb) { |
578 DCHECK_EQ(MessageLoop::current(), message_loop_); | 572 DCHECK_EQ(MessageLoop::current(), message_loop_); |
579 | 573 |
580 // Tell streams to flush buffers due to seeking. | 574 // Tell streams to flush buffers due to seeking. |
581 StreamVector::iterator iter; | 575 StreamVector::iterator iter; |
582 for (iter = streams_.begin(); iter != streams_.end(); ++iter) { | 576 for (iter = streams_.begin(); iter != streams_.end(); ++iter) { |
583 if (*iter) | 577 if (*iter) |
584 (*iter)->FlushBuffers(); | 578 (*iter)->FlushBuffers(); |
585 } | 579 } |
586 | 580 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 } else if (audio) { | 726 } else if (audio) { |
733 buffered = audio->GetBufferedRanges(); | 727 buffered = audio->GetBufferedRanges(); |
734 } else if (video) { | 728 } else if (video) { |
735 buffered = video->GetBufferedRanges(); | 729 buffered = video->GetBufferedRanges(); |
736 } | 730 } |
737 for (size_t i = 0; i < buffered.size(); ++i) | 731 for (size_t i = 0; i < buffered.size(); ++i) |
738 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); | 732 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); |
739 } | 733 } |
740 | 734 |
741 } // namespace media | 735 } // namespace media |
OLD | NEW |