| 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_FILTER_COLLECTION_H_ | 5 #ifndef MEDIA_BASE_FILTER_COLLECTION_H_ |
| 6 #define MEDIA_BASE_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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 bool IsEmpty() const; | 30 bool IsEmpty() const; |
| 31 | 31 |
| 32 // Remove remaining filters. | 32 // Remove remaining filters. |
| 33 void Clear(); | 33 void Clear(); |
| 34 | 34 |
| 35 // Selects a filter of the specified type from the collection. | 35 // Selects a filter of the specified type from the collection. |
| 36 // If the required filter cannot be found, NULL is returned. | 36 // If the required filter cannot be found, NULL is returned. |
| 37 // If a filter is returned it is removed from the collection. | 37 // If a filter is returned it is removed from the collection. |
| 38 void SelectDataSource(scoped_refptr<DataSource>* filter_out); | 38 void SelectDataSource(scoped_refptr<DataSource>* filter_out); |
| 39 void SelectDemuxer(scoped_refptr<Demuxer>* filter_out); | 39 void SelectDemuxer(scoped_refptr<Demuxer>* filter_out); |
| 40 void SelectVideoDecoder(scoped_refptr<VideoDecoder>* filter_out); | 40 void SelectVideoDecoder(scoped_refptr<VideoDecoder>* filter_out, |
| 41 int codec_id); |
| 41 void SelectAudioDecoder(scoped_refptr<AudioDecoder>* filter_out); | 42 void SelectAudioDecoder(scoped_refptr<AudioDecoder>* filter_out); |
| 42 void SelectVideoRenderer(scoped_refptr<VideoRenderer>* filter_out); | 43 void SelectVideoRenderer(scoped_refptr<VideoRenderer>* filter_out); |
| 43 void SelectAudioRenderer(scoped_refptr<AudioRenderer>* filter_out); | 44 void SelectAudioRenderer(scoped_refptr<AudioRenderer>* filter_out); |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 // Identifies the type of filter implementation. Each filter has to be one of | 47 // 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 // the following types. This is used to mark, identify, and support |
| 48 // downcasting of different filter types stored in the filters_ list. | 49 // downcasting of different filter types stored in the filters_ list. |
| 49 enum FilterType { | 50 enum FilterType { |
| 50 DATA_SOURCE, | 51 DATA_SOURCE, |
| 51 DEMUXER, | 52 DEMUXER, |
| 52 AUDIO_DECODER, | 53 AUDIO_DECODER, |
| 53 VIDEO_DECODER, | 54 VIDEO_DECODER, |
| 54 AUDIO_RENDERER, | 55 AUDIO_RENDERER, |
| 55 VIDEO_RENDERER, | 56 VIDEO_RENDERER, |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 // List of filters managed by this collection. | 59 // List of filters managed by this collection. |
| 59 typedef std::pair<FilterType, scoped_refptr<Filter> > FilterListElement; | 60 typedef std::pair<FilterType, scoped_refptr<Filter> > FilterListElement; |
| 60 typedef std::list<FilterListElement> FilterList; | 61 typedef std::list<FilterListElement> FilterList; |
| 61 FilterList filters_; | 62 FilterList filters_; |
| 62 | 63 |
| 63 // Helper function that adds a filter to the filter list. | 64 // Helper function that adds a filter to the filter list. |
| 64 void AddFilter(FilterType filter_type, Filter* filter); | 65 void AddFilter(FilterType filter_type, Filter* filter); |
| 65 | 66 |
| 66 // Helper function for SelectXXX() methods. It manages the | 67 // Helper function for SelectXXX() methods. It manages the |
| 67 // downcasting and mapping between FilterType and Filter class. | 68 // downcasting and mapping between FilterType and Filter class. |
| 68 template<FilterType filter_type, typename F> | 69 template<FilterType filter_type, typename F> |
| 69 void SelectFilter(scoped_refptr<F>* filter_out); | 70 void SelectFilter(scoped_refptr<F>* filter_out, void *filter_props); |
| 70 | 71 |
| 71 // Helper function that searches the filters list for a specific filter type. | 72 // Helper function that searches the filters list for a specific filter type |
| 72 void SelectFilter(FilterType filter_type, scoped_refptr<Filter>* filter_out); | 73 // and filter properties. |
| 74 void SelectFilter(FilterType filter_type, scoped_refptr<Filter>* filter_out, |
| 75 void *filter_props); |
| 73 | 76 |
| 74 DISALLOW_COPY_AND_ASSIGN(FilterCollection); | 77 DISALLOW_COPY_AND_ASSIGN(FilterCollection); |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 } // namespace media | 80 } // namespace media |
| 78 | 81 |
| 79 #endif // MEDIA_BASE_FILTER_COLLECTION_H_ | 82 #endif // MEDIA_BASE_FILTER_COLLECTION_H_ |
| OLD | NEW |