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

Side by Side Diff: media/base/media_filter_collection.h

Issue 4653005: Move FilterType into MediaFilterCollection (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/filters.cc ('k') | media/base/media_filter_collection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_MEDIA_FILTER_COLLECTION_H_ 5 #ifndef MEDIA_BASE_MEDIA_FILTER_COLLECTION_H_
6 #define MEDIA_BASE_MEDIA_FILTER_COLLECTION_H_ 6 #define MEDIA_BASE_MEDIA_FILTER_COLLECTION_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
11 #include "media/base/filters.h" 11 #include "media/base/filters.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 // This is a collection of MediaFilter objects used to form a media playback 15 // This is a collection of MediaFilter objects used to form a media playback
16 // pipeline. See src/media/base/pipeline.h for more information. 16 // pipeline. See src/media/base/pipeline.h for more information.
17 class MediaFilterCollection { 17 class MediaFilterCollection {
18 public: 18 public:
19 MediaFilterCollection(); 19 MediaFilterCollection();
20 20
21 // Adds a filter to the collection. 21 // Adds a filter to the collection.
22 void AddFilter(MediaFilter* filter); 22 void AddFilter(DataSource* filter);
scherkus (not reviewing) 2010/11/11 01:47:12 FYI this will increase the size of this change but
acolwell GONE FROM CHROMIUM 2010/11/11 19:24:07 Done. I totally agree. On 2010/11/11 01:47:12, sc
23 void AddFilter(Demuxer* filter);
24 void AddFilter(VideoDecoder* filter);
25 void AddFilter(AudioDecoder* filter);
26 void AddFilter(VideoRenderer* filter);
27 void AddFilter(AudioRenderer* filter);
23 28
24 // Is the collection empty? 29 // Is the collection empty?
25 bool IsEmpty() const; 30 bool IsEmpty() const;
26 31
27 // Remove remaining filters. 32 // Remove remaining filters.
28 void Clear(); 33 void Clear();
29 34
30 // Selects a filter of the specified type from the collection. 35 // Selects a filter of the specified type from the collection.
31 // If the required filter cannot be found, NULL is returned. 36 // If the required filter cannot be found, NULL is returned.
32 // If a filter is returned it is removed from the collection. 37 // If a filter is returned it is removed from the collection.
33 template <class Filter> 38 void SelectFilter(scoped_refptr<DataSource>* filter_out);
34 void SelectFilter(scoped_refptr<Filter>* filter_out) { 39 void SelectFilter(scoped_refptr<Demuxer>* filter_out);
35 scoped_refptr<MediaFilter> filter; 40 void SelectFilter(scoped_refptr<VideoDecoder>* filter_out);
36 SelectFilter(Filter::static_filter_type(), &filter); 41 void SelectFilter(scoped_refptr<AudioDecoder>* filter_out);
37 *filter_out = reinterpret_cast<Filter*>(filter.get()); 42 void SelectFilter(scoped_refptr<VideoRenderer>* filter_out);
38 } 43 void SelectFilter(scoped_refptr<AudioRenderer>* filter_out);
39 44
40 private: 45 private:
46 // Identifies the type of filter implementation. Each filter has to be one of
47 // the following types. This is used to mark, identify, and support
48 // downcasting of different filter types stored in the filters_ list.
49 enum FilterType {
scherkus (not reviewing) 2010/11/11 01:47:12 I've always hated the Filter prefix and given this
acolwell GONE FROM CHROMIUM 2010/11/11 19:24:07 Done.
50 FILTER_DATA_SOURCE,
51 FILTER_DEMUXER,
52 FILTER_AUDIO_DECODER,
53 FILTER_VIDEO_DECODER,
54 FILTER_AUDIO_RENDERER,
55 FILTER_VIDEO_RENDERER
56 };
57
scherkus (not reviewing) 2010/11/11 01:47:12 nit: remove extra blank line
acolwell GONE FROM CHROMIUM 2010/11/11 19:24:07 Done.
58
41 // List of filters managed by this collection. 59 // List of filters managed by this collection.
42 std::list<scoped_refptr<MediaFilter> > filters_; 60 typedef std::list<Tuple2<FilterType,
scherkus (not reviewing) 2010/11/11 01:47:12 instead of mixing std and google Tuple2 maybe use
acolwell GONE FROM CHROMIUM 2010/11/11 19:24:07 Done.
61 scoped_refptr<MediaFilter> > > FilterList;
62 FilterList filters_;
63
64 // Helper funtion that adds a filter to the filter list.
scherkus (not reviewing) 2010/11/11 01:47:12 funtion -> function
acolwell GONE FROM CHROMIUM 2010/11/11 19:24:07 Done.
65 void AddFilter(FilterType filter_type, MediaFilter* filter);
66
67 // Helper function for SelectFilter() that manages the
68 // downcasting and mapping between FilterType & Filter class.
scherkus (not reviewing) 2010/11/11 01:47:12 nit: & -> and from scanning I thought you meant a
acolwell GONE FROM CHROMIUM 2010/11/11 19:24:07 Done.
69 template<FilterType filter_type, class Filter>
70 void SelectFilter(scoped_refptr<Filter>* filter_out);
43 71
44 // Helper function that searches the filters list for a specific 72 // Helper function that searches the filters list for a specific
45 // filter type. 73 // filter type.
46 void SelectFilter(FilterType filter_type, 74 void SelectFilter(FilterType filter_type,
47 scoped_refptr<MediaFilter>* filter_out); 75 scoped_refptr<MediaFilter>* filter_out);
48 76
49 DISALLOW_COPY_AND_ASSIGN(MediaFilterCollection); 77 DISALLOW_COPY_AND_ASSIGN(MediaFilterCollection);
50 }; 78 };
51 79
52 } // namespace media 80 } // namespace media
53 81
54 #endif // MEDIA_BASE_MEDIA_FILTER_COLLECTION_H_ 82 #endif // MEDIA_BASE_MEDIA_FILTER_COLLECTION_H_
OLDNEW
« 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