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 "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "media/base/filter_collection.h" | 9 #include "media/base/filter_collection.h" |
10 #include "media/base/media_switches.h" | 10 #include "media/base/media_switches.h" |
11 #include "media/filters/decrypting_audio_decoder.h" | 11 #include "media/filters/decrypting_audio_decoder.h" |
12 #include "media/filters/decrypting_video_decoder.h" | 12 #include "media/filters/decrypting_video_decoder.h" |
13 #include "media/filters/chunk_demuxer.h" | 13 #include "media/filters/chunk_demuxer.h" |
14 #include "media/filters/dummy_demuxer.h" | 14 #include "media/filters/dummy_demuxer.h" |
15 #include "media/filters/ffmpeg_audio_decoder.h" | 15 #include "media/filters/ffmpeg_audio_decoder.h" |
16 #include "media/filters/ffmpeg_demuxer.h" | 16 #include "media/filters/ffmpeg_demuxer.h" |
17 #include "media/filters/ffmpeg_video_decoder.h" | 17 #include "media/filters/ffmpeg_video_decoder.h" |
18 #include "media/filters/opus_audio_decoder.h" | 18 #include "media/filters/opus_audio_decoder.h" |
| 19 #include "media/filters/vpx_video_decoder.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
20 #include "webkit/media/crypto/proxy_decryptor.h" | 21 #include "webkit/media/crypto/proxy_decryptor.h" |
21 #include "webkit/media/media_stream_client.h" | 22 #include "webkit/media/media_stream_client.h" |
22 | 23 |
23 namespace webkit_media { | 24 namespace webkit_media { |
24 | 25 |
25 // Constructs and adds the default audio/video decoders to |filter_collection|. | 26 // Constructs and adds the default audio/video decoders to |filter_collection|. |
26 // Note that decoders in the |filter_collection| are ordered. The first | 27 // Note that decoders in the |filter_collection| are ordered. The first |
27 // audio/video decoder in the |filter_collection| that supports the input | 28 // audio/video decoder in the |filter_collection| that supports the input |
28 // audio/video stream will be selected as the audio/video decoder in the media | 29 // audio/video stream will be selected as the audio/video decoder in the media |
29 // pipeline. This is done by trying to initialize the decoder with the input | 30 // pipeline. This is done by trying to initialize the decoder with the input |
30 // stream. Some decoder may only accept certain types of streams. For example, | 31 // stream. Some decoder may only accept certain types of streams. For example, |
31 // DecryptingVideoDecoder only supports encrypted video stream. | 32 // DecryptingVideoDecoder only supports encrypted video stream. |
32 static void AddDefaultDecodersToCollection( | 33 static void AddDefaultDecodersToCollection( |
33 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 34 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
34 media::FilterCollection* filter_collection, | 35 media::FilterCollection* filter_collection, |
35 ProxyDecryptor* proxy_decryptor) { | 36 ProxyDecryptor* proxy_decryptor) { |
36 | 37 |
37 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 38 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
38 if (cmd_line->HasSwitch(switches::kEnableVp9OpusPlayback)) { | 39 if (cmd_line->HasSwitch(switches::kEnableVp9OpusPlayback)) { |
39 scoped_refptr<media::OpusAudioDecoder> opus_audio_decoder = | 40 scoped_refptr<media::OpusAudioDecoder> opus_audio_decoder = |
40 new media::OpusAudioDecoder(message_loop); | 41 new media::OpusAudioDecoder(message_loop); |
41 filter_collection->GetAudioDecoders()->push_back(opus_audio_decoder); | 42 filter_collection->GetAudioDecoders()->push_back(opus_audio_decoder); |
| 43 |
| 44 scoped_refptr<media::VpxVideoDecoder> vpx_video_decoder = |
| 45 new media::VpxVideoDecoder(message_loop); |
| 46 filter_collection->GetVideoDecoders()->push_back(vpx_video_decoder); |
42 } | 47 } |
43 | 48 |
44 scoped_refptr<media::FFmpegAudioDecoder> ffmpeg_audio_decoder = | 49 scoped_refptr<media::FFmpegAudioDecoder> ffmpeg_audio_decoder = |
45 new media::FFmpegAudioDecoder(message_loop); | 50 new media::FFmpegAudioDecoder(message_loop); |
46 filter_collection->GetAudioDecoders()->push_back(ffmpeg_audio_decoder); | 51 filter_collection->GetAudioDecoders()->push_back(ffmpeg_audio_decoder); |
47 | 52 |
48 if (proxy_decryptor) { | 53 if (proxy_decryptor) { |
49 scoped_refptr<media::DecryptingAudioDecoder> decrypting_audio_decoder = | 54 scoped_refptr<media::DecryptingAudioDecoder> decrypting_audio_decoder = |
50 new media::DecryptingAudioDecoder( | 55 new media::DecryptingAudioDecoder( |
51 message_loop, | 56 message_loop, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 media::FilterCollection* filter_collection, | 124 media::FilterCollection* filter_collection, |
120 ProxyDecryptor* proxy_decryptor) { | 125 ProxyDecryptor* proxy_decryptor) { |
121 filter_collection->SetDemuxer(new media::FFmpegDemuxer( | 126 filter_collection->SetDemuxer(new media::FFmpegDemuxer( |
122 message_loop, data_source)); | 127 message_loop, data_source)); |
123 | 128 |
124 AddDefaultDecodersToCollection(message_loop, filter_collection, | 129 AddDefaultDecodersToCollection(message_loop, filter_collection, |
125 proxy_decryptor); | 130 proxy_decryptor); |
126 } | 131 } |
127 | 132 |
128 } // webkit_media | 133 } // webkit_media |
OLD | NEW |