0

This is the frozen interface definition for the media pipeline, filters, and filter hosts.

It has been pre-code-reviewed by scherkus already.  There is no actual implementation in
this change -- only an empty skeleton for every public method is provided.  The actual code
is ready, but this change is intended to get buy-off for the public interface.

I added pipeline_impl.cc to the media_lib.scons since it was missing (it was present in the
.sln file already)
Review URL: http://codereview.chromium.org/18380

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8396 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
ralphl@chromium.org
2009-01-21 22:28:07 +00:00
parent dbc1f783d4
commit e53c3f9b29
9 changed files with 365 additions and 298 deletions

@ -1,4 +1,4 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2006-2009 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.

@ -14,26 +14,6 @@
// to synchronize video with audio. An audio and video decoder would typically
// have no need to call either SetTime or GetTime.
//
// Filter state is managed by the FilterHost implementor, with the filter
// receiving notifications from the host when a state transition is starting
// and the filter notifying the host when the filter has completed the
// transition. The state transition is broken into two steps since some state
// transitions may be blocking or long running. The host provides PostTask to
// help filters schedule such tasks.
//
// Example of a pause state transition:
// During Initialization:
// - Audio renderer registers OnPause with SetPauseCallback
//
// During Playback:
// - User hits pause button, triggering a pause state transition
// - Filter host executes the pause callback
// - Inside OnPause, the audio renderer schedules DoPause with PostTask
// and immediately returns
// - Filter host asynchronously executes DoPause
// - Inside DoPause, the audio renderer does its blocking operations and
// when complete calls PauseComplete
//
// The reasoning behind providing PostTask is to discourage filters from
// implementing their own threading. The overall design is that many filters
// can share few threads and that notifications return quickly by scheduling
@ -43,93 +23,64 @@
#define MEDIA_BASE_FILTER_HOST_H_
#include "base/task.h"
#include "media/base/pipeline.h"
namespace media {
class FilterHost {
public:
// Returns the global time.
virtual int64 GetTime() const = 0;
// The PipelineStatus class allows read-only access to the pipeline state.
// This is the same object that is used by the pipeline client to examine
// the state of the running pipeline. The lifetime of the PipelineStatus
// interface is the same as the lifetime of the FilterHost interface, so
// it is acceptable for filters to use the returned pointer until their
// Stop method has been called.
virtual const PipelineStatus* GetPipelineStatus() const = 0;
// Updates the global time.
virtual void SetTime(int64 time) = 0;
// Registers a callback to receive global clock update notifications. The
// callback will be called repeatedly and filters do not need to re-register
// after each invocation of the callback. To remove the callback, filters
// may call this method passing NULL for the callback argument.
//
// Callback arguments:
// int64 the new pipeline time, in microseconds
virtual void SetTimeUpdateCallback(Callback1<int64>::Type* callback) = 0;
// Returns the global duration.
virtual int64 GetDuration() const = 0;
// Updates the global media duration.
virtual void SetDuration(int64 duration) = 0;
// Posts a task to be executed asynchronously.
// Filters must call this method to indicate that their initialization is
// complete. They may call this from within their Initialize() method or may
// choose call it after processing some data.
virtual void InitializationComplete() = 0;
// Posts a task to be executed asynchronously on the pipeline's thread.
virtual void PostTask(Task* task) = 0;
// Notifies the host that the filter has transitioned into the playing state.
virtual bool PlayComplete() = 0;
// Stops execution of the pipeline due to a fatal error.
virtual void Error(PipelineError error) = 0;
// Notifies the host that the filter has transitioned into the paused state.
virtual bool PauseComplete() = 0;
// Sets the current time. Any filters that have registered a callback through
// the SetTimeUpdateCallback method will be notified of the change.
virtual void SetTime(int64 time) = 0;
// Notifies the host that the filter has transitioned into the seek state.
virtual bool SeekComplete() = 0;
// Get the duration of the media in microseconds. If the duration has not
// been determined yet, then returns 0.
virtual void SetDuration(int64 duration) = 0;
// Notifies the host that the filter has transitioned into the shutdown state.
virtual bool ShutdownComplete() = 0;
// Set the approximate amount of playable data buffered so far in micro-
// seconds.
virtual void SetBufferedTime(int64 buffered_time) = 0;
// Notifies the host that an error has occurred and that further processing
// cannot continue. |error| identifies the type of error that occurred.
//
// TODO(scherkus): Add error constants as we start implementing filters.
virtual void Error(int error) = 0;
// Set the total size of the media file.
virtual void SetTotalBytes(int64 total_bytes) = 0;
// Notifies the host that the end of the stream has been reached.
virtual void EndOfStream() = 0;
// Sets the total number of bytes that are buffered on the client and ready to
// be played.
virtual void SetBufferedBytes(int64 buffered_bytes) = 0;
// Registers a callback to handle the play state transition. The filter must
// call PlayComplete at some point in the future to signal completion of
// the transition.
//
// Callback arguments:
// None
virtual void SetPlayCallback(Callback0::Type* callback) = 0;
// Registers a callback to handle the pause state transition. The filter must
// call PauseComplete at some point in the future to signal completion of
// the transition.
//
// Callback arguments:
// bool true if the pause was triggered by end of stream
virtual void SetPauseCallback(Callback1<bool>::Type* callback) = 0;
// Registers a callback to handle the seek state transition. The filter must
// call SeekComplete at some point in the future to signal completion of
// the transition.
//
// Callback arguments:
// int64 the timestamp position to seek to, in microseconds
virtual void SetSeekCallback(Callback1<int64>::Type* callback) = 0;
// Registers a callback to handle the shutdown state transition. The filter
// must call ShutdownComplete at some point in the future to signal completion
// of the transition.
//
// Callback arguments:
// None
virtual void SetShutdownCallback(Callback0::Type* callback) = 0;
// Registers a callback to receive global clock update notifications.
//
// Callback arguments:
// int64 the new global time, in microseconds
virtual void SetClockCallback(Callback1<int64>::Type* callback) = 0;
// Registers a callback to receive global error notifications.
//
// Callback arguments:
// int the error code reported.
virtual void SetErrorCallback(Callback1<int>::Type* callback) = 0;
// Sets the size of the video output in pixel units.
virtual void SetVideoSize(size_t width, size_t height) = 0;
protected:
virtual ~FilterHost() {}
virtual ~FilterHost() = 0;
};
} // namespace media

@ -1,4 +1,4 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2006-2009 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.
@ -8,80 +8,64 @@
namespace media {
FilterHostImpl::FilterHostImpl() {
// TODO(ralphl): implement FilterHostImpl constructor.
NOTIMPLEMENTED();
}
int64 FilterHostImpl::GetTime() const {
// TODO(scherkus): implement GetTime.
return 0;
const PipelineStatus* FilterHostImpl::GetPipelineStatus() const {
// TODO(ralphl): implement GetPipelineStatus.
NOTIMPLEMENTED();
return NULL;
}
void FilterHostImpl::SetTimeUpdateCallback(Callback1<int64>::Type* callback) {
// TODO(ralphl): implement SetTimeUpdateCallback.
NOTIMPLEMENTED();
}
void FilterHostImpl::InitializationComplete() {
// TODO(ralphl): implement InitializationComplete.
NOTIMPLEMENTED();
}
void FilterHostImpl::PostTask(Task* task) {
// TODO(ralphl): implement PostTask.
NOTIMPLEMENTED();
}
void FilterHostImpl::Error(PipelineError error) {
// TODO(ralphl): implement Error.
NOTIMPLEMENTED();
}
void FilterHostImpl::SetTime(int64 time) {
// TODO(scherkus): implement SetTime.
}
int64 FilterHostImpl::GetDuration() const {
// TODO(scherkus): implement GetDuration.
return 0;
// TODO(ralphl): implement SetTime.
NOTIMPLEMENTED();
}
void FilterHostImpl::SetDuration(int64 duration) {
// TODO(scherkus): implement SetDuration.
// TODO(ralphl): implement SetDuration.
NOTIMPLEMENTED();
}
void FilterHostImpl::PostTask(Task* task) {
// TODO(scherkus): implement PostTask.
void FilterHostImpl::SetBufferedTime(int64 buffered_time) {
// TODO(ralphl): implement SetBufferedTime.
NOTIMPLEMENTED();
}
bool FilterHostImpl::PlayComplete() {
// TODO(scherkus): implement PlayComplete.
return false;
void FilterHostImpl::SetTotalBytes(int64 total_bytes) {
// TODO(ralphl): implement.
NOTIMPLEMENTED();
}
bool FilterHostImpl::PauseComplete() {
// TODO(scherkus): implement PauseComplete.
return false;
void FilterHostImpl::SetBufferedBytes(int64 buffered_bytes) {
// TODO(ralphl): implement.
NOTIMPLEMENTED();
}
bool FilterHostImpl::SeekComplete() {
// TODO(scherkus): implement SeekComplete.
return false;
}
bool FilterHostImpl::ShutdownComplete() {
// TODO(scherkus): implement ShutdownComplete.
return false;
}
void FilterHostImpl::Error(int error) {
// TODO(scherkus): implement Error.
}
void FilterHostImpl::EndOfStream() {
// TODO(scherkus): implement EndOfStream.
}
void FilterHostImpl::SetPlayCallback(Callback0::Type* callback) {
play_callback_.reset(callback);
}
void FilterHostImpl::SetPauseCallback(Callback1<bool>::Type* callback) {
pause_callback_.reset(callback);
}
void FilterHostImpl::SetSeekCallback(Callback1<int64>::Type* callback) {
seek_callback_.reset(callback);
}
void FilterHostImpl::SetShutdownCallback(Callback0::Type* callback) {
shutdown_callback_.reset(callback);
}
void FilterHostImpl::SetClockCallback(Callback1<int64>::Type* callback) {
clock_callback_.reset(callback);
}
void FilterHostImpl::SetErrorCallback(Callback1<int>::Type* callback) {
error_callback_.reset(callback);
void SetVideoSize(size_t width, size_t height) {
// TODO(ralphl): implement.
NOTIMPLEMENTED();
}
} // namespace media

@ -1,4 +1,4 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2006-2009 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.
@ -16,36 +16,24 @@ class FilterHostImpl : public FilterHost {
public:
FilterHostImpl();
// FilterHost implementation.
virtual int64 GetTime() const;
virtual void SetTime(int64 time);
virtual int64 GetDuration() const;
virtual void SetDuration(int64 duration);
// FilterHost interface.
virtual const PipelineStatus* GetPipelineStatus() const;
virtual void SetTimeUpdateCallback(Callback1<int64>::Type* callback);
virtual void InitializationComplete();
virtual void PostTask(Task* task);
virtual bool PlayComplete();
virtual bool PauseComplete();
virtual bool SeekComplete();
virtual bool ShutdownComplete();
virtual void Error(int error);
virtual void EndOfStream();
virtual void SetPlayCallback(Callback0::Type* callback);
virtual void SetPauseCallback(Callback1<bool>::Type* callback);
virtual void SetSeekCallback(Callback1<int64>::Type* callback);
virtual void SetShutdownCallback(Callback0::Type* callback);
virtual void SetClockCallback(Callback1<int64>::Type* callback);
virtual void SetErrorCallback(Callback1<int>::Type* callback);
virtual void Error(PipelineError error);
virtual void SetTime(int64 time);
virtual void SetDuration(int64 duration);
virtual void SetBufferedTime(int64 buffered_time);
virtual void SetTotalBytes(int64 total_bytes);
virtual void SetBufferedBytes(int64 buffered_bytes);
virtual void SetVideoSize(size_t width, size_t height);
protected:
virtual ~FilterHostImpl() {}
private:
scoped_ptr<Callback0::Type> play_callback_;
scoped_ptr<Callback1<bool>::Type> pause_callback_;
scoped_ptr<Callback1<int64>::Type> seek_callback_;
scoped_ptr<Callback0::Type> shutdown_callback_;
scoped_ptr<Callback1<int64>::Type> clock_callback_;
scoped_ptr<Callback1<int>::Type> error_callback_;
DISALLOW_COPY_AND_ASSIGN(FilterHostImpl);
};
} // namespace media

@ -1,4 +1,4 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2006-2009 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.
@ -26,6 +26,8 @@
#include <limits>
#include <string>
#include "base/logging.h"
#include "base/ref_counted.h"
namespace media {
@ -48,18 +50,43 @@ enum FilterType {
FILTER_AUDIO_DECODER,
FILTER_VIDEO_DECODER,
FILTER_AUDIO_RENDERER,
FILTER_VIDEO_RENDERER,
FILTER_MAX
FILTER_VIDEO_RENDERER
};
class MediaFilter : public base::RefCountedThreadSafe<MediaFilter> {
public:
virtual void SetFilterHost(FilterHost* filter_host) = 0;
MediaFilter() : host_(NULL) {}
// Sets the protected member |host_|. This is the first method called by
// the FilterHost after a filter is created. The host holds a strong
// reference to the filter. The refernce held by the host is guaranteed
// to be released before the host object is destroyed by the pipeline.
virtual void SetFilterHost(FilterHost* host) {
DCHECK(NULL == host_);
DCHECK(NULL != host);
host_ = host;
}
// The pipeline is being stopped either as a result of an error or because
// the client called Stop().
virtual void Stop() = 0;
// The pipeline playback rate has been changed. Filters may implement this
// method if they need to respond to this call.
virtual void SetPlaybackRate(float playback_rate) {}
// The pipeline is being seeked to the specified time. Filters may implement
// this method if they need to respond to this call.
virtual void Seek(int64 time) {}
protected:
FilterHost* host_;
friend class base::RefCountedThreadSafe<MediaFilter>;
virtual ~MediaFilter() {}
private:
DISALLOW_COPY_AND_ASSIGN(MediaFilter);
};
@ -95,7 +122,7 @@ class Demuxer : public MediaFilter {
public:
static const FilterType kFilterType = FILTER_DEMUXER;
// Initializes this filter, returns true if successful, false otherwise.
// Initializes this filter, returns true if successful, false otherwise.
virtual bool Initialize(DataSource* data_source) = 0;
// Returns the number of streams available
@ -113,6 +140,9 @@ class DemuxerStream {
// Schedules a read and takes ownership of the given buffer.
virtual void Read(Assignable<Buffer>* buffer) = 0;
protected:
virtual ~DemuxerStream() = 0;
};
@ -161,8 +191,11 @@ class AudioRenderer : public MediaFilter {
// Initializes this filter, returns true if successful, false otherwise.
virtual bool Initialize(AudioDecoder* decoder) = 0;
// Sets the output volume.
virtual void SetVolume(float volume) = 0;
};
} // namespace media
} // namespace media
#endif // MEDIA_BASE_FILTERS_H_
#endif // MEDIA_BASE_FILTERS_H_

@ -1,89 +1,146 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2006-2009 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.
// The pipeline is the public API clients use for playing back media. Clients
// provide a filter factory containing the filters they want the pipeline to
// use to render media.
//
// Playback controls (play, pause, seek) are asynchronous and clients are
// notified via callbacks.
#ifndef MEDIA_BASE_PIPELINE_H_
#define MEDIA_BASE_PIPELINE_H_
#include <string>
#include "base/task.h"
#include "media/base/factory.h"
namespace media {
class FilterFactoryInterface;
enum PipelineState {
PS_UNINITIALIZED,
PS_PLAY,
PS_PAUSE,
PS_SEEK,
PS_SHUTDOWN
// Error definitions for pipeline.
enum PipelineError {
PIPELINE_OK,
PIPELINE_ERROR_NETWORK,
PIPELINE_ERROR_DECODE,
PIPELINE_ERROR_ABORT,
PIPELINE_ERROR_INITIALIZATION_FAILED,
PIPELINE_STOPPING
};
class Pipeline : public base::RefCountedThreadSafe<Pipeline> {
// Base class for Pipeline class which allows for read-only access to members.
// Filters are allowed to access the PipelineStatus interface but are not given
// access to the client Pipeline methods.
class PipelineStatus {
public:
// Returns the current initialization state of the pipeline. Clients can
// examine this to determine if it is acceptable to call SetRate/SetVolume/
// Seek after calling Start on the pipeline. Note that this will be
// set to true prior to a call to the client's |init_complete_callback| if
// initialization is successful.
virtual bool IsInitialized() const = 0;
// Get the duration of the media in microseconds. If the duration has not
// been determined yet, then returns 0.
virtual int64 GetDuration() const = 0;
// Get the approximate amount of playable data buffered so far in micro-
// seconds.
virtual int64 GetBufferedTime() const = 0;
// Get the total size of the media file. If the size has not yet been
// determined or can not be determined, this value is 0.
virtual int64 GetTotalBytes() const = 0;
// Get the total number of bytes that are buffered on the client and ready to
// be played.
virtual int64 GetBufferedBytes() const = 0;
// Gets the size of the video output in pixel units. If there is no video
// or the video has not been rendered yet, the width and height will be 0.
virtual void GetVideoSize(size_t* width_out, size_t* height_out) const = 0;
// Gets the current volume setting being used by the audio renderer. When
// the pipeline is started, this value will be 1.0f. Valid values range
// from 0.0f to 1.0f.
virtual float GetVolume() const = 0;
// Gets the current playback rate of the pipeline. When the pipeline is
// started, the playback rate will be 0.0f. A rate of 1.0f indicates
// that the pipeline is rendering the media at the standard rate. Valid
// values for playback rate are >= 0.0f.
virtual float GetPlaybackRate() const = 0;
// Gets the current pipeline time in microseconds. For a pipeline "time"
// progresses from 0 to the end of the media.
virtual int64 GetTime() const = 0;
// Gets the current error status for the pipeline. If the pipeline is
// operating correctly, this will return OK.
virtual PipelineError GetError() const = 0;
protected:
virtual ~PipelineStatus() = 0;
};
class Pipeline : public PipelineStatus {
public:
// Build a pipeline to render the given URI using the given filter factory to
// construct a filter chain. Returns true if successful, false otherwise
// (i.e., pipeline already initialized).
// (i.e., pipeline already started). Note that a return value of true
// only indicates that the initialization process has started successfully.
// Pipeline initializaion is an inherently asynchronous process. Clients
// should not call SetPlaybackRate, Seek, or SetVolume until initialization
// is complete. Clients can either poll the IsInitialized() method (which is
// discouraged) or use the init_complete_callback as described below.
//
// This method is asynchronous and will execute a state change callback when
// completed.
virtual bool Initialize(FilterFactoryInterface* filter_factory,
const std::string& uri) = 0;
// This method is asynchronous and can execute a callback when completed.
// If the caller provides an init_complete_callback, it will be
// called when the pipeline initiailization completes. If successful, the
// callback's bool parameter will be true. If the callback is called with
// false, then the client can use the GetError method to obtain more
// information about the reason initialization failed. The prototype for
// the client callback is:
// void Client::PipelineInitComplete(bool init_was_successful);
//
// Note that clients must not call the Stop method from within the
// init_complete_callback. Other methods, including SetPlaybackRate,
// Seek, and SetVolume may be called. The client will be called on a
// thread owned by the pipeline class, not on the thread that originally
// called the Start method.
virtual bool Start(FilterFactory* filter_factory,
const std::string& uri,
Callback1<bool>::Type* init_complete_callback) = 0;
// Attempt to play the media. Returns true if successful, false otherwise
// (i.e., pipeline is unititalized).
//
// This method is asynchronous and will execute a state change callback when
// completed.
virtual bool Play() = 0;
// Stops the pipeline and resets to an uninitialized state. This method
// will block the calling thread until the pipeline has been completely
// torn down and reset to an uninitialized state. After calling Stop, it
// is acceptable to call Start again since Stop leaves the pipeline
// in a state identical to a newly created pipeline.
virtual void Stop() = 0;
// Attempt to pause the media. Returns true if successful, false otherwise
// (i.e., pipeline is unititalized). Pause() is not a toggle and should not
// resume playback if already paused.
// Attempt to adjust the playback rate. Returns true if successful,
// false otherwise. Setting a playback rate of 0.0f pauses all rendering
// of the media. A rate of 1.0f indicates a normal playback rate. Values
// for the playback rate must be greater than or equal to 0.0f.
// TODO(ralphl) What about maximum rate? Does HTML5 specify a max?
//
// This method is asynchronous and will execute a state change callback when
// completed.
virtual bool Pause() = 0;
// This method must be called only after initialization has completed.
virtual bool SetPlaybackRate(float playback_rate) = 0;
// Attempt to seek to the position in microseconds. Returns true if
// successful, false otherwise. Playback is paused after the seek completes.
//
// This method is asynchronous and will execute a state change callback when
// completed.
virtual bool Seek(int64 seek_position) = 0;
// This method must be called only after initialization has completed.
virtual bool Seek(int64 time) = 0;
// Shutdown the pipeline and destroy the filter chain.
virtual void Shutdown() = 0;
// Returns the current playback position in microseconds.
virtual int64 GetTime() const = 0;
// Returns the media duration in microseconds. Returns zero if the duration
// is not known (i.e., streaming media).
virtual int64 GetDuration() const = 0;
// Set a callback to receive state change notifications. This callback is
// executed only after the state transition has been successfully carried out.
// For example, calling Play() will only execute a callback with PS_PLAY
// some time in the future.
virtual void SetStateChangedCallback(
Callback1<PipelineState>::Type* callback) = 0;
// Set a callback to receive time change notifications.
virtual void SetTimeChangedCallback(Callback1<int64>::Type* callback) = 0;
protected:
friend class base::RefCountedThreadSafe<Pipeline>;
virtual ~Pipeline() {}
// Attempt to set the volume of the audio renderer. Valid values for volume
// range from 0.0f (muted) to 1.0f (full volume). This value affects all
// channels proportionately for multi-channel audio streams.
//
// This method must be called only after initialization has completed.
virtual bool SetVolume(float volume) = 0;
};
} // namespace media
#endif // MEDIA_BASE_PIPELINE_H_
#endif // MEDIA_BASE_PIPELINE_H_

@ -1,4 +1,4 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2006-2009 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.
@ -6,55 +6,106 @@
namespace media {
PipelineImpl::PipelineImpl() : time_(0), duration_(0) {}
PipelineImpl::PipelineImpl() {
// TODO(ralphl): implement PipelineImpl constructor.
NOTIMPLEMENTED();
}
PipelineImpl::~PipelineImpl() {}
PipelineImpl::~PipelineImpl() {
// TODO(ralphl): implement PipelineImpl destructor.
NOTIMPLEMENTED();
}
bool PipelineImpl::Initialize(FilterFactoryInterface* filter_factory,
const std::string& uri) {
// TODO(scherkus): implement Initialize.
bool PipelineImpl::IsInitialized() const {
// TODO(ralphl): implement IsInitialized.
NOTIMPLEMENTED();
return false;
}
bool PipelineImpl::Play() {
// TODO(scherkus): implement Play.
NOTIMPLEMENTED();
return false;
}
bool PipelineImpl::Pause() {
// TODO(scherkus): implement Pause.
NOTIMPLEMENTED();
return false;
}
bool PipelineImpl::Seek(int64 seek_position) {
// TODO(scherkus): implement Seek.
NOTIMPLEMENTED();
return false;
}
void PipelineImpl::Shutdown() {
// TODO(scherkus): implement Shutdown.
NOTIMPLEMENTED();
}
int64 PipelineImpl::GetTime() const {
return time_;
}
int64 PipelineImpl::GetDuration() const {
return duration_;
// TODO(ralphl): implement GetDuration.
NOTIMPLEMENTED();
return 0;
}
void PipelineImpl::SetStateChangedCallback(
Callback1<PipelineState>::Type* callback) {
state_changed_callback_.reset(callback);
int64 PipelineImpl::GetBufferedTime() const {
// TODO(ralphl): implement GetBufferedTime.
NOTIMPLEMENTED();
return 0;
}
void PipelineImpl::SetTimeChangedCallback(Callback1<int64>::Type* callback) {
time_changed_callback_.reset(callback);
int64 PipelineImpl::GetTotalBytes() const {
// TODO(ralphl): implement GetTotalBytes.
NOTIMPLEMENTED();
return 0;
}
int64 PipelineImpl::GetBufferedBytes() const {
// TODO(ralphl): implement GetBufferedBytes.
NOTIMPLEMENTED();
return 0;
}
void PipelineImpl::GetVideoSize(size_t* width_out, size_t* height_out) const {
// TODO(ralphl): implement GetVideoSize.
NOTIMPLEMENTED();
width_out = 0;
height_out = 0;
}
float PipelineImpl::GetVolume() const {
// TODO(ralphl): implement GetVolume.
NOTIMPLEMENTED();
return 0;
}
float PipelineImpl::GetPlaybackRate() const {
// TODO(ralphl): implement GetPlaybackRate.
NOTIMPLEMENTED();
return 0;
}
int64 PipelineImpl::GetTime() const {
// TODO(ralphl): implement GetTime.
NOTIMPLEMENTED();
return 0;
}
PipelineError PipelineImpl::GetError() const {
// TODO(ralphl): implement GetError.
NOTIMPLEMENTED();
return PIPELINE_ERROR_INITIALIZATION_FAILED;
}
bool PipelineImpl::Start(FilterFactory* filter_factory,
const std::string& uri,
Callback1<bool>::Type* init_complete_callback) {
// TODO(ralphl): implement Start.
NOTIMPLEMENTED();
return false;
}
void PipelineImpl::Stop() {
// TODO(ralphl): implement Stop.
NOTIMPLEMENTED();
}
bool PipelineImpl::SetPlaybackRate(float rate) {
// TODO(ralphl): implement SetPlaybackRate.
NOTIMPLEMENTED();
return false;
}
bool PipelineImpl::Seek(int64 time) {
// TODO(ralphl): implement Seek.
NOTIMPLEMENTED();
return false;
}
bool PipelineImpl::SetVolume(float volume) {
// TODO(ralphl): implement SetVolume.
NOTIMPLEMENTED();
return false;
}
} // namespace media

@ -1,4 +1,4 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2006-2009 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.
@ -7,7 +7,8 @@
#ifndef MEDIA_BASE_PIPELINE_IMPL_H_
#define MEDIA_BASE_PIPELINE_IMPL_H_
#include "base/scoped_ptr.h"
#include <string>
#include "media/base/pipeline.h"
namespace media {
@ -15,29 +16,30 @@ namespace media {
class PipelineImpl : public Pipeline {
public:
PipelineImpl();
~PipelineImpl();
// Pipeline implementation.
virtual bool Initialize(FilterFactoryInterface* filter_factory,
const std::string& uri);
virtual bool Play();
virtual bool Pause();
virtual bool Seek(int64 seek_position);
virtual void Shutdown();
virtual int64 GetTime() const;
// Implementation of PipelineStatus methods.
virtual bool IsInitialized() const;
virtual int64 GetDuration() const;
virtual void SetStateChangedCallback(
Callback1<PipelineState>::Type* callback);
virtual void SetTimeChangedCallback(Callback1<int64>::Type* callback);
virtual int64 GetBufferedTime() const;
virtual int64 GetTotalBytes() const;
virtual int64 GetBufferedBytes()const;
virtual void GetVideoSize(size_t* width_out, size_t* height_out) const;
virtual float GetVolume() const;
virtual float GetPlaybackRate() const;
virtual int64 GetTime() const;
virtual PipelineError GetError() const;
protected:
virtual ~PipelineImpl();
// Impementation of Pipeline methods.
virtual bool Start(FilterFactory* filter_factory,
const std::string& uri,
Callback1<bool>::Type* init_complete_callback);
virtual void Stop();
virtual bool SetPlaybackRate(float rate);
virtual bool Seek(int64 time);
virtual bool SetVolume(float volume);
private:
int64 time_;
int64 duration_;
scoped_ptr<Callback1<PipelineState>::Type> state_changed_callback_;
scoped_ptr<Callback1<int64>::Type> time_changed_callback_;
DISALLOW_COPY_AND_ASSIGN(PipelineImpl);
};

@ -28,6 +28,7 @@ input_files = [
'base/data_buffer.cc',
'base/filter_host_impl.cc',
'base/media_format.cc',
'base/pipeline_impl.cc',
]
if env.Bit('windows'):