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 #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 #include "media/base/audio_decoder.h" | 8 #include "media/base/audio_decoder.h" |
9 #include "media/base/audio_renderer.h" | 9 #include "media/base/audio_renderer.h" |
10 #include "media/base/demuxer.h" | 10 #include "media/base/demuxer.h" |
11 #include "media/base/video_decoder.h" | 11 #include "media/base/video_decoder.h" |
12 #include "media/base/video_renderer.h" | 12 #include "media/base/video_renderer.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 FilterCollection::FilterCollection() {} | 16 FilterCollection::FilterCollection() {} |
17 | 17 |
18 FilterCollection::~FilterCollection() {} | 18 FilterCollection::~FilterCollection() {} |
19 | 19 |
20 void FilterCollection::SetDemuxer(const scoped_refptr<Demuxer>& demuxer) { | 20 void FilterCollection::SetDemuxer(const scoped_refptr<Demuxer>& demuxer) { |
21 demuxer_ = demuxer; | 21 demuxer_ = demuxer; |
22 } | 22 } |
23 | 23 |
24 const scoped_refptr<Demuxer>& FilterCollection::GetDemuxer() { | 24 const scoped_refptr<Demuxer>& FilterCollection::GetDemuxer() { |
25 return demuxer_; | 25 return demuxer_; |
26 } | 26 } |
27 | 27 |
28 void FilterCollection::AddAudioDecoder(AudioDecoder* audio_decoder) { | |
29 audio_decoders_.push_back(audio_decoder); | |
30 } | |
31 | |
32 void FilterCollection::AddAudioRenderer(AudioRenderer* audio_renderer) { | 28 void FilterCollection::AddAudioRenderer(AudioRenderer* audio_renderer) { |
33 audio_renderers_.push_back(audio_renderer); | 29 audio_renderers_.push_back(audio_renderer); |
34 } | 30 } |
35 | 31 |
36 void FilterCollection::AddVideoRenderer(VideoRenderer* video_renderer) { | 32 void FilterCollection::AddVideoRenderer(VideoRenderer* video_renderer) { |
37 video_renderers_.push_back(video_renderer); | 33 video_renderers_.push_back(video_renderer); |
38 } | 34 } |
39 | 35 |
40 void FilterCollection::Clear() { | 36 void FilterCollection::Clear() { |
41 audio_decoders_.clear(); | 37 audio_decoders_.clear(); |
42 video_decoders_.clear(); | 38 video_decoders_.clear(); |
43 audio_renderers_.clear(); | 39 audio_renderers_.clear(); |
44 video_renderers_.clear(); | 40 video_renderers_.clear(); |
45 } | 41 } |
46 | 42 |
47 void FilterCollection::SelectAudioDecoder(scoped_refptr<AudioDecoder>* out) { | |
48 if (audio_decoders_.empty()) { | |
49 *out = NULL; | |
50 return; | |
51 } | |
52 *out = audio_decoders_.front(); | |
53 audio_decoders_.pop_front(); | |
54 } | |
55 | |
56 void FilterCollection::SelectAudioRenderer(scoped_refptr<AudioRenderer>* out) { | 43 void FilterCollection::SelectAudioRenderer(scoped_refptr<AudioRenderer>* out) { |
57 if (audio_renderers_.empty()) { | 44 if (audio_renderers_.empty()) { |
58 *out = NULL; | 45 *out = NULL; |
59 return; | 46 return; |
60 } | 47 } |
61 *out = audio_renderers_.front(); | 48 *out = audio_renderers_.front(); |
62 audio_renderers_.pop_front(); | 49 audio_renderers_.pop_front(); |
63 } | 50 } |
64 | 51 |
65 void FilterCollection::SelectVideoRenderer(scoped_refptr<VideoRenderer>* out) { | 52 void FilterCollection::SelectVideoRenderer(scoped_refptr<VideoRenderer>* out) { |
66 if (video_renderers_.empty()) { | 53 if (video_renderers_.empty()) { |
67 *out = NULL; | 54 *out = NULL; |
68 return; | 55 return; |
69 } | 56 } |
70 *out = video_renderers_.front(); | 57 *out = video_renderers_.front(); |
71 video_renderers_.pop_front(); | 58 video_renderers_.pop_front(); |
72 } | 59 } |
73 | 60 |
| 61 FilterCollection::AudioDecoderList* FilterCollection::GetAudioDecoders() { |
| 62 return &audio_decoders_; |
| 63 } |
| 64 |
74 FilterCollection::VideoDecoderList* FilterCollection::GetVideoDecoders() { | 65 FilterCollection::VideoDecoderList* FilterCollection::GetVideoDecoders() { |
75 return &video_decoders_; | 66 return &video_decoders_; |
76 } | 67 } |
77 | 68 |
78 } // namespace media | 69 } // namespace media |
OLD | NEW |