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

Unified Diff: media/base/media_filter_collection.h

Issue 4991003: Revert 66125 -- Broke Windows build - Move FilterType into MediaFilterCollect... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | « media/base/filters.cc ('k') | media/base/media_filter_collection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/media_filter_collection.h
===================================================================
--- media/base/media_filter_collection.h (revision 66137)
+++ media/base/media_filter_collection.h (working copy)
@@ -19,12 +19,7 @@
MediaFilterCollection();
// Adds a filter to the collection.
- void AddDataSource(DataSource* filter);
- void AddDemuxer(Demuxer* filter);
- void AddVideoDecoder(VideoDecoder* filter);
- void AddAudioDecoder(AudioDecoder* filter);
- void AddVideoRenderer(VideoRenderer* filter);
- void AddAudioRenderer(AudioRenderer* filter);
+ void AddFilter(MediaFilter* filter);
// Is the collection empty?
bool IsEmpty() const;
@@ -35,39 +30,17 @@
// Selects a filter of the specified type from the collection.
// If the required filter cannot be found, NULL is returned.
// If a filter is returned it is removed from the collection.
- void SelectDataSource(scoped_refptr<DataSource>* filter_out);
- void SelectDemuxer(scoped_refptr<Demuxer>* filter_out);
- void SelectVideoDecoder(scoped_refptr<VideoDecoder>* filter_out);
- void SelectAudioDecoder(scoped_refptr<AudioDecoder>* filter_out);
- void SelectVideoRenderer(scoped_refptr<VideoRenderer>* filter_out);
- void SelectAudioRenderer(scoped_refptr<AudioRenderer>* filter_out);
+ template <class Filter>
+ void SelectFilter(scoped_refptr<Filter>* filter_out) {
+ scoped_refptr<MediaFilter> filter;
+ SelectFilter(Filter::static_filter_type(), &filter);
+ *filter_out = reinterpret_cast<Filter*>(filter.get());
+ }
private:
- // Identifies the type of filter implementation. Each filter has to be one of
- // the following types. This is used to mark, identify, and support
- // downcasting of different filter types stored in the filters_ list.
- enum FilterType {
- DATA_SOURCE,
- DEMUXER,
- AUDIO_DECODER,
- VIDEO_DECODER,
- AUDIO_RENDERER,
- VIDEO_RENDERER
- };
-
// List of filters managed by this collection.
- typedef std::pair<FilterType, scoped_refptr<MediaFilter> > FilterListElement;
- typedef std::list<FilterListElement> FilterList;
- FilterList filters_;
+ std::list<scoped_refptr<MediaFilter> > filters_;
- // Helper function that adds a filter to the filter list.
- void AddFilter(FilterType filter_type, MediaFilter* filter);
-
- // Helper function for SelectXXX() methods. It manages the
- // downcasting and mapping between FilterType and Filter class.
- template<FilterType filter_type, class Filter>
- void SelectFilter(scoped_refptr<Filter>* filter_out);
-
// Helper function that searches the filters list for a specific
// filter type.
void SelectFilter(FilterType filter_type,
« no previous file with comments | « media/base/filters.cc ('k') | media/base/media_filter_collection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698