| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "media/tools/player_x11/data_source_logger.h" | 7 #include "media/tools/player_x11/data_source_logger.h" |
| 8 | 8 |
| 9 static void LogAndRunStopClosure(const base::Closure& closure) { | 9 static void LogAndRunStopClosure(const base::Closure& closure) { |
| 10 VLOG(1) << "Stop() finished"; | 10 VLOG(1) << "Stop() finished"; |
| 11 closure.Run(); | 11 closure.Run(); |
| 12 } | 12 } |
| 13 | 13 |
| 14 static void LogAndRunReadCB( | 14 static void LogAndRunReadCB( |
| 15 int64 position, size_t size, | 15 int64 position, int size, |
| 16 const media::DataSource::ReadCB& read_cb, size_t result) { | 16 const media::DataSource::ReadCB& read_cb, int result) { |
| 17 VLOG(1) << "Read(" << position << ", " << size << ") -> " << result; | 17 VLOG(1) << "Read(" << position << ", " << size << ") -> " << result; |
| 18 read_cb.Run(result); | 18 read_cb.Run(result); |
| 19 } | 19 } |
| 20 | 20 |
| 21 DataSourceLogger::DataSourceLogger( | 21 DataSourceLogger::DataSourceLogger( |
| 22 const scoped_refptr<media::DataSource>& data_source, | 22 const scoped_refptr<media::DataSource>& data_source, |
| 23 bool streaming) | 23 bool streaming) |
| 24 : data_source_(data_source), | 24 : data_source_(data_source), |
| 25 streaming_(streaming) { | 25 streaming_(streaming) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 DataSourceLogger::~DataSourceLogger() {} | 28 DataSourceLogger::~DataSourceLogger() {} |
| 29 | 29 |
| 30 void DataSourceLogger::set_host(media::DataSourceHost* host) { | 30 void DataSourceLogger::set_host(media::DataSourceHost* host) { |
| 31 VLOG(1) << "set_host(" << host << ")"; | 31 VLOG(1) << "set_host(" << host << ")"; |
| 32 data_source_->set_host(host); | 32 data_source_->set_host(host); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void DataSourceLogger::Stop(const base::Closure& closure) { | 35 void DataSourceLogger::Stop(const base::Closure& closure) { |
| 36 VLOG(1) << "Stop() started"; | 36 VLOG(1) << "Stop() started"; |
| 37 data_source_->Stop(base::Bind(&LogAndRunStopClosure, closure)); | 37 data_source_->Stop(base::Bind(&LogAndRunStopClosure, closure)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void DataSourceLogger::Read( | 40 void DataSourceLogger::Read( |
| 41 int64 position, size_t size, uint8* data, | 41 int64 position, int size, uint8* data, |
| 42 const media::DataSource::ReadCB& read_cb) { | 42 const media::DataSource::ReadCB& read_cb) { |
| 43 VLOG(1) << "Read(" << position << ", " << size << ")"; | 43 VLOG(1) << "Read(" << position << ", " << size << ")"; |
| 44 data_source_->Read(position, size, data, base::Bind( | 44 data_source_->Read(position, size, data, base::Bind( |
| 45 &LogAndRunReadCB, position, size, read_cb)); | 45 &LogAndRunReadCB, position, size, read_cb)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool DataSourceLogger::GetSize(int64* size_out) { | 48 bool DataSourceLogger::GetSize(int64* size_out) { |
| 49 bool success = data_source_->GetSize(size_out); | 49 bool success = data_source_->GetSize(size_out); |
| 50 VLOG(1) << "GetSize() -> " << (success ? "true" : "false") | 50 VLOG(1) << "GetSize() -> " << (success ? "true" : "false") |
| 51 << ", " << *size_out; | 51 << ", " << *size_out; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 65 | 65 |
| 66 void DataSourceLogger::SetPreload(media::Preload preload) { | 66 void DataSourceLogger::SetPreload(media::Preload preload) { |
| 67 VLOG(1) << "SetPreload(" << preload << ")"; | 67 VLOG(1) << "SetPreload(" << preload << ")"; |
| 68 data_source_->SetPreload(preload); | 68 data_source_->SetPreload(preload); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void DataSourceLogger::SetBitrate(int bitrate) { | 71 void DataSourceLogger::SetBitrate(int bitrate) { |
| 72 VLOG(1) << "SetBitrate(" << bitrate << ")"; | 72 VLOG(1) << "SetBitrate(" << bitrate << ")"; |
| 73 data_source_->SetBitrate(bitrate); | 73 data_source_->SetBitrate(bitrate); |
| 74 } | 74 } |
| OLD | NEW |