| 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 "media/base/filter_collection.h" | 8 #include "media/base/filter_collection.h" |
| 8 #include "media/base/message_loop_factory.h" | 9 #include "media/base/message_loop_factory.h" |
| 9 #include "media/filters/chunk_demuxer_factory.h" | 10 #include "media/filters/chunk_demuxer_factory.h" |
| 10 #include "media/filters/dummy_demuxer_factory.h" | 11 #include "media/filters/dummy_demuxer_factory.h" |
| 11 #include "media/filters/ffmpeg_audio_decoder.h" | 12 #include "media/filters/ffmpeg_audio_decoder.h" |
| 12 #include "media/filters/ffmpeg_demuxer_factory.h" | 13 #include "media/filters/ffmpeg_demuxer_factory.h" |
| 13 #include "media/filters/ffmpeg_video_decoder.h" | 14 #include "media/filters/ffmpeg_video_decoder.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
| 15 #include "webkit/media/media_stream_client.h" | 16 #include "webkit/media/media_stream_client.h" |
| 16 | 17 |
| 17 namespace webkit_media { | 18 namespace webkit_media { |
| 18 | 19 |
| 19 // Constructs and adds the default audio/video decoders to |filter_collection|. | 20 // Constructs and adds the default audio/video decoders to |filter_collection|. |
| 20 static void AddDefaultDecodersToCollection( | 21 static void AddDefaultDecodersToCollection( |
| 21 media::MessageLoopFactory* message_loop_factory, | 22 media::MessageLoopFactory* message_loop_factory, |
| 22 media::FilterCollection* filter_collection) { | 23 media::FilterCollection* filter_collection) { |
| 23 filter_collection->AddAudioDecoder(new media::FFmpegAudioDecoder( | 24 filter_collection->AddAudioDecoder(new media::FFmpegAudioDecoder( |
| 24 message_loop_factory->GetMessageLoop("AudioDecoderThread"))); | 25 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
| 26 base::Unretained(message_loop_factory), |
| 27 "AudioDecoderThread"))); |
| 25 filter_collection->AddVideoDecoder(new media::FFmpegVideoDecoder( | 28 filter_collection->AddVideoDecoder(new media::FFmpegVideoDecoder( |
| 26 message_loop_factory->GetMessageLoop("VideoDecoderThread"))); | 29 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
| 30 base::Unretained(message_loop_factory), |
| 31 "VideoDecoderThread"))); |
| 27 } | 32 } |
| 28 | 33 |
| 29 bool BuildMediaStreamCollection(const WebKit::WebURL& url, | 34 bool BuildMediaStreamCollection(const WebKit::WebURL& url, |
| 30 MediaStreamClient* client, | 35 MediaStreamClient* client, |
| 31 media::MessageLoopFactory* message_loop_factory, | 36 media::MessageLoopFactory* message_loop_factory, |
| 32 media::FilterCollection* filter_collection) { | 37 media::FilterCollection* filter_collection) { |
| 33 if (!client) | 38 if (!client) |
| 34 return false; | 39 return false; |
| 35 | 40 |
| 36 // Remove any "traditional" decoders (e.g. GpuVideoDecoder) from the | 41 // Remove any "traditional" decoders (e.g. GpuVideoDecoder) from the |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 media::FilterCollection* filter_collection) { | 86 media::FilterCollection* filter_collection) { |
| 82 scoped_ptr<media::DemuxerFactory> demuxer_factory( | 87 scoped_ptr<media::DemuxerFactory> demuxer_factory( |
| 83 new media::FFmpegDemuxerFactory( | 88 new media::FFmpegDemuxerFactory( |
| 84 data_source, message_loop_factory->GetMessageLoop("PipelineThread"))); | 89 data_source, message_loop_factory->GetMessageLoop("PipelineThread"))); |
| 85 filter_collection->SetDemuxerFactory(demuxer_factory.Pass()); | 90 filter_collection->SetDemuxerFactory(demuxer_factory.Pass()); |
| 86 | 91 |
| 87 AddDefaultDecodersToCollection(message_loop_factory, filter_collection); | 92 AddDefaultDecodersToCollection(message_loop_factory, filter_collection); |
| 88 } | 93 } |
| 89 | 94 |
| 90 } // webkit_media | 95 } // webkit_media |
| OLD | NEW |