| 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/filters/decrypting_audio_decoder.h" | 9 #include "media/filters/decrypting_audio_decoder.h" |
| 10 #include "media/filters/decrypting_video_decoder.h" | 10 #include "media/filters/decrypting_video_decoder.h" |
| 11 #include "media/filters/chunk_demuxer.h" | 11 #include "media/filters/chunk_demuxer.h" |
| 12 #include "media/filters/dummy_demuxer.h" | 12 #include "media/filters/dummy_demuxer.h" |
| 13 #include "media/filters/ffmpeg_audio_decoder.h" | 13 #include "media/filters/ffmpeg_audio_decoder.h" |
| 14 #include "media/filters/ffmpeg_demuxer.h" | 14 #include "media/filters/ffmpeg_demuxer.h" |
| 15 #include "media/filters/ffmpeg_video_decoder.h" | 15 #include "media/filters/ffmpeg_video_decoder.h" |
| 16 #include "media/filters/libvpx_video_decoder.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
| 17 #include "webkit/media/crypto/proxy_decryptor.h" | 18 #include "webkit/media/crypto/proxy_decryptor.h" |
| 18 #include "webkit/media/media_stream_client.h" | 19 #include "webkit/media/media_stream_client.h" |
| 19 | 20 |
| 20 namespace webkit_media { | 21 namespace webkit_media { |
| 21 | 22 |
| 22 // Constructs and adds the default audio/video decoders to |filter_collection|. | 23 // Constructs and adds the default audio/video decoders to |filter_collection|. |
| 23 // Note that decoders in the |filter_collection| are ordered. The first | 24 // Note that decoders in the |filter_collection| are ordered. The first |
| 24 // audio/video decoder in the |filter_collection| that supports the input | 25 // 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 | 26 // audio/video stream will be selected as the audio/video decoder in the media |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 base::Unretained(proxy_decryptor))); | 50 base::Unretained(proxy_decryptor))); |
| 50 // TODO(xhwang): Ideally we should have decrypting video decoder after | 51 // TODO(xhwang): Ideally we should have decrypting video decoder after |
| 51 // regular video decoder since in the real world most videos are not | 52 // regular video decoder since in the real world most videos are not |
| 52 // encrypted. For now FFmpegVideoDecoder can also do decryption | 53 // encrypted. For now FFmpegVideoDecoder can also do decryption |
| 53 // (decrypt-only), and we perfer DecryptingVideoDecoder (decrypt-and-decode) | 54 // (decrypt-only), and we perfer DecryptingVideoDecoder (decrypt-and-decode) |
| 54 // to FFmpegVideoDecoder. Fix this order when we move decryption out of | 55 // to FFmpegVideoDecoder. Fix this order when we move decryption out of |
| 55 // FFmpegVideoDecoder. | 56 // FFmpegVideoDecoder. |
| 56 filter_collection->GetVideoDecoders()->push_back(decrypting_video_decoder); | 57 filter_collection->GetVideoDecoders()->push_back(decrypting_video_decoder); |
| 57 } | 58 } |
| 58 | 59 |
| 60 scoped_refptr<media::LibvpxVideoDecoder> libvpx_video_decoder = |
| 61 new media::LibvpxVideoDecoder(message_loop); |
| 62 filter_collection->GetVideoDecoders()->push_back(libvpx_video_decoder); |
| 63 |
| 59 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = | 64 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = |
| 60 new media::FFmpegVideoDecoder(message_loop, proxy_decryptor); | 65 new media::FFmpegVideoDecoder(message_loop, proxy_decryptor); |
| 61 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); | 66 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); |
| 62 } | 67 } |
| 63 | 68 |
| 64 bool BuildMediaStreamCollection( | 69 bool BuildMediaStreamCollection( |
| 65 const WebKit::WebURL& url, | 70 const WebKit::WebURL& url, |
| 66 MediaStreamClient* client, | 71 MediaStreamClient* client, |
| 67 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 72 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 68 media::FilterCollection* filter_collection) { | 73 media::FilterCollection* filter_collection) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 media::FilterCollection* filter_collection, | 113 media::FilterCollection* filter_collection, |
| 109 ProxyDecryptor* proxy_decryptor) { | 114 ProxyDecryptor* proxy_decryptor) { |
| 110 filter_collection->SetDemuxer(new media::FFmpegDemuxer( | 115 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
| 111 message_loop, data_source)); | 116 message_loop, data_source)); |
| 112 | 117 |
| 113 AddDefaultDecodersToCollection(message_loop, filter_collection, | 118 AddDefaultDecodersToCollection(message_loop, filter_collection, |
| 114 proxy_decryptor); | 119 proxy_decryptor); |
| 115 } | 120 } |
| 116 | 121 |
| 117 } // webkit_media | 122 } // webkit_media |
| OLD | NEW |