summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-08 23:17:01 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-08 23:17:01 +0000
commit84c1d66341b0898e10d29f11a9f99265bbcb9060 (patch)
tree0fbdd266ed42cd712385533c3bc2c59219cdf697
parentd3cdb0ffdcb632b53bf2b756b13a848cf74de48c (diff)
downloadchromium_src-84c1d66341b0898e10d29f11a9f99265bbcb9060.zip
chromium_src-84c1d66341b0898e10d29f11a9f99265bbcb9060.tar.gz
chromium_src-84c1d66341b0898e10d29f11a9f99265bbcb9060.tar.bz2
Cleaned up Media filter interface comments and definitions.
The changes are based on Darin's comments on the Media buffer interface definitions (i.e., comments, virtual destructors). Also, I figured you might be interested :) Review URL: http://codereview.chromium.org/13261 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6553 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--media/base/filters.h59
1 files changed, 24 insertions, 35 deletions
diff --git a/media/base/filters.h b/media/base/filters.h
index 74220a4..e01c94c 100644
--- a/media/base/filters.h
+++ b/media/base/filters.h
@@ -2,12 +2,30 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Filters are connected in a strongly typed manner, with downstream filters
+// always reading data from upstream filters. Upstream filters have no clue
+// who is actually reading from them, and return the results via OnAssignment
+// using the AssignableInterface<SomeBufferType> interface:
+//
+// DemuxerStream(Video) <- VideoDecoder <- VideoRenderer
+// DataSource <- Demuxer <
+// DemuxerStream(Audio) <- AudioDecoder <- AudioRenderer
+//
+// Upstream -------------------------------------------------------> Downstream
+// <- Reads flow this way
+// Buffer assignments flow this way ->
+//
+// Every filter maintains a reference to the scheduler, who maintains data
+// shared between filters (i.e., reference clock value, playback state). The
+// scheduler is also responsible for scheduling filter tasks (i.e., a read on
+// a VideoDecoder would result in scheduling a Decode task). Filters can also
+// use the scheduler to signal errors and shutdown playback.
+
#ifndef MEDIA_BASE_FILTERS_H_
#define MEDIA_BASE_FILTERS_H_
#include <limits>
#include <string>
-#include "base/basictypes.h"
#include "base/ref_counted.h"
namespace media {
@@ -34,44 +52,22 @@ enum FilterType {
FILTER_MAX
};
-// Filters are connected in a strongly typed manner, with downstream filters
-// always reading data from upstream filters. Upstream filters have no clue
-// who is actually reading from them, and return the results via OnAssignment
-// using the AssignableInterface<SomeBufferType> interface:
-//
-// DemuxerStream(Video) <- VideoDecoder <- VideoRenderer
-// DataSource <- Demuxer <
-// DemuxerStream(Audio) <- AudioDecoder <- AudioRenderer
-//
-// Upstream -------------------------------------------------------> Downstream
-// <- Reads flow this way
-// Buffer assignments flow this way ->
-//
-// Every filter maintains a reference to the scheduler, who maintains data
-// shared between filters (i.e., reference clock value, playback state). The
-// scheduler is also responsible for scheduling filter tasks (i.e., a read on
-// a VideoDecoder would result in scheduling a Decode task). Filters can also
-// use the scheduler to signal errors and shutdown playback.
-
-// NOTE: this isn't a true interface since RefCountedThreadSafe has non-virtual
-// members, therefore implementors should NOT subclass RefCountedThreadSafe.
-//
-// If you do, AddRef/Release will have different outcomes depending on the
-// current type of the pointer (StreamSampleInterface vs. SomeImplementation)
class MediaFilterInterface :
public base::RefCountedThreadSafe<MediaFilterInterface> {
public:
- virtual ~MediaFilterInterface() {}
-
virtual void SetScheduler(SchedulerFilterInterface* scheduler) = 0;
+
+ protected:
+ friend class base::RefCountedThreadSafe<MediaFilterInterface>;
+ virtual ~MediaFilterInterface() {}
};
+
class DataSourceInterface : public MediaFilterInterface {
public:
static const FilterType kFilterType = FILTER_DATA_SOURCE;
static const size_t kReadError = static_cast<size_t>(-1);
- virtual ~DataSourceInterface() {}
// Initializes this filter, returns true if successful, false otherwise.
virtual bool Initialize(const std::wstring& uri) = 0;
@@ -99,7 +95,6 @@ class DataSourceInterface : public MediaFilterInterface {
class DemuxerInterface : public MediaFilterInterface {
public:
static const FilterType kFilterType = FILTER_DEMUXER;
- virtual ~DemuxerInterface() {}
// Initializes this filter, returns true if successful, false otherwise.
virtual bool Initialize(DataSourceInterface* data_source) = 0;
@@ -114,8 +109,6 @@ class DemuxerInterface : public MediaFilterInterface {
class DemuxerStreamInterface {
public:
- virtual ~DemuxerStreamInterface() {}
-
// Returns the MediaFormat for this filter.
virtual const MediaFormat* GetMediaFormat() = 0;
@@ -127,7 +120,6 @@ class DemuxerStreamInterface {
class VideoDecoderInterface : public MediaFilterInterface {
public:
static const FilterType kFilterType = FILTER_VIDEO_DECODER;
- virtual ~VideoDecoderInterface() {}
// Initializes this filter, returns true if successful, false otherwise.
virtual bool Initialize(DemuxerStreamInterface* demuxer_stream) = 0;
@@ -143,7 +135,6 @@ class VideoDecoderInterface : public MediaFilterInterface {
class AudioDecoderInterface : public MediaFilterInterface {
public:
static const FilterType kFilterType = FILTER_AUDIO_DECODER;
- virtual ~AudioDecoderInterface() {}
// Initializes this filter, returns true if successful, false otherwise.
virtual bool Initialize(DemuxerStreamInterface* demuxer_stream) = 0;
@@ -159,7 +150,6 @@ class AudioDecoderInterface : public MediaFilterInterface {
class VideoRendererInterface : public MediaFilterInterface {
public:
static const FilterType kFilterType = FILTER_VIDEO_RENDERER;
- virtual ~VideoRendererInterface() {}
// Initializes this filter, returns true if successful, false otherwise.
virtual bool Initialize(VideoDecoderInterface* decoder) = 0;
@@ -169,7 +159,6 @@ class VideoRendererInterface : public MediaFilterInterface {
class AudioRendererInterface : public MediaFilterInterface {
public:
static const FilterType kFilterType = FILTER_AUDIO_RENDERER;
- virtual ~AudioRendererInterface() {}
// Initializes this filter, returns true if successful, false otherwise.
virtual bool Initialize(AudioDecoderInterface* decoder) = 0;