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

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

Issue 9325044: Remove AudioDecoder from the Filter heirarchy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 months 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
OLDNEW
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/audio_decoder.h"
11 #include "media/base/demuxer_factory.h" 12 #include "media/base/demuxer_factory.h"
12 #include "media/base/filters.h" 13 #include "media/base/filters.h"
13 14
14 namespace media { 15 namespace media {
15 16
16 // This is a collection of Filter objects used to form a media playback 17 // This is a collection of Filter objects used to form a media playback
17 // pipeline. See src/media/base/pipeline.h for more information. 18 // pipeline. See src/media/base/pipeline.h for more information.
18 class MEDIA_EXPORT FilterCollection { 19 class MEDIA_EXPORT FilterCollection {
19 public: 20 public:
20 FilterCollection(); 21 FilterCollection();
21 ~FilterCollection(); 22 ~FilterCollection();
22 23
23 // DemuxerFactory accessor methods. 24 // DemuxerFactory accessor methods.
24 void SetDemuxerFactory(scoped_ptr<DemuxerFactory> factory); 25 void SetDemuxerFactory(scoped_ptr<DemuxerFactory> factory);
25 DemuxerFactory* GetDemuxerFactory(); 26 DemuxerFactory* GetDemuxerFactory();
26 27
27 // Adds a filter to the collection. 28 // Adds a filter to the collection.
28 void AddVideoDecoder(VideoDecoder* filter); 29 void AddVideoDecoder(VideoDecoder* filter);
29 void AddAudioDecoder(AudioDecoder* filter); 30 void AddAudioDecoder(AudioDecoder* audio_decoder);
30 void AddVideoRenderer(VideoRenderer* filter); 31 void AddVideoRenderer(VideoRenderer* filter);
31 void AddAudioRenderer(AudioRenderer* filter); 32 void AddAudioRenderer(AudioRenderer* filter);
32 33
33 // Is the collection empty? 34 // Is the collection empty?
34 bool IsEmpty() const; 35 bool IsEmpty() const;
35 36
36 // Remove remaining filters. 37 // Remove remaining filters.
37 void Clear(); 38 void Clear();
38 39
39 // Selects a filter of the specified type from the collection. 40 // Selects a filter of the specified type from the collection.
40 // If the required filter cannot be found, NULL is returned. 41 // If the required filter cannot be found, NULL is returned.
41 // If a filter is returned it is removed from the collection. 42 // If a filter is returned it is removed from the collection.
42 // Filters are selected in FIFO order. 43 // Filters are selected in FIFO order.
43 void SelectVideoDecoder(scoped_refptr<VideoDecoder>* filter_out); 44 void SelectVideoDecoder(scoped_refptr<VideoDecoder>* filter_out);
44 void SelectAudioDecoder(scoped_refptr<AudioDecoder>* filter_out); 45 void SelectAudioDecoder(scoped_refptr<AudioDecoder>* out);
45 void SelectVideoRenderer(scoped_refptr<VideoRenderer>* filter_out); 46 void SelectVideoRenderer(scoped_refptr<VideoRenderer>* filter_out);
46 void SelectAudioRenderer(scoped_refptr<AudioRenderer>* filter_out); 47 void SelectAudioRenderer(scoped_refptr<AudioRenderer>* filter_out);
47 48
48 private: 49 private:
49 // Identifies the type of filter implementation. Each filter has to be one of 50 // Identifies the type of filter implementation. Each filter has to be one of
50 // the following types. This is used to mark, identify, and support 51 // the following types. This is used to mark, identify, and support
51 // downcasting of different filter types stored in the filters_ list. 52 // downcasting of different filter types stored in the filters_ list.
52 enum FilterType { 53 enum FilterType {
53 AUDIO_DECODER,
54 VIDEO_DECODER, 54 VIDEO_DECODER,
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_ptr<DemuxerFactory> demuxer_factory_;
64 std::list<scoped_refptr<AudioDecoder> > audio_decoders_;
64 65
65 // Helper function that adds a filter to the filter list. 66 // Helper function that adds a filter to the filter list.
66 void AddFilter(FilterType filter_type, Filter* filter); 67 void AddFilter(FilterType filter_type, Filter* filter);
67 68
68 // Helper function for SelectXXX() methods. It manages the 69 // Helper function for SelectXXX() methods. It manages the
69 // downcasting and mapping between FilterType and Filter class. 70 // downcasting and mapping between FilterType and Filter class.
70 template<FilterType filter_type, typename F> 71 template<FilterType filter_type, typename F>
71 void SelectFilter(scoped_refptr<F>* filter_out); 72 void SelectFilter(scoped_refptr<F>* filter_out);
72 73
73 // Helper function that searches the filters list for a specific filter type. 74 // Helper function that searches the filters list for a specific filter type.
74 void SelectFilter(FilterType filter_type, scoped_refptr<Filter>* filter_out); 75 void SelectFilter(FilterType filter_type, scoped_refptr<Filter>* filter_out);
75 76
76 DISALLOW_COPY_AND_ASSIGN(FilterCollection); 77 DISALLOW_COPY_AND_ASSIGN(FilterCollection);
77 }; 78 };
78 79
79 } // namespace media 80 } // namespace media
80 81
81 #endif // MEDIA_BASE_FILTER_COLLECTION_H_ 82 #endif // MEDIA_BASE_FILTER_COLLECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698