| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "media/base/demuxer_factory.h" | 11 #include "media/base/demuxer.h" |
| 12 #include "media/base/filters.h" | 12 #include "media/base/filters.h" |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 | 15 |
| 16 class AudioDecoder; | 16 class AudioDecoder; |
| 17 | 17 |
| 18 // This is a collection of Filter objects used to form a media playback | 18 // This is a collection of Filter objects used to form a media playback |
| 19 // pipeline. See src/media/base/pipeline.h for more information. | 19 // pipeline. See src/media/base/pipeline.h for more information. |
| 20 class MEDIA_EXPORT FilterCollection { | 20 class MEDIA_EXPORT FilterCollection { |
| 21 public: | 21 public: |
| 22 FilterCollection(); | 22 FilterCollection(); |
| 23 ~FilterCollection(); | 23 ~FilterCollection(); |
| 24 | 24 |
| 25 // DemuxerFactory accessor methods. | 25 // Demuxer accessor methods. |
| 26 void SetDemuxerFactory(scoped_ptr<DemuxerFactory> factory); | 26 void SetDemuxer(const scoped_refptr<Demuxer>& demuxer); |
| 27 DemuxerFactory* GetDemuxerFactory(); | 27 const scoped_refptr<Demuxer>& GetDemuxer(); |
| 28 | 28 |
| 29 // Adds a filter to the collection. | 29 // Adds a filter to the collection. |
| 30 void AddAudioDecoder(AudioDecoder* audio_decoder); | 30 void AddAudioDecoder(AudioDecoder* audio_decoder); |
| 31 void AddVideoDecoder(VideoDecoder* video_decoder); | 31 void AddVideoDecoder(VideoDecoder* video_decoder); |
| 32 void AddAudioRenderer(AudioRenderer* filter); | 32 void AddAudioRenderer(AudioRenderer* filter); |
| 33 void AddVideoRenderer(VideoRenderer* filter); | 33 void AddVideoRenderer(VideoRenderer* filter); |
| 34 | 34 |
| 35 // Is the collection empty? | 35 // Is the collection empty? |
| 36 bool IsEmpty() const; | 36 bool IsEmpty() const; |
| 37 | 37 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 53 // downcasting of different filter types stored in the filters_ list. | 53 // downcasting of different filter types stored in the filters_ list. |
| 54 enum FilterType { | 54 enum FilterType { |
| 55 AUDIO_RENDERER, | 55 AUDIO_RENDERER, |
| 56 VIDEO_RENDERER, | 56 VIDEO_RENDERER, |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // List of filters managed by this collection. | 59 // List of filters managed by this collection. |
| 60 typedef std::pair<FilterType, scoped_refptr<Filter> > FilterListElement; | 60 typedef std::pair<FilterType, scoped_refptr<Filter> > FilterListElement; |
| 61 typedef std::list<FilterListElement> FilterList; | 61 typedef std::list<FilterListElement> FilterList; |
| 62 FilterList filters_; | 62 FilterList filters_; |
| 63 scoped_ptr<DemuxerFactory> demuxer_factory_; | 63 scoped_refptr<Demuxer> demuxer_; |
| 64 std::list<scoped_refptr<AudioDecoder> > audio_decoders_; | 64 std::list<scoped_refptr<AudioDecoder> > audio_decoders_; |
| 65 std::list<scoped_refptr<VideoDecoder> > video_decoders_; | 65 std::list<scoped_refptr<VideoDecoder> > video_decoders_; |
| 66 | 66 |
| 67 // Helper function that adds a filter to the filter list. | 67 // Helper function that adds a filter to the filter list. |
| 68 void AddFilter(FilterType filter_type, Filter* filter); | 68 void AddFilter(FilterType filter_type, Filter* filter); |
| 69 | 69 |
| 70 // Helper function for SelectXXX() methods. It manages the | 70 // Helper function for SelectXXX() methods. It manages the |
| 71 // downcasting and mapping between FilterType and Filter class. | 71 // downcasting and mapping between FilterType and Filter class. |
| 72 template<FilterType filter_type, typename F> | 72 template<FilterType filter_type, typename F> |
| 73 void SelectFilter(scoped_refptr<F>* filter_out); | 73 void SelectFilter(scoped_refptr<F>* filter_out); |
| 74 | 74 |
| 75 // Helper function that searches the filters list for a specific filter type. | 75 // Helper function that searches the filters list for a specific filter type. |
| 76 void SelectFilter(FilterType filter_type, scoped_refptr<Filter>* filter_out); | 76 void SelectFilter(FilterType filter_type, scoped_refptr<Filter>* filter_out); |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(FilterCollection); | 78 DISALLOW_COPY_AND_ASSIGN(FilterCollection); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace media | 81 } // namespace media |
| 82 | 82 |
| 83 #endif // MEDIA_BASE_FILTER_COLLECTION_H_ | 83 #endif // MEDIA_BASE_FILTER_COLLECTION_H_ |
| OLD | NEW |