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
3 // found in the LICENSE file.
6 #include "base/logging.h"
7 #include "media/tools/player_x11/data_source_logger.h"
9 static void LogAndRunStopClosure(const base::Closure& closure) {
10 VLOG(1) << "Stop() finished";
14 static void LogAndRunReadCB(
15 int64 position, int size,
16 const media::DataSource::ReadCB& read_cb, int result) {
17 VLOG(1) << "Read(" << position << ", " << size << ") -> " << result;
21 DataSourceLogger::DataSourceLogger(
22 scoped_ptr<media::DataSource> data_source,
24 : data_source_(data_source.Pass()),
25 streaming_(streaming) {
28 void DataSourceLogger::Stop(const base::Closure& closure) {
29 VLOG(1) << "Stop() started";
30 data_source_->Stop(base::Bind(&LogAndRunStopClosure, closure));
33 void DataSourceLogger::Read(
34 int64 position, int size, uint8* data,
35 const media::DataSource::ReadCB& read_cb) {
36 VLOG(1) << "Read(" << position << ", " << size << ")";
37 data_source_->Read(position, size, data, base::Bind(
38 &LogAndRunReadCB, position, size, read_cb));
41 bool DataSourceLogger::GetSize(int64* size_out) {
42 bool success = data_source_->GetSize(size_out);
43 VLOG(1) << "GetSize() -> " << (success ? "true" : "false")
48 bool DataSourceLogger::IsStreaming() {
50 VLOG(1) << "IsStreaming() -> true (overridden)";
54 bool streaming = data_source_->IsStreaming();
55 VLOG(1) << "IsStreaming() -> " << (streaming ? "true" : "false");
59 void DataSourceLogger::SetBitrate(int bitrate) {
60 VLOG(1) << "SetBitrate(" << bitrate << ")";
61 data_source_->SetBitrate(bitrate);
64 DataSourceLogger::~DataSourceLogger() {}