Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1130)

Unified Diff: media/base/filters.h

Issue 42521: Ability for demuxer clients to get to FFmpeg's AVStream object exposed as an ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/mock_media_filters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/filters.h
===================================================================
--- media/base/filters.h (revision 12463)
+++ media/base/filters.h (working copy)
@@ -147,11 +147,11 @@
virtual size_t GetNumberOfStreams() = 0;
// Returns the stream for the given index, NULL otherwise
- virtual DemuxerStream* GetStream(int stream_id) = 0;
+ virtual scoped_refptr<DemuxerStream> GetStream(int stream_id) = 0;
};
-class DemuxerStream {
+class DemuxerStream : public base::RefCountedThreadSafe<DemuxerStream> {
public:
// Returns the MediaFormat for this filter.
virtual const MediaFormat* GetMediaFormat() = 0;
@@ -159,7 +159,27 @@
// Schedules a read and takes ownership of the given buffer.
virtual void Read(Assignable<Buffer>* buffer) = 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(scoped_refptr<Interface>* interface_out) {
+ void* i = QueryInterface(Interface::interface_id());
+ *interface_out = reinterpret_cast<Interface*>(i);
+ return (NULL != i);
+ };
+
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) { return NULL; }
+
+ friend class base::RefCountedThreadSafe<DemuxerStream>;
virtual ~DemuxerStream() {}
};
« no previous file with comments | « no previous file | media/base/mock_media_filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698