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 LogAndRunReadCB(
10 int64 position
, int size
,
11 const media::DataSource::ReadCB
& read_cb
, int result
) {
12 VLOG(1) << "Read(" << position
<< ", " << size
<< ") -> " << result
;
16 DataSourceLogger::DataSourceLogger(
17 scoped_ptr
<media::DataSource
> data_source
,
19 : data_source_(data_source
.Pass()),
20 streaming_(streaming
) {
23 void DataSourceLogger::Stop() {
28 void DataSourceLogger::Read(
29 int64 position
, int size
, uint8
* data
,
30 const media::DataSource::ReadCB
& read_cb
) {
31 VLOG(1) << "Read(" << position
<< ", " << size
<< ")";
32 data_source_
->Read(position
, size
, data
, base::Bind(
33 &LogAndRunReadCB
, position
, size
, read_cb
));
36 bool DataSourceLogger::GetSize(int64
* size_out
) {
37 bool success
= data_source_
->GetSize(size_out
);
38 VLOG(1) << "GetSize() -> " << (success
? "true" : "false")
43 bool DataSourceLogger::IsStreaming() {
45 VLOG(1) << "IsStreaming() -> true (overridden)";
49 bool streaming
= data_source_
->IsStreaming();
50 VLOG(1) << "IsStreaming() -> " << (streaming
? "true" : "false");
54 void DataSourceLogger::SetBitrate(int bitrate
) {
55 VLOG(1) << "SetBitrate(" << bitrate
<< ")";
56 data_source_
->SetBitrate(bitrate
);
59 DataSourceLogger::~DataSourceLogger() {}