OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/base/browser_cdm_factory.h" | 5 #include "media/base/browser_cdm_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 #if defined(OS_ANDROID) | 9 #if defined(OS_ANDROID) |
10 #include "media/base/android/browser_cdm_factory_android.h" | 10 #include "media/base/android/browser_cdm_factory_android.h" |
11 #endif | 11 #endif |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
15 namespace { | 15 namespace { |
16 BrowserCdmFactory* g_cdm_factory = NULL; | 16 BrowserCdmFactory* g_cdm_factory = NULL; |
17 } | 17 } |
18 | 18 |
19 void SetBrowserCdmFactory(BrowserCdmFactory* factory) { | 19 void SetBrowserCdmFactory(BrowserCdmFactory* factory) { |
20 DCHECK(!g_cdm_factory); | 20 DCHECK(!g_cdm_factory); |
21 g_cdm_factory = factory; | 21 g_cdm_factory = factory; |
22 } | 22 } |
23 | 23 |
24 scoped_ptr<BrowserCdm> CreateBrowserCdm( | 24 BrowserCdmPtr CreateBrowserCdm( |
25 const std::string& key_system, | 25 const std::string& key_system, |
26 bool use_hw_secure_codecs, | 26 bool use_hw_secure_codecs, |
27 const SessionMessageCB& session_message_cb, | 27 const SessionMessageCB& session_message_cb, |
28 const SessionClosedCB& session_closed_cb, | 28 const SessionClosedCB& session_closed_cb, |
29 const LegacySessionErrorCB& legacy_session_error_cb, | 29 const LegacySessionErrorCB& legacy_session_error_cb, |
30 const SessionKeysChangeCB& session_keys_change_cb, | 30 const SessionKeysChangeCB& session_keys_change_cb, |
31 const SessionExpirationUpdateCB& session_expiration_update_cb) { | 31 const SessionExpirationUpdateCB& session_expiration_update_cb) { |
32 if (!g_cdm_factory) { | 32 if (!g_cdm_factory) { |
33 #if defined(OS_ANDROID) | 33 #if defined(OS_ANDROID) |
34 SetBrowserCdmFactory(new BrowserCdmFactoryAndroid); | 34 SetBrowserCdmFactory(new BrowserCdmFactoryAndroid); |
35 #else | 35 #else |
36 LOG(ERROR) << "Cannot create BrowserCdm: no BrowserCdmFactory available!"; | 36 LOG(ERROR) << "Cannot create BrowserCdm: no BrowserCdmFactory available!"; |
37 return scoped_ptr<BrowserCdm>(); | 37 return scoped_ptr<BrowserCdm>(); |
38 #endif | 38 #endif |
39 } | 39 } |
40 | 40 |
41 return g_cdm_factory->CreateBrowserCdm( | 41 return g_cdm_factory->CreateBrowserCdm( |
42 key_system, use_hw_secure_codecs, session_message_cb, session_closed_cb, | 42 key_system, use_hw_secure_codecs, session_message_cb, session_closed_cb, |
43 legacy_session_error_cb, session_keys_change_cb, | 43 legacy_session_error_cb, session_keys_change_cb, |
44 session_expiration_update_cb); | 44 session_expiration_update_cb); |
45 } | 45 } |
46 | 46 |
47 } // namespace media | 47 } // namespace media |
OLD | NEW |