OLD | NEW |
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_FILTER_COLLECTION_H_ |
6 #define MEDIA_BASE_MEDIA_FILTER_COLLECTION_H_ | 6 #define MEDIA_BASE_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 Filter 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 FilterCollection { |
18 public: | 18 public: |
19 MediaFilterCollection(); | 19 FilterCollection(); |
20 | 20 |
21 // Adds a filter to the collection. | 21 // Adds a filter to the collection. |
22 void AddDataSource(DataSource* filter); | 22 void AddDataSource(DataSource* filter); |
23 void AddDemuxer(Demuxer* filter); | 23 void AddDemuxer(Demuxer* filter); |
24 void AddVideoDecoder(VideoDecoder* filter); | 24 void AddVideoDecoder(VideoDecoder* filter); |
25 void AddAudioDecoder(AudioDecoder* filter); | 25 void AddAudioDecoder(AudioDecoder* filter); |
26 void AddVideoRenderer(VideoRenderer* filter); | 26 void AddVideoRenderer(VideoRenderer* filter); |
27 void AddAudioRenderer(AudioRenderer* filter); | 27 void AddAudioRenderer(AudioRenderer* filter); |
28 | 28 |
29 // Is the collection empty? | 29 // Is the collection empty? |
(...skipping 15 matching lines...) Expand all Loading... |
45 private: | 45 private: |
46 // Identifies the type of filter implementation. Each filter has to be one of | 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 | 47 // the following types. This is used to mark, identify, and support |
48 // downcasting of different filter types stored in the filters_ list. | 48 // downcasting of different filter types stored in the filters_ list. |
49 enum FilterType { | 49 enum FilterType { |
50 DATA_SOURCE, | 50 DATA_SOURCE, |
51 DEMUXER, | 51 DEMUXER, |
52 AUDIO_DECODER, | 52 AUDIO_DECODER, |
53 VIDEO_DECODER, | 53 VIDEO_DECODER, |
54 AUDIO_RENDERER, | 54 AUDIO_RENDERER, |
55 VIDEO_RENDERER | 55 VIDEO_RENDERER, |
56 }; | 56 }; |
57 | 57 |
58 // List of filters managed by this collection. | 58 // List of filters managed by this collection. |
59 typedef std::pair<FilterType, scoped_refptr<MediaFilter> > FilterListElement; | 59 typedef std::pair<FilterType, scoped_refptr<Filter> > FilterListElement; |
60 typedef std::list<FilterListElement> FilterList; | 60 typedef std::list<FilterListElement> FilterList; |
61 FilterList filters_; | 61 FilterList filters_; |
62 | 62 |
63 // Helper function that adds a filter to the filter list. | 63 // Helper function that adds a filter to the filter list. |
64 void AddFilter(FilterType filter_type, MediaFilter* filter); | 64 void AddFilter(FilterType filter_type, Filter* filter); |
65 | 65 |
66 // Helper function for SelectXXX() methods. It manages the | 66 // Helper function for SelectXXX() methods. It manages the |
67 // downcasting and mapping between FilterType and Filter class. | 67 // downcasting and mapping between FilterType and Filter class. |
68 template<FilterType filter_type, class Filter> | 68 template<FilterType filter_type, typename F> |
69 void SelectFilter(scoped_refptr<Filter>* filter_out); | 69 void SelectFilter(scoped_refptr<F>* filter_out); |
70 | 70 |
71 // Helper function that searches the filters list for a specific | 71 // Helper function that searches the filters list for a specific filter type. |
72 // filter type. | 72 void SelectFilter(FilterType filter_type, scoped_refptr<Filter>* filter_out); |
73 void SelectFilter(FilterType filter_type, | |
74 scoped_refptr<MediaFilter>* filter_out); | |
75 | 73 |
76 DISALLOW_COPY_AND_ASSIGN(MediaFilterCollection); | 74 DISALLOW_COPY_AND_ASSIGN(FilterCollection); |
77 }; | 75 }; |
78 | 76 |
79 } // namespace media | 77 } // namespace media |
80 | 78 |
81 #endif // MEDIA_BASE_MEDIA_FILTER_COLLECTION_H_ | 79 #endif // MEDIA_BASE_FILTER_COLLECTION_H_ |
OLD | NEW |