| 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/decrypting_video_decoder.h" | 10 #include "media/filters/decrypting_video_decoder.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // Note that decoders in the |filter_collection| are ordered. The first | 23 // Note that decoders in the |filter_collection| are ordered. The first |
| 24 // audio/video decoder in the |filter_collection| that supports the input | 24 // audio/video decoder in the |filter_collection| that supports the input |
| 25 // audio/video stream will be selected as the audio/video decoder in the media | 25 // audio/video stream will be selected as the audio/video decoder in the media |
| 26 // pipeline. This is done by trying to initialize the decoder with the input | 26 // pipeline. This is done by trying to initialize the decoder with the input |
| 27 // stream. Some decoder may only accept certain types of streams. For example, | 27 // stream. Some decoder may only accept certain types of streams. For example, |
| 28 // DecryptingVideoDecoder only supports encrypted video stream. | 28 // DecryptingVideoDecoder only supports encrypted video stream. |
| 29 static void AddDefaultDecodersToCollection( | 29 static void AddDefaultDecodersToCollection( |
| 30 media::MessageLoopFactory* message_loop_factory, | 30 media::MessageLoopFactory* message_loop_factory, |
| 31 media::FilterCollection* filter_collection, | 31 media::FilterCollection* filter_collection, |
| 32 ProxyDecryptor* proxy_decryptor) { | 32 ProxyDecryptor* proxy_decryptor) { |
| 33 filter_collection->AddAudioDecoder(new media::FFmpegAudioDecoder( | 33 scoped_refptr<media::FFmpegAudioDecoder> ffmpeg_audio_decoder = |
| 34 base::Bind(&media::MessageLoopFactory::GetMessageLoop, | 34 new media::FFmpegAudioDecoder( |
| 35 base::Unretained(message_loop_factory), | 35 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
| 36 media::MessageLoopFactory::kDecoder))); | 36 base::Unretained(message_loop_factory), |
| 37 media::MessageLoopFactory::kDecoder)); |
| 37 | 38 |
| 38 scoped_refptr<media::DecryptingVideoDecoder> decrypting_video_decoder = | 39 scoped_refptr<media::DecryptingVideoDecoder> decrypting_video_decoder = |
| 39 new media::DecryptingVideoDecoder( | 40 new media::DecryptingVideoDecoder( |
| 40 base::Bind(&media::MessageLoopFactory::GetMessageLoop, | 41 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
| 41 base::Unretained(message_loop_factory), | 42 base::Unretained(message_loop_factory), |
| 42 media::MessageLoopFactory::kDecoder), | 43 media::MessageLoopFactory::kDecoder), |
| 43 base::Bind(&ProxyDecryptor::RequestDecryptorNotification, | 44 base::Bind(&ProxyDecryptor::RequestDecryptorNotification, |
| 44 base::Unretained(proxy_decryptor))); | 45 base::Unretained(proxy_decryptor))); |
| 45 | 46 |
| 46 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = | 47 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = |
| 47 new media::FFmpegVideoDecoder( | 48 new media::FFmpegVideoDecoder( |
| 48 base::Bind(&media::MessageLoopFactory::GetMessageLoop, | 49 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
| 49 base::Unretained(message_loop_factory), | 50 base::Unretained(message_loop_factory), |
| 50 media::MessageLoopFactory::kDecoder), | 51 media::MessageLoopFactory::kDecoder), |
| 51 proxy_decryptor); | 52 proxy_decryptor); |
| 52 | 53 |
| 54 filter_collection->GetAudioDecoders()->push_back(ffmpeg_audio_decoder); |
| 53 filter_collection->GetVideoDecoders()->push_back(decrypting_video_decoder); | 55 filter_collection->GetVideoDecoders()->push_back(decrypting_video_decoder); |
| 54 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); | 56 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); |
| 55 } | 57 } |
| 56 | 58 |
| 57 bool BuildMediaStreamCollection(const WebKit::WebURL& url, | 59 bool BuildMediaStreamCollection(const WebKit::WebURL& url, |
| 58 MediaStreamClient* client, | 60 MediaStreamClient* client, |
| 59 media::MessageLoopFactory* message_loop_factory, | 61 media::MessageLoopFactory* message_loop_factory, |
| 60 media::FilterCollection* filter_collection) { | 62 media::FilterCollection* filter_collection) { |
| 61 if (!client) | 63 if (!client) |
| 62 return false; | 64 return false; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 filter_collection->SetDemuxer(new media::FFmpegDemuxer( | 104 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
| 103 message_loop_factory->GetMessageLoop( | 105 message_loop_factory->GetMessageLoop( |
| 104 media::MessageLoopFactory::kPipeline), | 106 media::MessageLoopFactory::kPipeline), |
| 105 data_source)); | 107 data_source)); |
| 106 | 108 |
| 107 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, | 109 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, |
| 108 proxy_decryptor); | 110 proxy_decryptor); |
| 109 } | 111 } |
| 110 | 112 |
| 111 } // webkit_media | 113 } // webkit_media |
| OLD | NEW |