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/crypto/decrypting_video_decoder.h" | |
10 #include "media/filters/chunk_demuxer.h" | 11 #include "media/filters/chunk_demuxer.h" |
11 #include "media/filters/dummy_demuxer.h" | 12 #include "media/filters/dummy_demuxer.h" |
12 #include "media/filters/ffmpeg_audio_decoder.h" | 13 #include "media/filters/ffmpeg_audio_decoder.h" |
13 #include "media/filters/ffmpeg_demuxer.h" | 14 #include "media/filters/ffmpeg_demuxer.h" |
14 #include "media/filters/ffmpeg_video_decoder.h" | 15 #include "media/filters/ffmpeg_video_decoder.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
16 #include "webkit/media/media_stream_client.h" | 17 #include "webkit/media/media_stream_client.h" |
17 | 18 |
18 namespace webkit_media { | 19 namespace webkit_media { |
19 | 20 |
20 // Constructs and adds the default audio/video decoders to |filter_collection|. | 21 // Constructs and adds the default audio/video decoders to |filter_collection|. |
21 static void AddDefaultDecodersToCollection( | 22 static void AddDefaultDecodersToCollection( |
22 media::MessageLoopFactory* message_loop_factory, | 23 media::MessageLoopFactory* message_loop_factory, |
23 media::FilterCollection* filter_collection, | 24 media::FilterCollection* filter_collection, |
24 media::Decryptor* decryptor) { | 25 media::Decryptor* decryptor) { |
25 filter_collection->AddAudioDecoder(new media::FFmpegAudioDecoder( | 26 filter_collection->AddAudioDecoder(new media::FFmpegAudioDecoder( |
26 base::Bind(&media::MessageLoopFactory::GetMessageLoop, | 27 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
27 base::Unretained(message_loop_factory), | 28 base::Unretained(message_loop_factory), |
28 media::MessageLoopFactory::kDecoder))); | 29 media::MessageLoopFactory::kDecoder))); |
29 | 30 |
31 scoped_refptr<media::DecryptingVideoDecoder> decrypting_video_decoder = | |
32 new media::DecryptingVideoDecoder( | |
33 base::Bind(&media::MessageLoopFactory::GetMessageLoop, | |
34 base::Unretained(message_loop_factory), | |
35 media::MessageLoopFactory::kDecoder), | |
36 decryptor); | |
37 | |
30 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = | 38 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = |
31 new media::FFmpegVideoDecoder( | 39 new media::FFmpegVideoDecoder( |
32 base::Bind(&media::MessageLoopFactory::GetMessageLoop, | 40 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
33 base::Unretained(message_loop_factory), | 41 base::Unretained(message_loop_factory), |
34 media::MessageLoopFactory::kDecoder), | 42 media::MessageLoopFactory::kDecoder), |
35 decryptor); | 43 decryptor); |
44 | |
45 filter_collection->GetVideoDecoders()->push_back(decrypting_video_decoder); | |
ddorwin
2012/09/21 00:36:08
Does this order mean we will never decrypt with HW
xhwang
2012/09/25 23:52:32
Not in this CL. Will enable encrypt-only + GVD/FFV
| |
36 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); | 46 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); |
xhwang
2012/09/20 23:26:34
After this change, we have 3 VideoDecoders in the
ddorwin
2012/09/21 00:36:08
It's not obvious here how the correct one will be
xhwang
2012/09/25 23:52:32
Added more comments for AddDecaultDecodersToCollec
| |
37 } | 47 } |
38 | 48 |
39 bool BuildMediaStreamCollection(const WebKit::WebURL& url, | 49 bool BuildMediaStreamCollection(const WebKit::WebURL& url, |
40 MediaStreamClient* client, | 50 MediaStreamClient* client, |
41 media::MessageLoopFactory* message_loop_factory, | 51 media::MessageLoopFactory* message_loop_factory, |
42 media::FilterCollection* filter_collection) { | 52 media::FilterCollection* filter_collection) { |
43 if (!client) | 53 if (!client) |
44 return false; | 54 return false; |
45 | 55 |
46 scoped_refptr<media::VideoDecoder> video_decoder = client->GetVideoDecoder( | 56 scoped_refptr<media::VideoDecoder> video_decoder = client->GetVideoDecoder( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 filter_collection->SetDemuxer(new media::FFmpegDemuxer( | 88 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
79 message_loop_factory->GetMessageLoop( | 89 message_loop_factory->GetMessageLoop( |
80 media::MessageLoopFactory::kPipeline), | 90 media::MessageLoopFactory::kPipeline), |
81 data_source)); | 91 data_source)); |
82 | 92 |
83 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, | 93 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, |
84 decryptor); | 94 decryptor); |
85 } | 95 } |
86 | 96 |
87 } // webkit_media | 97 } // webkit_media |
OLD | NEW |