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 #include "media/base/filter_collection.h" | 5 #include "media/base/filter_collection.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
11 FilterCollection::FilterCollection() {} | 11 FilterCollection::FilterCollection() {} |
12 | 12 |
13 FilterCollection::~FilterCollection() {} | 13 FilterCollection::~FilterCollection() {} |
14 | 14 |
15 void FilterCollection::SetDataSourceFactory(DataSourceFactory* factory) { | 15 void FilterCollection::SetDemuxerFactory(DemuxerFactory* factory) { |
16 DCHECK(factory); | 16 DCHECK(factory); |
17 data_source_factory_.reset(factory); | 17 demuxer_factory_.reset(factory); |
18 } | 18 } |
19 | 19 |
20 DataSourceFactory* FilterCollection::GetDataSourceFactory() { | 20 DemuxerFactory* FilterCollection::GetDemuxerFactory() { |
21 return data_source_factory_.get(); | 21 return demuxer_factory_.get(); |
22 } | |
23 | |
24 void FilterCollection::AddDemuxer(Demuxer* filter) { | |
25 AddFilter(DEMUXER, filter); | |
26 } | 22 } |
27 | 23 |
28 void FilterCollection::AddVideoDecoder(VideoDecoder* filter) { | 24 void FilterCollection::AddVideoDecoder(VideoDecoder* filter) { |
29 AddFilter(VIDEO_DECODER, filter); | 25 AddFilter(VIDEO_DECODER, filter); |
30 } | 26 } |
31 | 27 |
32 void FilterCollection::AddAudioDecoder(AudioDecoder* filter) { | 28 void FilterCollection::AddAudioDecoder(AudioDecoder* filter) { |
33 AddFilter(AUDIO_DECODER, filter); | 29 AddFilter(AUDIO_DECODER, filter); |
34 } | 30 } |
35 | 31 |
36 void FilterCollection::AddVideoRenderer(VideoRenderer* filter) { | 32 void FilterCollection::AddVideoRenderer(VideoRenderer* filter) { |
37 AddFilter(VIDEO_RENDERER, filter); | 33 AddFilter(VIDEO_RENDERER, filter); |
38 } | 34 } |
39 | 35 |
40 void FilterCollection::AddAudioRenderer(AudioRenderer* filter) { | 36 void FilterCollection::AddAudioRenderer(AudioRenderer* filter) { |
41 AddFilter(AUDIO_RENDERER, filter); | 37 AddFilter(AUDIO_RENDERER, filter); |
42 } | 38 } |
43 | 39 |
44 bool FilterCollection::IsEmpty() const { | 40 bool FilterCollection::IsEmpty() const { |
45 return filters_.empty(); | 41 return filters_.empty(); |
46 } | 42 } |
47 | 43 |
48 void FilterCollection::Clear() { | 44 void FilterCollection::Clear() { |
49 filters_.clear(); | 45 filters_.clear(); |
50 } | 46 } |
51 | 47 |
52 void FilterCollection::SelectDemuxer(scoped_refptr<Demuxer>* filter_out) { | |
53 SelectFilter<DEMUXER>(filter_out); | |
54 } | |
55 | |
56 void FilterCollection::SelectVideoDecoder( | 48 void FilterCollection::SelectVideoDecoder( |
57 scoped_refptr<VideoDecoder>* filter_out) { | 49 scoped_refptr<VideoDecoder>* filter_out) { |
58 SelectFilter<VIDEO_DECODER>(filter_out); | 50 SelectFilter<VIDEO_DECODER>(filter_out); |
59 } | 51 } |
60 | 52 |
61 void FilterCollection::SelectAudioDecoder( | 53 void FilterCollection::SelectAudioDecoder( |
62 scoped_refptr<AudioDecoder>* filter_out) { | 54 scoped_refptr<AudioDecoder>* filter_out) { |
63 SelectFilter<AUDIO_DECODER>(filter_out); | 55 SelectFilter<AUDIO_DECODER>(filter_out); |
64 } | 56 } |
65 | 57 |
(...skipping 30 matching lines...) Expand all Loading... |
96 ++it; | 88 ++it; |
97 } | 89 } |
98 | 90 |
99 if (it != filters_.end()) { | 91 if (it != filters_.end()) { |
100 *filter_out = it->second.get(); | 92 *filter_out = it->second.get(); |
101 filters_.erase(it); | 93 filters_.erase(it); |
102 } | 94 } |
103 } | 95 } |
104 | 96 |
105 } // namespace media | 97 } // namespace media |
OLD | NEW |