| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 DemuxerStream::Type type) { | 344 DemuxerStream::Type type) { |
| 345 DCHECK_GE(type, 0); | 345 DCHECK_GE(type, 0); |
| 346 DCHECK_LT(type, DemuxerStream::NUM_TYPES); | 346 DCHECK_LT(type, DemuxerStream::NUM_TYPES); |
| 347 return streams_[type]; | 347 return streams_[type]; |
| 348 } | 348 } |
| 349 | 349 |
| 350 base::TimeDelta FFmpegDemuxer::GetStartTime() const { | 350 base::TimeDelta FFmpegDemuxer::GetStartTime() const { |
| 351 return start_time_; | 351 return start_time_; |
| 352 } | 352 } |
| 353 | 353 |
| 354 int FFmpegDemuxer::Read(int size, uint8* data) { | 354 size_t FFmpegDemuxer::Read(size_t size, uint8* data) { |
| 355 DCHECK(data_source_); | 355 DCHECK(data_source_); |
| 356 | 356 |
| 357 // If read has ever failed, return with an error. | 357 // If read has ever failed, return with an error. |
| 358 // TODO(hclam): use a more meaningful constant as error. | 358 // TODO(hclam): use a more meaningful constant as error. |
| 359 if (read_has_failed_) | 359 if (read_has_failed_) |
| 360 return AVERROR(EIO); | 360 return AVERROR(EIO); |
| 361 | 361 |
| 362 // Even though FFmpeg defines AVERROR_EOF, it's not to be used with I/O | 362 // Even though FFmpeg defines AVERROR_EOF, it's not to be used with I/O |
| 363 // routines. Instead return 0 for any read at or past EOF. | 363 // routines. Instead return 0 for any read at or past EOF. |
| 364 int64 file_size; | 364 int64 file_size; |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 read_event_.Wait(); | 714 read_event_.Wait(); |
| 715 return last_read_bytes_; | 715 return last_read_bytes_; |
| 716 } | 716 } |
| 717 | 717 |
| 718 void FFmpegDemuxer::SignalReadCompleted(size_t size) { | 718 void FFmpegDemuxer::SignalReadCompleted(size_t size) { |
| 719 last_read_bytes_ = size; | 719 last_read_bytes_ = size; |
| 720 read_event_.Signal(); | 720 read_event_.Signal(); |
| 721 } | 721 } |
| 722 | 722 |
| 723 } // namespace media | 723 } // namespace media |
| OLD | NEW |