Chromium Code Reviews| 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 int FFmpegDemuxer::Read(size_t size, uint8* data) { |
|
Ami GONE FROM CHROMIUM
2011/10/19 21:14:58
ditto ret val
Cris Neckar
2011/10/19 22:25:41
Done.
| |
| 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 16 matching lines...) Expand all Loading... | |
| 381 | 381 |
| 382 // Returns with a negative number to signal an error to FFmpeg. | 382 // Returns with a negative number to signal an error to FFmpeg. |
| 383 read_has_failed_ = true; | 383 read_has_failed_ = true; |
| 384 return AVERROR(EIO); | 384 return AVERROR(EIO); |
| 385 } | 385 } |
| 386 read_position_ += last_read_bytes; | 386 read_position_ += last_read_bytes; |
| 387 | 387 |
| 388 if (host()) | 388 if (host()) |
| 389 host()->SetCurrentReadPosition(read_position_); | 389 host()->SetCurrentReadPosition(read_position_); |
| 390 | 390 |
| 391 return last_read_bytes; | 391 return last_read_bytes; |
|
Ami GONE FROM CHROMIUM
2011/10/19 21:14:58
I can't believe with all our clang magic we still
| |
| 392 } | 392 } |
| 393 | 393 |
| 394 bool FFmpegDemuxer::GetPosition(int64* position_out) { | 394 bool FFmpegDemuxer::GetPosition(int64* position_out) { |
| 395 *position_out = read_position_; | 395 *position_out = read_position_; |
| 396 return true; | 396 return true; |
| 397 } | 397 } |
| 398 | 398 |
| 399 bool FFmpegDemuxer::SetPosition(int64 position) { | 399 bool FFmpegDemuxer::SetPosition(int64 position) { |
| 400 DCHECK(data_source_); | 400 DCHECK(data_source_); |
| 401 | 401 |
| (...skipping 312 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 |