Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: webkit/media/filter_helpers.cc

Issue 11198017: Add DecryptingAudioDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« media/filters/decrypting_audio_decoder.h ('K') | « media/media.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_audio_decoder.h"
10 #include "media/filters/decrypting_video_decoder.h" 11 #include "media/filters/decrypting_video_decoder.h"
11 #include "media/filters/chunk_demuxer.h" 12 #include "media/filters/chunk_demuxer.h"
12 #include "media/filters/dummy_demuxer.h" 13 #include "media/filters/dummy_demuxer.h"
13 #include "media/filters/ffmpeg_audio_decoder.h" 14 #include "media/filters/ffmpeg_audio_decoder.h"
14 #include "media/filters/ffmpeg_demuxer.h" 15 #include "media/filters/ffmpeg_demuxer.h"
15 #include "media/filters/ffmpeg_video_decoder.h" 16 #include "media/filters/ffmpeg_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
26 // pipeline. This is done by trying to initialize the decoder with the input 27 // 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, 28 // stream. Some decoder may only accept certain types of streams. For example,
28 // DecryptingVideoDecoder only supports encrypted video stream. 29 // DecryptingVideoDecoder only supports encrypted video stream.
29 static void AddDefaultDecodersToCollection( 30 static void AddDefaultDecodersToCollection(
30 media::MessageLoopFactory* message_loop_factory, 31 media::MessageLoopFactory* message_loop_factory,
31 media::FilterCollection* filter_collection, 32 media::FilterCollection* filter_collection,
32 ProxyDecryptor* proxy_decryptor) { 33 ProxyDecryptor* proxy_decryptor) {
33 scoped_refptr<media::FFmpegAudioDecoder> ffmpeg_audio_decoder = 34 scoped_refptr<media::FFmpegAudioDecoder> ffmpeg_audio_decoder =
34 new media::FFmpegAudioDecoder( 35 new media::FFmpegAudioDecoder(
35 base::Bind(&media::MessageLoopFactory::GetMessageLoop, 36 base::Bind(&media::MessageLoopFactory::GetMessageLoop,
36 base::Unretained(message_loop_factory), 37 base::Unretained(message_loop_factory),
37 media::MessageLoopFactory::kDecoder)); 38 media::MessageLoopFactory::kDecoder));
38 39
40 scoped_refptr<media::DecryptingAudioDecoder> decrypting_audio_decoder =
41 new media::DecryptingAudioDecoder(
42 base::Bind(&media::MessageLoopFactory::GetMessageLoop,
43 base::Unretained(message_loop_factory),
44 media::MessageLoopFactory::kDecoder),
45 base::Bind(&ProxyDecryptor::RequestDecryptorNotification,
46 base::Unretained(proxy_decryptor)));
47
48 filter_collection->GetAudioDecoders()->push_back(ffmpeg_audio_decoder);
49 filter_collection->GetAudioDecoders()->push_back(decrypting_audio_decoder);
scherkus (not reviewing) 2012/10/19 02:12:58 here we have ffmpeg > decrypting for audio, but fo
xhwang 2012/10/19 02:19:45 Nothing happens by chance :) This is intentional.
scherkus (not reviewing) 2012/10/19 02:23:05 ...but FFVD doing decryption is temporary, right?
xhwang 2012/10/19 02:40:35 Yes. But if I move FFVD up now, then decrypt-and-d
scherkus (not reviewing) 2012/10/19 02:51:48 Sounds good to me -- can you TODOify it w/ a comme
xhwang 2012/10/19 07:28:28 Done.
50
39 scoped_refptr<media::DecryptingVideoDecoder> decrypting_video_decoder = 51 scoped_refptr<media::DecryptingVideoDecoder> decrypting_video_decoder =
40 new media::DecryptingVideoDecoder( 52 new media::DecryptingVideoDecoder(
41 base::Bind(&media::MessageLoopFactory::GetMessageLoop, 53 base::Bind(&media::MessageLoopFactory::GetMessageLoop,
42 base::Unretained(message_loop_factory), 54 base::Unretained(message_loop_factory),
43 media::MessageLoopFactory::kDecoder), 55 media::MessageLoopFactory::kDecoder),
44 base::Bind(&ProxyDecryptor::RequestDecryptorNotification, 56 base::Bind(&ProxyDecryptor::RequestDecryptorNotification,
45 base::Unretained(proxy_decryptor))); 57 base::Unretained(proxy_decryptor)));
46 58
47 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder = 59 scoped_refptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder =
48 new media::FFmpegVideoDecoder( 60 new media::FFmpegVideoDecoder(
49 base::Bind(&media::MessageLoopFactory::GetMessageLoop, 61 base::Bind(&media::MessageLoopFactory::GetMessageLoop,
50 base::Unretained(message_loop_factory), 62 base::Unretained(message_loop_factory),
51 media::MessageLoopFactory::kDecoder), 63 media::MessageLoopFactory::kDecoder),
52 proxy_decryptor); 64 proxy_decryptor);
53 65
54 filter_collection->GetAudioDecoders()->push_back(ffmpeg_audio_decoder);
55 filter_collection->GetVideoDecoders()->push_back(decrypting_video_decoder); 66 filter_collection->GetVideoDecoders()->push_back(decrypting_video_decoder);
56 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder); 67 filter_collection->GetVideoDecoders()->push_back(ffmpeg_video_decoder);
57 } 68 }
58 69
59 bool BuildMediaStreamCollection(const WebKit::WebURL& url, 70 bool BuildMediaStreamCollection(const WebKit::WebURL& url,
60 MediaStreamClient* client, 71 MediaStreamClient* client,
61 media::MessageLoopFactory* message_loop_factory, 72 media::MessageLoopFactory* message_loop_factory,
62 media::FilterCollection* filter_collection) { 73 media::FilterCollection* filter_collection) {
63 if (!client) 74 if (!client)
64 return false; 75 return false;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 filter_collection->SetDemuxer(new media::FFmpegDemuxer( 115 filter_collection->SetDemuxer(new media::FFmpegDemuxer(
105 message_loop_factory->GetMessageLoop( 116 message_loop_factory->GetMessageLoop(
106 media::MessageLoopFactory::kPipeline), 117 media::MessageLoopFactory::kPipeline),
107 data_source)); 118 data_source));
108 119
109 AddDefaultDecodersToCollection(message_loop_factory, filter_collection, 120 AddDefaultDecodersToCollection(message_loop_factory, filter_collection,
110 proxy_decryptor); 121 proxy_decryptor);
111 } 122 }
112 123
113 } // webkit_media 124 } // webkit_media
OLDNEW
« media/filters/decrypting_audio_decoder.h ('K') | « media/media.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698