summaryrefslogtreecommitdiffstats
path: root/media/tools/player_x11/data_source_logger.h
blob: 5fdd9d41162f0a179fb4d64558de0131a74252ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_TOOLS_PLAYER_X11_DATA_SOURCE_LOGGER_H_
#define MEDIA_TOOLS_PLAYER_X11_DATA_SOURCE_LOGGER_H_

#include "media/base/data_source.h"

// Logs all DataSource operations to VLOG(1) for debugging purposes.
class DataSourceLogger : public media::DataSource {
 public:
  // Constructs a DataSourceLogger to log operations against another DataSource.
  //
  // |data_source| must be initialized in advance.
  //
  // |streaming| when set to true will override the implementation
  // IsStreaming() to always return true, otherwise it will delegate to
  // |data_source|.
  DataSourceLogger(scoped_ptr<DataSource> data_source,
                   bool force_streaming);
  virtual ~DataSourceLogger();

  // media::DataSource implementation.
  virtual void Stop(const base::Closure& closure) OVERRIDE;
  virtual void Read(
      int64 position, int size, uint8* data,
      const media::DataSource::ReadCB& read_cb) OVERRIDE;
  virtual bool GetSize(int64* size_out) OVERRIDE;
  virtual bool IsStreaming() OVERRIDE;
  virtual void SetBitrate(int bitrate) OVERRIDE;

 private:
  scoped_ptr<media::DataSource> data_source_;
  bool streaming_;

  DISALLOW_COPY_AND_ASSIGN(DataSourceLogger);
};

#endif  // MEDIA_TOOLS_PLAYER_X11_DATA_SOURCE_LOGGER_H_