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

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

Issue 6648004: DemuxerFactory is born! (Closed)
Patch Set: Responses to scherkus@ CR Created 9 years, 9 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
« no previous file with comments | « no previous file | media/base/filter_collection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "media/base/filters.h" 11 #include "media/base/filters.h"
12 #include "media/base/filter_factories.h" 12 #include "media/base/filter_factories.h"
13 13
14 namespace media { 14 namespace media {
15 15
16 // This is a collection of Filter objects used to form a media playback 16 // This is a collection of Filter objects used to form a media playback
17 // pipeline. See src/media/base/pipeline.h for more information. 17 // pipeline. See src/media/base/pipeline.h for more information.
18 class FilterCollection { 18 class FilterCollection {
19 public: 19 public:
20 FilterCollection(); 20 FilterCollection();
21 ~FilterCollection(); 21 ~FilterCollection();
22 22
23 // DataSourceFactory accessor methods. 23 // DemuxerFactory accessor methods.
24 // FilterCollection takes ownership of the factory here. 24 // FilterCollection takes ownership of the factory here.
25 void SetDataSourceFactory(DataSourceFactory* factory); 25 void SetDemuxerFactory(DemuxerFactory* factory);
26 DataSourceFactory* GetDataSourceFactory(); 26 DemuxerFactory* GetDemuxerFactory();
27 27
28 // Adds a filter to the collection. 28 // Adds a filter to the collection.
29 void AddDemuxer(Demuxer* filter);
30 void AddVideoDecoder(VideoDecoder* filter); 29 void AddVideoDecoder(VideoDecoder* filter);
31 void AddAudioDecoder(AudioDecoder* filter); 30 void AddAudioDecoder(AudioDecoder* filter);
32 void AddVideoRenderer(VideoRenderer* filter); 31 void AddVideoRenderer(VideoRenderer* filter);
33 void AddAudioRenderer(AudioRenderer* filter); 32 void AddAudioRenderer(AudioRenderer* filter);
34 33
35 // Is the collection empty? 34 // Is the collection empty?
36 bool IsEmpty() const; 35 bool IsEmpty() const;
37 36
38 // Remove remaining filters. 37 // Remove remaining filters.
39 void Clear(); 38 void Clear();
40 39
41 // Selects a filter of the specified type from the collection. 40 // Selects a filter of the specified type from the collection.
42 // If the required filter cannot be found, NULL is returned. 41 // If the required filter cannot be found, NULL is returned.
43 // If a filter is returned it is removed from the collection. 42 // If a filter is returned it is removed from the collection.
44 void SelectDemuxer(scoped_refptr<Demuxer>* filter_out);
45 void SelectVideoDecoder(scoped_refptr<VideoDecoder>* filter_out); 43 void SelectVideoDecoder(scoped_refptr<VideoDecoder>* filter_out);
46 void SelectAudioDecoder(scoped_refptr<AudioDecoder>* filter_out); 44 void SelectAudioDecoder(scoped_refptr<AudioDecoder>* filter_out);
47 void SelectVideoRenderer(scoped_refptr<VideoRenderer>* filter_out); 45 void SelectVideoRenderer(scoped_refptr<VideoRenderer>* filter_out);
48 void SelectAudioRenderer(scoped_refptr<AudioRenderer>* filter_out); 46 void SelectAudioRenderer(scoped_refptr<AudioRenderer>* filter_out);
49 47
50 private: 48 private:
51 // Identifies the type of filter implementation. Each filter has to be one of 49 // Identifies the type of filter implementation. Each filter has to be one of
52 // the following types. This is used to mark, identify, and support 50 // the following types. This is used to mark, identify, and support
53 // downcasting of different filter types stored in the filters_ list. 51 // downcasting of different filter types stored in the filters_ list.
54 enum FilterType { 52 enum FilterType {
55 DEMUXER,
56 AUDIO_DECODER, 53 AUDIO_DECODER,
57 VIDEO_DECODER, 54 VIDEO_DECODER,
58 AUDIO_RENDERER, 55 AUDIO_RENDERER,
59 VIDEO_RENDERER, 56 VIDEO_RENDERER,
60 }; 57 };
61 58
62 // List of filters managed by this collection. 59 // List of filters managed by this collection.
63 typedef std::pair<FilterType, scoped_refptr<Filter> > FilterListElement; 60 typedef std::pair<FilterType, scoped_refptr<Filter> > FilterListElement;
64 typedef std::list<FilterListElement> FilterList; 61 typedef std::list<FilterListElement> FilterList;
65 FilterList filters_; 62 FilterList filters_;
66 scoped_ptr<DataSourceFactory> data_source_factory_; 63 scoped_ptr<DemuxerFactory> demuxer_factory_;
67 64
68 // Helper function that adds a filter to the filter list. 65 // Helper function that adds a filter to the filter list.
69 void AddFilter(FilterType filter_type, Filter* filter); 66 void AddFilter(FilterType filter_type, Filter* filter);
70 67
71 // Helper function for SelectXXX() methods. It manages the 68 // Helper function for SelectXXX() methods. It manages the
72 // downcasting and mapping between FilterType and Filter class. 69 // downcasting and mapping between FilterType and Filter class.
73 template<FilterType filter_type, typename F> 70 template<FilterType filter_type, typename F>
74 void SelectFilter(scoped_refptr<F>* filter_out); 71 void SelectFilter(scoped_refptr<F>* filter_out);
75 72
76 // Helper function that searches the filters list for a specific filter type. 73 // Helper function that searches the filters list for a specific filter type.
77 void SelectFilter(FilterType filter_type, scoped_refptr<Filter>* filter_out); 74 void SelectFilter(FilterType filter_type, scoped_refptr<Filter>* filter_out);
78 75
79 DISALLOW_COPY_AND_ASSIGN(FilterCollection); 76 DISALLOW_COPY_AND_ASSIGN(FilterCollection);
80 }; 77 };
81 78
82 } // namespace media 79 } // namespace media
83 80
84 #endif // MEDIA_BASE_FILTER_COLLECTION_H_ 81 #endif // MEDIA_BASE_FILTER_COLLECTION_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/filter_collection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698