| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "webkit/media/crypto/ppapi/cdm/content_decryption_module.h" | 7 #include "webkit/media/crypto/ppapi/cdm/content_decryption_module.h" |
| 8 #include "webkit/media/crypto/ppapi/cdm_video_decoder.h" | 8 #include "webkit/media/crypto/ppapi/cdm_video_decoder.h" |
| 9 | 9 |
| 10 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) | 10 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
| 11 #include "webkit/media/crypto/ppapi/fake_cdm_video_decoder.h" | 11 #include "webkit/media/crypto/ppapi/fake_cdm_video_decoder.h" |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) | 14 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) |
| 15 #include "webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h" | 15 #include "webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 #if defined(CLEAR_KEY_CDM_USE_LIBVPX_DECODER) | 18 #if defined(CLEAR_KEY_CDM_USE_LIBVPX_DECODER) |
| 19 #include "webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.h" | 19 #include "webkit/media/crypto/ppapi/libvpx_cdm_video_decoder.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 namespace webkit_media { | 22 namespace webkit_media { |
| 23 | 23 |
| 24 scoped_ptr<CdmVideoDecoder> CreateVideoDecoder( | 24 scoped_ptr<CdmVideoDecoder> CreateVideoDecoder( |
| 25 cdm::Allocator* allocator, | 25 cdm::Host* host, const cdm::VideoDecoderConfig& config) { |
| 26 const cdm::VideoDecoderConfig& config) { | |
| 27 scoped_ptr<CdmVideoDecoder> video_decoder; | 26 scoped_ptr<CdmVideoDecoder> video_decoder; |
| 28 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) | 27 #if defined(CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER) |
| 29 video_decoder.reset(new FakeCdmVideoDecoder(allocator)); | 28 video_decoder.reset(new FakeCdmVideoDecoder(host)); |
| 30 | 29 |
| 31 if (!video_decoder->Initialize(config)) | 30 if (!video_decoder->Initialize(config)) |
| 32 video_decoder.reset(); | 31 video_decoder.reset(); |
| 33 #else | 32 #else |
| 34 | 33 |
| 35 #if defined(CLEAR_KEY_CDM_USE_LIBVPX_DECODER) | 34 #if defined(CLEAR_KEY_CDM_USE_LIBVPX_DECODER) |
| 36 if (config.codec == cdm::VideoDecoderConfig::kCodecVp8) { | 35 if (config.codec == cdm::VideoDecoderConfig::kCodecVp8) { |
| 37 video_decoder.reset(new LibvpxCdmVideoDecoder(allocator)); | 36 video_decoder.reset(new LibvpxCdmVideoDecoder(host)); |
| 38 | 37 |
| 39 if (!video_decoder->Initialize(config)) | 38 if (!video_decoder->Initialize(config)) |
| 40 video_decoder.reset(); | 39 video_decoder.reset(); |
| 41 | 40 |
| 42 return video_decoder.Pass(); | 41 return video_decoder.Pass(); |
| 43 } | 42 } |
| 44 #endif | 43 #endif |
| 45 | 44 |
| 46 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) | 45 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) |
| 47 video_decoder.reset(new FFmpegCdmVideoDecoder(allocator)); | 46 video_decoder.reset(new FFmpegCdmVideoDecoder(host)); |
| 48 | 47 |
| 49 if (!video_decoder->Initialize(config)) | 48 if (!video_decoder->Initialize(config)) |
| 50 video_decoder.reset(); | 49 video_decoder.reset(); |
| 51 #endif | 50 #endif |
| 52 | 51 |
| 53 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER | 52 #endif // CLEAR_KEY_CDM_USE_FAKE_VIDEO_DECODER |
| 54 | 53 |
| 55 return video_decoder.Pass(); | 54 return video_decoder.Pass(); |
| 56 } | 55 } |
| 57 | 56 |
| 58 } // namespace webkit_media | 57 } // namespace webkit_media |
| OLD | NEW |