summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-24 20:01:35 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-24 20:01:35 +0000
commit1a48048a07ce4d4ba771c206f6ceb48f1438ec98 (patch)
treed4047e2856b804162949e5244e9708bf574226b0 /media/base
parent3e55e217f748774885c8babb9a8a1d3dcc4a163b (diff)
downloadchromium_src-1a48048a07ce4d4ba771c206f6ceb48f1438ec98.zip
chromium_src-1a48048a07ce4d4ba771c206f6ceb48f1438ec98.tar.gz
chromium_src-1a48048a07ce4d4ba771c206f6ceb48f1438ec98.tar.bz2
Die, DemuxerStream::QueryInterface, die!
This appears to have been an attempt at hand-rolling an RTTI system, all for the use of a *single* class (!). Removing it makes for cleaner, simpler, shorter code. It also enables delegating DemuxerStreams, which wasn't possible before (b/c the overridable method was protected, so not visible to a HAS-A wrapper). BUG=none TEST=trybots Review URL: http://codereview.chromium.org/6730006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79309 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r--media/base/filters.cc2
-rw-r--r--media/base/filters.h22
-rw-r--r--media/base/mock_filters.h2
3 files changed, 6 insertions, 20 deletions
diff --git a/media/base/filters.cc b/media/base/filters.cc
index fc5f537..1386842 100644
--- a/media/base/filters.cc
+++ b/media/base/filters.cc
@@ -66,7 +66,7 @@ void Filter::Seek(base::TimeDelta time, FilterCallback* callback) {
void Filter::OnAudioRendererDisabled() {
}
-void* DemuxerStream::QueryInterface(const char* interface_id) {
+AVStream* DemuxerStream::GetAVStream() {
return NULL;
}
diff --git a/media/base/filters.h b/media/base/filters.h
index d6b962d..88e6143 100644
--- a/media/base/filters.h
+++ b/media/base/filters.h
@@ -33,6 +33,8 @@
#include "media/base/media_format.h"
#include "media/base/video_frame.h"
+struct AVStream;
+
namespace media {
class Buffer;
@@ -144,16 +146,8 @@ class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> {
// TODO(scherkus): switch Read() callback to scoped_refptr<>.
virtual void Read(Callback1<Buffer*>::Type* read_callback) = 0;
- // Given a class that supports the |Interface| and a related static method
- // interface_id(), which returns a const char*, this method returns true if
- // the class returns an interface pointer and assigns the pointer to
- // |interface_out|. Otherwise this method returns false.
- template <class Interface>
- bool QueryInterface(Interface** interface_out) {
- void* i = QueryInterface(Interface::interface_id());
- *interface_out = reinterpret_cast<Interface*>(i);
- return (NULL != i);
- };
+ // Returns an |AVStream*| if supported, or NULL.
+ virtual AVStream* GetAVStream();
// Returns the type of stream.
virtual Type type() = 0;
@@ -164,14 +158,6 @@ class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> {
virtual void EnableBitstreamConverter() = 0;
protected:
- // Optional method that is implemented by filters that support extended
- // interfaces. The filter should return a pointer to the interface
- // associated with the |interface_id| string if they support it, otherwise
- // return NULL to indicate the interface is unknown. The derived filter
- // should NOT AddRef() the interface. The DemuxerStream::QueryInterface()
- // public template function will assign the interface to a scoped_refptr<>.
- virtual void* QueryInterface(const char* interface_id);
-
friend class base::RefCountedThreadSafe<DemuxerStream>;
virtual ~DemuxerStream();
};
diff --git a/media/base/mock_filters.h b/media/base/mock_filters.h
index 44d3236..205218f 100644
--- a/media/base/mock_filters.h
+++ b/media/base/mock_filters.h
@@ -156,7 +156,7 @@ class MockDemuxerStream : public DemuxerStream {
MOCK_METHOD0(type, Type());
MOCK_METHOD0(media_format, const MediaFormat&());
MOCK_METHOD1(Read, void(Callback1<Buffer*>::Type* read_callback));
- MOCK_METHOD1(QueryInterface, void*(const char* interface_id));
+ MOCK_METHOD0(GetAVStream, AVStream*());
MOCK_METHOD0(EnableBitstreamConverter, void());
protected: