summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 20:31:31 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 20:31:31 +0000
commitce43daf0ae0b7816c843be7a1df8878c34f4005b (patch)
treef1355552bd5b9ca989b6492a8a554ce921f75656 /media
parent4383fb67b470c15f815a45a0ed55da075bfd8040 (diff)
downloadchromium_src-ce43daf0ae0b7816c843be7a1df8878c34f4005b.zip
chromium_src-ce43daf0ae0b7816c843be7a1df8878c34f4005b.tar.gz
chromium_src-ce43daf0ae0b7816c843be7a1df8878c34f4005b.tar.bz2
Removed Interface from the end of a bunch of media classes.
Also added in missing "public" inheritance to FilterFactory. Review URL: http://codereview.chromium.org/18261 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8114 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/buffers.h39
-rwxr-xr-xmedia/base/data_buffer.h10
-rw-r--r--media/base/data_buffer_unittest.cc6
-rw-r--r--media/base/factory.h20
-rw-r--r--media/base/filter_host.h14
-rw-r--r--media/base/filter_host_impl.h6
-rw-r--r--media/base/filters.h55
7 files changed, 74 insertions, 76 deletions
diff --git a/media/base/buffers.h b/media/base/buffers.h
index 13d35f5..7f0ddb8 100644
--- a/media/base/buffers.h
+++ b/media/base/buffers.h
@@ -31,8 +31,7 @@
namespace media {
-class StreamSampleInterface :
- public base::RefCountedThreadSafe<StreamSampleInterface> {
+class StreamSample : public base::RefCountedThreadSafe<StreamSample> {
public:
// Returns the timestamp of this buffer in microseconds.
virtual int64 GetTimestamp() const = 0;
@@ -47,12 +46,12 @@ class StreamSampleInterface :
virtual void SetDuration(int64 duration) = 0;
protected:
- friend class base::RefCountedThreadSafe<StreamSampleInterface>;
- virtual ~StreamSampleInterface() {}
+ friend class base::RefCountedThreadSafe<StreamSample>;
+ virtual ~StreamSample() {}
};
-class BufferInterface : public StreamSampleInterface {
+class Buffer : public StreamSample {
public:
// Returns a read only pointer to the buffer data.
virtual const char* GetData() const = 0;
@@ -62,7 +61,7 @@ class BufferInterface : public StreamSampleInterface {
};
-class WritableBufferInterface : public BufferInterface {
+class WritableBuffer : public Buffer {
public:
// Returns a read-write pointer to the buffer data.
virtual char* GetWritableData() = 0;
@@ -112,7 +111,7 @@ struct VideoSurface {
};
-class VideoFrameInterface : public StreamSampleInterface {
+class VideoFrame : public StreamSample {
public:
// Locks the underlying surface and fills out the given VideoSurface and
// returns true if successful, false otherwise. Any additional calls to Lock
@@ -126,7 +125,7 @@ class VideoFrameInterface : public StreamSampleInterface {
template <class BufferType>
-class AssignableInterface {
+class Assignable {
public:
// Assigns a buffer to the owner.
virtual void SetBuffer(BufferType* buffer) = 0;
@@ -136,20 +135,20 @@ class AssignableInterface {
};
-// Template for easily creating AssignableInterface buffers. Pass in the
-// pointer of the object to receive the OnAssignment callback.
-template <class OwnerType, class BufferType>
-class AssignableBuffer : public AssignableInterface<BufferType>,
- public base::RefCountedThreadSafe<AssignableBuffer<OwnerType, BufferType> > {
+// Template for easily creating Assignable buffers. Pass in the pointer of the
+// object to receive the OnAssignment callback.
+template <class TOwner, class TBuffer>
+class AssignableBuffer : public Assignable<TBuffer>,
+ public base::RefCountedThreadSafe< AssignableBuffer<TOwner, TBuffer> > {
public:
- explicit AssignableBuffer(OwnerType* owner)
- : owner_(owner),
- buffer_(NULL) {
+ explicit AssignableBuffer(TOwner* owner)
+ : owner_(owner),
+ buffer_(NULL) {
DCHECK(owner_);
}
- // AssignableBufferInterface<BufferType>
- virtual void SetBuffer(BufferType* buffer) {
+ // AssignableBuffer<TBuffer> implementation.
+ virtual void SetBuffer(TBuffer* buffer) {
buffer_ = buffer;
}
@@ -158,8 +157,8 @@ class AssignableBuffer : public AssignableInterface<BufferType>,
}
private:
- OwnerType* owner_;
- scoped_refptr<BufferType> buffer_;
+ TOwner* owner_;
+ scoped_refptr<TBuffer> buffer_;
DISALLOW_COPY_AND_ASSIGN(AssignableBuffer);
};
diff --git a/media/base/data_buffer.h b/media/base/data_buffer.h
index 6e1a004..5c220c0 100755
--- a/media/base/data_buffer.h
+++ b/media/base/data_buffer.h
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// A simple implementation of WritableBufferInterface that takes ownership of
+// A simple implementation of WritableBuffer that takes ownership of
// the given data pointer.
//
// DataBuffer assumes that memory was allocated with new char[].
@@ -14,22 +14,22 @@
namespace media {
-class DataBuffer : public WritableBufferInterface {
+class DataBuffer : public WritableBuffer {
public:
DataBuffer(char* data, size_t buffer_size, size_t data_size,
int64 timestamp, int64 duration);
- // StreamSampleInterface
+ // StreamSample implementation.
virtual int64 GetTimestamp() const;
virtual void SetTimestamp(int64 timestamp);
virtual int64 GetDuration() const;
virtual void SetDuration(int64 duration);
- // BufferInterface
+ // Buffer implementation.
virtual const char* GetData() const;
virtual size_t GetDataSize() const;
- // WritableBufferInterface
+ // WritableBuffer implementation.
virtual char* GetWritableData();
virtual size_t GetBufferSize() const;
virtual void SetDataSize(size_t data_size);
diff --git a/media/base/data_buffer_unittest.cc b/media/base/data_buffer_unittest.cc
index e9bb690..809d7ff 100644
--- a/media/base/data_buffer_unittest.cc
+++ b/media/base/data_buffer_unittest.cc
@@ -26,7 +26,7 @@ TEST(DataBufferTest, Basic) {
buffer = new DataBuffer(data, kBufferSize, kDataSize, 1337, 1667);
ASSERT_TRUE(buffer.get());
- // Test StreamSampleInterface.
+ // Test StreamSample implementation.
EXPECT_EQ(1337, buffer->GetTimestamp());
EXPECT_EQ(1667, buffer->GetDuration());
buffer->SetTimestamp(1234);
@@ -34,12 +34,12 @@ TEST(DataBufferTest, Basic) {
EXPECT_EQ(1234, buffer->GetTimestamp());
EXPECT_EQ(5678, buffer->GetDuration());
- // Test BufferInterface.
+ // Test Buffer implementation.
ASSERT_EQ(data, buffer->GetData());
EXPECT_EQ(kDataSize, buffer->GetDataSize());
EXPECT_STREQ(kData, buffer->GetData());
- // Test WritableBufferInterface.
+ // Test WritableBuffer implementation.
ASSERT_EQ(data, buffer->GetWritableData());
EXPECT_EQ(kBufferSize, buffer->GetBufferSize());
copied = base::strlcpy(data, kNewData, kBufferSize);
diff --git a/media/base/factory.h b/media/base/factory.h
index f735fe1..961c7a3a 100644
--- a/media/base/factory.h
+++ b/media/base/factory.h
@@ -14,8 +14,8 @@
// filter_factory->AddFactory(new TypeFilterFactory<YourAudioDecoder>());
// filter_factory->AddFactory(new TypeFilterFactory<YourAudioRenderer>());
// etc...
-// AudioDecoderInterface* filter;
-// if (filter_factory->Create<AudioDecoderInterface>(media_format, &filter) {
+// AudioDecoder* filter;
+// if (filter_factory->Create<AudioDecoder>(media_format, &filter) {
// do stuff with the filter...
// }
//
@@ -39,16 +39,16 @@ namespace media {
class FilterFactoryCollection;
-class FilterFactory : base::RefCountedThreadSafe<FilterFactory> {
+class FilterFactory : public base::RefCountedThreadSafe<FilterFactory> {
public:
// Creates a filter implementing the specified interface. Hides the casting
// and FilterType constants from the callers and produces cleaner code:
- // AudioDecoderInterface* filter = NULL;
- // bool success = Create<AudioDecoderInterface>(media_format, &filter);
+ // AudioDecoder* filter = NULL;
+ // bool success = Create<AudioDecoder>(media_format, &filter);
template <class T>
bool Create(const MediaFormat* media_format, T** filter_out) {
return Create(T::kFilterType, media_format,
- reinterpret_cast<MediaFilterInterface**>(filter_out));
+ reinterpret_cast<MediaFilter**>(filter_out));
}
protected:
@@ -61,9 +61,9 @@ class FilterFactory : base::RefCountedThreadSafe<FilterFactory> {
// reason, |filter_out| is assigned NULL and false it returned.
//
// It is assumed that |filter_out| can be safely casted to the corresponding
- // interface type (i.e., FILTER_AUDIO_DECODER -> AudioDecoderInterface).
+ // interface type (i.e., FILTER_AUDIO_DECODER -> AudioDecoder).
virtual bool Create(FilterType filter_type, const MediaFormat* media_format,
- MediaFilterInterface** filter_out) = 0;
+ MediaFilter** filter_out) = 0;
friend class base::RefCountedThreadSafe<FilterFactory>;
virtual ~FilterFactory() {}
@@ -86,7 +86,7 @@ class TypeFilterFactory : public FilterFactory {
// Attempts to create a filter of the template type. Assumes a static method
// Create is declared.
virtual bool Create(FilterType filter_type, const MediaFormat* media_format,
- MediaFilterInterface** filter_out) {
+ MediaFilter** filter_out) {
T* typed_out;
if (T::kFilterType == filter_type && T::Create(media_format, &typed_out)) {
*filter_out = typed_out;
@@ -113,7 +113,7 @@ class FilterFactoryCollection : public FilterFactory {
protected:
// Attempts to create a filter by walking down the list of filter factories.
bool Create(FilterType filter_type, const MediaFormat* media_format,
- MediaFilterInterface** filter_out) {
+ MediaFilter** filter_out) {
for (FactoryVector::iterator factory = factories_.begin();
factory != factories_.end();
++factory) {
diff --git a/media/base/filter_host.h b/media/base/filter_host.h
index d8ce26d..3bdf8b2 100644
--- a/media/base/filter_host.h
+++ b/media/base/filter_host.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// FilterHostInterface describes an interface for individual filters to access
-// and modify global playback information. Every filter is given a filter host
+// FilterHost describes an interface for individual filters to access and
+// modify global playback information. Every filter is given a filter host
// reference as part of initialization.
//
// This interface is intentionally verbose to cover the needs for the different
@@ -14,9 +14,9 @@
// 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 FilterHostInterface 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
+// 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.
@@ -46,7 +46,7 @@
namespace media {
-class FilterHostInterface {
+class FilterHost {
public:
// Returns the global time.
virtual int64 GetTime() const = 0;
@@ -129,7 +129,7 @@ class FilterHostInterface {
virtual void SetErrorCallback(Callback1<int>::Type* callback) = 0;
protected:
- virtual ~FilterHostInterface() {}
+ virtual ~FilterHost() {}
};
} // namespace media
diff --git a/media/base/filter_host_impl.h b/media/base/filter_host_impl.h
index 5ab5d92..346bf9b 100644
--- a/media/base/filter_host_impl.h
+++ b/media/base/filter_host_impl.h
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Implementation of FilterHostInterface.
+// Implementation of FilterHost.
#ifndef MEDIA_BASE_FILTER_HOST_IMPL_H_
#define MEDIA_BASE_FILTER_HOST_IMPL_H_
@@ -12,11 +12,11 @@
namespace media {
-class FilterHostImpl : public FilterHostInterface {
+class FilterHostImpl : public FilterHost {
public:
FilterHostImpl();
- // FilterHostInterface implementation.
+ // FilterHost implementation.
virtual int64 GetTime() const;
virtual void SetTime(int64 time);
virtual int64 GetDuration() const;
diff --git a/media/base/filters.h b/media/base/filters.h
index 3fb8bd0..5c6f08c 100644
--- a/media/base/filters.h
+++ b/media/base/filters.h
@@ -30,14 +30,14 @@
namespace media {
-template <class BufferType> class AssignableInterface;
-class BufferInterface;
-class DecoderInterface;
-class DemuxerStreamInterface;
-class FilterHostInterface;
+template <class TBuffer> class Assignable;
+class Buffer;
+class Decoder;
+class DemuxerStream;
+class FilterHost;
class MediaFormat;
-class VideoFrameInterface;
-class WritableBufferInterface;
+class VideoFrame;
+class WritableBuffer;
// Identifies the type of filter implementation. Used in conjunction with some
// template wizardry to enforce strongly typed operations. More or less a
@@ -53,18 +53,17 @@ enum FilterType {
};
-class MediaFilterInterface :
- public base::RefCountedThreadSafe<MediaFilterInterface> {
+class MediaFilter : public base::RefCountedThreadSafe<MediaFilter> {
public:
- virtual void SetFilterHost(FilterHostInterface* filter_host) = 0;
+ virtual void SetFilterHost(FilterHost* filter_host) = 0;
protected:
- friend class base::RefCountedThreadSafe<MediaFilterInterface>;
- virtual ~MediaFilterInterface() {}
+ friend class base::RefCountedThreadSafe<MediaFilter>;
+ virtual ~MediaFilter() {}
};
-class DataSourceInterface : public MediaFilterInterface {
+class DataSource : public MediaFilter {
public:
static const FilterType kFilterType = FILTER_DATA_SOURCE;
static const size_t kReadError = static_cast<size_t>(-1);
@@ -92,76 +91,76 @@ class DataSourceInterface : public MediaFilterInterface {
};
-class DemuxerInterface : public MediaFilterInterface {
+class Demuxer : public MediaFilter {
public:
static const FilterType kFilterType = FILTER_DEMUXER;
// Initializes this filter, returns true if successful, false otherwise.
- virtual bool Initialize(DataSourceInterface* data_source) = 0;
+ virtual bool Initialize(DataSource* data_source) = 0;
// Returns the number of streams available
virtual size_t GetNumberOfStreams() = 0;
// Returns the stream for the given index, NULL otherwise
- virtual DemuxerStreamInterface* GetStream(int stream_id) = 0;
+ virtual DemuxerStream* GetStream(int stream_id) = 0;
};
-class DemuxerStreamInterface {
+class DemuxerStream {
public:
// Returns the MediaFormat for this filter.
virtual const MediaFormat* GetMediaFormat() = 0;
// Schedules a read and takes ownership of the given buffer.
- virtual void Read(AssignableInterface<BufferInterface>* buffer) = 0;
+ virtual void Read(Assignable<Buffer>* buffer) = 0;
};
-class VideoDecoderInterface : public MediaFilterInterface {
+class VideoDecoder : public MediaFilter {
public:
static const FilterType kFilterType = FILTER_VIDEO_DECODER;
// Initializes this filter, returns true if successful, false otherwise.
- virtual bool Initialize(DemuxerStreamInterface* demuxer_stream) = 0;
+ virtual bool Initialize(DemuxerStream* demuxer_stream) = 0;
// Returns the MediaFormat for this filter.
virtual const MediaFormat* GetMediaFormat() = 0;
// Schedules a read and takes ownership of the given buffer.
- virtual void Read(AssignableInterface<VideoFrameInterface>* video_frame) = 0;
+ virtual void Read(Assignable<VideoFrame>* video_frame) = 0;
};
-class AudioDecoderInterface : public MediaFilterInterface {
+class AudioDecoder : public MediaFilter {
public:
static const FilterType kFilterType = FILTER_AUDIO_DECODER;
// Initializes this filter, returns true if successful, false otherwise.
- virtual bool Initialize(DemuxerStreamInterface* demuxer_stream) = 0;
+ virtual bool Initialize(DemuxerStream* demuxer_stream) = 0;
// Returns the MediaFormat for this filter.
virtual const MediaFormat* GetMediaFormat() = 0;
// Schedules a read and takes ownership of the given buffer.
- virtual void Read(AssignableInterface<BufferInterface>* buffer) = 0;
+ virtual void Read(Assignable<Buffer>* buffer) = 0;
};
-class VideoRendererInterface : public MediaFilterInterface {
+class VideoRenderer : public MediaFilter {
public:
static const FilterType kFilterType = FILTER_VIDEO_RENDERER;
// Initializes this filter, returns true if successful, false otherwise.
- virtual bool Initialize(VideoDecoderInterface* decoder) = 0;
+ virtual bool Initialize(VideoDecoder* decoder) = 0;
};
-class AudioRendererInterface : public MediaFilterInterface {
+class AudioRenderer : public MediaFilter {
public:
static const FilterType kFilterType = FILTER_AUDIO_RENDERER;
// Initializes this filter, returns true if successful, false otherwise.
- virtual bool Initialize(AudioDecoderInterface* decoder) = 0;
+ virtual bool Initialize(AudioDecoder* decoder) = 0;
};
} // namespace media