| 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 "base/memory/scoped_ptr.h" | |
| 12 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
| 13 | 12 |
| 14 namespace media { | 13 namespace media { |
| 15 | 14 |
| 16 class AudioDecoder; | 15 class AudioDecoder; |
| 17 class AudioRenderer; | 16 class AudioRenderer; |
| 18 class Demuxer; | 17 class Demuxer; |
| 19 class VideoDecoder; | 18 class VideoDecoder; |
| 20 class VideoRenderer; | 19 class VideoRenderer; |
| 21 | 20 |
| 22 // Represents a set of uninitialized demuxer and audio/video decoders and | 21 // Represents a set of uninitialized demuxer and audio/video decoders and |
| 23 // renderers. Used to start a Pipeline object for media playback. | 22 // renderers. Used to start a Pipeline object for media playback. |
| 24 // | 23 // |
| 25 // TODO(scherkus): Replace FilterCollection with something sensible, see | 24 // TODO(scherkus): Replace FilterCollection with something sensible, see |
| 26 // http://crbug.com/110800 | 25 // http://crbug.com/110800 |
| 27 class MEDIA_EXPORT FilterCollection { | 26 class MEDIA_EXPORT FilterCollection { |
| 28 public: | 27 public: |
| 29 typedef std::list<scoped_refptr<AudioDecoder> > AudioDecoderList; | 28 typedef std::list<scoped_refptr<AudioDecoder> > AudioDecoderList; |
| 30 typedef std::list<scoped_refptr<VideoDecoder> > VideoDecoderList; | 29 typedef std::list<scoped_refptr<VideoDecoder> > VideoDecoderList; |
| 31 | 30 |
| 32 FilterCollection(); | 31 FilterCollection(); |
| 33 ~FilterCollection(); | 32 ~FilterCollection(); |
| 34 | 33 |
| 34 // Demuxer accessor methods. |
| 35 void SetDemuxer(const scoped_refptr<Demuxer>& demuxer); | 35 void SetDemuxer(const scoped_refptr<Demuxer>& demuxer); |
| 36 const scoped_refptr<Demuxer>& GetDemuxer(); | 36 const scoped_refptr<Demuxer>& GetDemuxer(); |
| 37 | 37 |
| 38 void SetAudioRenderer(scoped_ptr<AudioRenderer> audio_renderer); | 38 // Adds a filter to the collection. |
| 39 scoped_ptr<AudioRenderer> GetAudioRenderer(); | 39 void AddAudioDecoder(AudioDecoder* audio_decoder); |
| 40 | 40 void AddAudioRenderer(AudioRenderer* audio_renderer); |
| 41 void SetVideoRenderer(scoped_ptr<VideoRenderer> video_renderer); | 41 void AddVideoRenderer(VideoRenderer* video_renderer); |
| 42 scoped_ptr<VideoRenderer> GetVideoRenderer(); | |
| 43 | 42 |
| 44 // Remove remaining filters. | 43 // Remove remaining filters. |
| 45 void Clear(); | 44 void Clear(); |
| 46 | 45 |
| 46 // Selects a filter of the specified type from the collection. |
| 47 // If the required filter cannot be found, NULL is returned. |
| 48 // If a filter is returned it is removed from the collection. |
| 49 // Filters are selected in FIFO order. |
| 50 void SelectAudioRenderer(scoped_refptr<AudioRenderer>* out); |
| 51 void SelectVideoRenderer(scoped_refptr<VideoRenderer>* out); |
| 52 |
| 47 AudioDecoderList* GetAudioDecoders(); | 53 AudioDecoderList* GetAudioDecoders(); |
| 48 VideoDecoderList* GetVideoDecoders(); | 54 VideoDecoderList* GetVideoDecoders(); |
| 49 | 55 |
| 50 private: | 56 private: |
| 51 scoped_refptr<Demuxer> demuxer_; | 57 scoped_refptr<Demuxer> demuxer_; |
| 52 AudioDecoderList audio_decoders_; | 58 AudioDecoderList audio_decoders_; |
| 53 VideoDecoderList video_decoders_; | 59 VideoDecoderList video_decoders_; |
| 54 scoped_ptr<AudioRenderer> audio_renderer_; | 60 std::list<scoped_refptr<AudioRenderer> > audio_renderers_; |
| 55 scoped_ptr<VideoRenderer> video_renderer_; | 61 std::list<scoped_refptr<VideoRenderer> > video_renderers_; |
| 56 | 62 |
| 57 DISALLOW_COPY_AND_ASSIGN(FilterCollection); | 63 DISALLOW_COPY_AND_ASSIGN(FilterCollection); |
| 58 }; | 64 }; |
| 59 | 65 |
| 60 } // namespace media | 66 } // namespace media |
| 61 | 67 |
| 62 #endif // MEDIA_BASE_FILTER_COLLECTION_H_ | 68 #endif // MEDIA_BASE_FILTER_COLLECTION_H_ |
| OLD | NEW |