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

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

Issue 9700006: Move VideoDecoder out of media pipeline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « media/base/filter_collection.h ('k') | media/base/filters.h » ('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) 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 9
10 namespace media { 10 namespace media {
11 11
12 FilterCollection::FilterCollection() {} 12 FilterCollection::FilterCollection() {}
13 13
14 FilterCollection::~FilterCollection() {} 14 FilterCollection::~FilterCollection() {}
15 15
16 void FilterCollection::SetDemuxerFactory(scoped_ptr<DemuxerFactory> factory) { 16 void FilterCollection::SetDemuxerFactory(scoped_ptr<DemuxerFactory> factory) {
17 DCHECK(factory.get()); 17 DCHECK(factory.get());
18 demuxer_factory_ = factory.Pass(); 18 demuxer_factory_ = factory.Pass();
19 } 19 }
20 20
21 DemuxerFactory* FilterCollection::GetDemuxerFactory() { 21 DemuxerFactory* FilterCollection::GetDemuxerFactory() {
22 return demuxer_factory_.get(); 22 return demuxer_factory_.get();
23 } 23 }
24 24
25 void FilterCollection::AddVideoDecoder(VideoDecoder* filter) {
26 AddFilter(VIDEO_DECODER, filter);
27 }
28
29 void FilterCollection::AddAudioDecoder(AudioDecoder* audio_decoder) { 25 void FilterCollection::AddAudioDecoder(AudioDecoder* audio_decoder) {
30 audio_decoders_.push_back(audio_decoder); 26 audio_decoders_.push_back(audio_decoder);
31 } 27 }
32 28
33 void FilterCollection::AddVideoRenderer(VideoRenderer* filter) { 29 void FilterCollection::AddVideoDecoder(VideoDecoder* video_decoder) {
34 AddFilter(VIDEO_RENDERER, filter); 30 video_decoders_.push_back(video_decoder);
35 } 31 }
36 32
37 void FilterCollection::AddAudioRenderer(AudioRenderer* filter) { 33 void FilterCollection::AddAudioRenderer(AudioRenderer* filter) {
38 AddFilter(AUDIO_RENDERER, filter); 34 AddFilter(AUDIO_RENDERER, filter);
39 } 35 }
40 36
37 void FilterCollection::AddVideoRenderer(VideoRenderer* filter) {
38 AddFilter(VIDEO_RENDERER, filter);
39 }
40
41 bool FilterCollection::IsEmpty() const { 41 bool FilterCollection::IsEmpty() const {
42 return filters_.empty() && audio_decoders_.empty(); 42 return filters_.empty() && audio_decoders_.empty() && video_decoders_.empty();
43 } 43 }
44 44
45 void FilterCollection::Clear() { 45 void FilterCollection::Clear() {
46 filters_.clear(); 46 filters_.clear();
47 audio_decoders_.clear(); 47 audio_decoders_.clear();
48 } 48 }
49 49
50 void FilterCollection::SelectVideoDecoder(
51 scoped_refptr<VideoDecoder>* filter_out) {
52 SelectFilter<VIDEO_DECODER>(filter_out);
53 }
54
55 void FilterCollection::SelectAudioDecoder(scoped_refptr<AudioDecoder>* out) { 50 void FilterCollection::SelectAudioDecoder(scoped_refptr<AudioDecoder>* out) {
56 if (audio_decoders_.empty()) { 51 if (audio_decoders_.empty()) {
57 *out = NULL; 52 *out = NULL;
58 return; 53 return;
59 } 54 }
60 *out = audio_decoders_.front(); 55 *out = audio_decoders_.front();
61 audio_decoders_.pop_front(); 56 audio_decoders_.pop_front();
62 } 57 }
63 58
64 void FilterCollection::SelectVideoRenderer( 59 void FilterCollection::SelectVideoDecoder(scoped_refptr<VideoDecoder>* out) {
65 scoped_refptr<VideoRenderer>* filter_out) { 60 if (video_decoders_.empty()) {
66 SelectFilter<VIDEO_RENDERER>(filter_out); 61 *out = NULL;
62 return;
63 }
64 *out = video_decoders_.front();
65 video_decoders_.pop_front();
67 } 66 }
68 67
69 void FilterCollection::SelectAudioRenderer( 68 void FilterCollection::SelectAudioRenderer(
70 scoped_refptr<AudioRenderer>* filter_out) { 69 scoped_refptr<AudioRenderer>* filter_out) {
71 SelectFilter<AUDIO_RENDERER>(filter_out); 70 SelectFilter<AUDIO_RENDERER>(filter_out);
72 } 71 }
73 72
73 void FilterCollection::SelectVideoRenderer(
74 scoped_refptr<VideoRenderer>* filter_out) {
75 SelectFilter<VIDEO_RENDERER>(filter_out);
76 }
77
74 void FilterCollection::AddFilter(FilterType filter_type, 78 void FilterCollection::AddFilter(FilterType filter_type,
75 Filter* filter) { 79 Filter* filter) {
76 filters_.push_back(FilterListElement(filter_type, filter)); 80 filters_.push_back(FilterListElement(filter_type, filter));
77 } 81 }
78 82
79 template<FilterCollection::FilterType filter_type, typename F> 83 template<FilterCollection::FilterType filter_type, typename F>
80 void FilterCollection::SelectFilter(scoped_refptr<F>* filter_out) { 84 void FilterCollection::SelectFilter(scoped_refptr<F>* filter_out) {
81 scoped_refptr<Filter> filter; 85 scoped_refptr<Filter> filter;
82 SelectFilter(filter_type, &filter); 86 SelectFilter(filter_type, &filter);
83 *filter_out = reinterpret_cast<F*>(filter.get()); 87 *filter_out = reinterpret_cast<F*>(filter.get());
(...skipping 10 matching lines...) Expand all
94 ++it; 98 ++it;
95 } 99 }
96 100
97 if (it != filters_.end()) { 101 if (it != filters_.end()) {
98 *filter_out = it->second.get(); 102 *filter_out = it->second.get();
99 filters_.erase(it); 103 filters_.erase(it);
100 } 104 }
101 } 105 }
102 106
103 } // namespace media 107 } // namespace media
OLDNEW
« no previous file with comments | « media/base/filter_collection.h ('k') | media/base/filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698