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 "webkit/media/filter_helpers.h" | 5 #include "webkit/media/filter_helpers.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "media/base/filter_collection.h" | 8 #include "media/base/filter_collection.h" |
9 #include "media/base/message_loop_factory.h" | 9 #include "media/base/message_loop_factory.h" |
10 #include "media/filters/chunk_demuxer.h" | 10 #include "media/filters/chunk_demuxer.h" |
11 #include "media/filters/dummy_demuxer.h" | 11 #include "media/filters/dummy_demuxer.h" |
12 #include "media/filters/ffmpeg_audio_decoder.h" | 12 #include "media/filters/ffmpeg_audio_decoder.h" |
13 #include "media/filters/ffmpeg_demuxer.h" | 13 #include "media/filters/ffmpeg_demuxer.h" |
14 #include "media/filters/ffmpeg_video_decoder.h" | 14 #include "media/filters/ffmpeg_video_decoder.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
16 #include "webkit/media/media_stream_client.h" | 16 #include "webkit/media/media_stream_client.h" |
17 | 17 |
18 namespace webkit_media { | 18 namespace webkit_media { |
19 | 19 |
20 // Constructs and adds the default audio/video decoders to |filter_collection|. | 20 // Constructs and adds the default audio/video decoders to |filter_collection|. |
21 static void AddDefaultDecodersToCollection( | 21 static void AddDefaultDecodersToCollection( |
22 media::MessageLoopFactory* message_loop_factory, | 22 media::MessageLoopFactory* message_loop_factory, |
23 media::FilterCollection* filter_collection, | 23 media::FilterCollection* filter_collection, |
24 media::Decryptor* decryptor) { | 24 media::Decryptor* decryptor) { |
25 filter_collection->AddAudioDecoder(new media::FFmpegAudioDecoder( | 25 filter_collection->AddAudioDecoder(new media::FFmpegAudioDecoder( |
26 base::Bind(&media::MessageLoopFactory::GetMessageLoop, | 26 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
27 base::Unretained(message_loop_factory), | 27 base::Unretained(message_loop_factory), |
28 "AudioDecoderThread"))); | 28 media::MessageLoopFactory::kAudioDecoder))); |
29 | 29 |
30 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = | 30 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = |
31 new media::FFmpegVideoDecoder( | 31 new media::FFmpegVideoDecoder( |
32 base::Bind(&media::MessageLoopFactory::GetMessageLoop, | 32 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
33 base::Unretained(message_loop_factory), | 33 base::Unretained(message_loop_factory), |
34 "VideoDecoderThread"), | 34 media::MessageLoopFactory::kVideoDecoder), |
35 decryptor); | 35 decryptor); |
36 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); | 36 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); |
37 } | 37 } |
38 | 38 |
39 bool BuildMediaStreamCollection(const WebKit::WebURL& url, | 39 bool BuildMediaStreamCollection(const WebKit::WebURL& url, |
40 MediaStreamClient* client, | 40 MediaStreamClient* client, |
41 media::MessageLoopFactory* message_loop_factory, | 41 media::MessageLoopFactory* message_loop_factory, |
42 media::FilterCollection* filter_collection) { | 42 media::FilterCollection* filter_collection) { |
43 if (!client) | 43 if (!client) |
44 return false; | 44 return false; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 decryptor); | 77 decryptor); |
78 return true; | 78 return true; |
79 } | 79 } |
80 | 80 |
81 void BuildDefaultCollection( | 81 void BuildDefaultCollection( |
82 const scoped_refptr<media::DataSource>& data_source, | 82 const scoped_refptr<media::DataSource>& data_source, |
83 media::MessageLoopFactory* message_loop_factory, | 83 media::MessageLoopFactory* message_loop_factory, |
84 media::FilterCollection* filter_collection, | 84 media::FilterCollection* filter_collection, |
85 media::Decryptor* decryptor) { | 85 media::Decryptor* decryptor) { |
86 filter_collection->SetDemuxer(new media::FFmpegDemuxer( | 86 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
87 message_loop_factory->GetMessageLoop("PipelineThread"), | 87 message_loop_factory->GetMessageLoop( |
| 88 media::MessageLoopFactory::kPipeline), |
88 data_source)); | 89 data_source)); |
89 | 90 |
90 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, | 91 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, |
91 decryptor); | 92 decryptor); |
92 } | 93 } |
93 | 94 |
94 } // webkit_media | 95 } // webkit_media |
OLD | NEW |