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 #ifndef MEDIA_BASE_BROWSER_CDM_FACTORY_H_ | 5 #ifndef MEDIA_BASE_BROWSER_CDM_FACTORY_H_ |
6 #define MEDIA_BASE_BROWSER_CDM_FACTORY_H_ | 6 #define MEDIA_BASE_BROWSER_CDM_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "media/base/browser_cdm.h" | 12 #include "media/base/browser_cdm.h" |
13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
| 14 #include "media/base/provision_fetcher.h" |
14 | 15 |
15 namespace media { | 16 namespace media { |
16 | 17 |
| 18 class ProvisionFetcher; |
| 19 |
17 class MEDIA_EXPORT BrowserCdmFactory { | 20 class MEDIA_EXPORT BrowserCdmFactory { |
18 public: | 21 public: |
19 BrowserCdmFactory() {} | 22 BrowserCdmFactory() {} |
20 virtual ~BrowserCdmFactory() {} | 23 virtual ~BrowserCdmFactory() {} |
21 | 24 |
22 virtual ScopedBrowserCdmPtr CreateBrowserCdm( | 25 virtual ScopedBrowserCdmPtr CreateBrowserCdm( |
23 const std::string& key_system, | 26 const std::string& key_system, |
24 bool use_hw_secure_codecs, | 27 bool use_hw_secure_codecs, |
| 28 scoped_ptr<ProvisionFetcher> provision_fetcher, |
25 const SessionMessageCB& session_message_cb, | 29 const SessionMessageCB& session_message_cb, |
26 const SessionClosedCB& session_closed_cb, | 30 const SessionClosedCB& session_closed_cb, |
27 const LegacySessionErrorCB& legacy_session_error_cb, | 31 const LegacySessionErrorCB& legacy_session_error_cb, |
28 const SessionKeysChangeCB& session_keys_change_cb, | 32 const SessionKeysChangeCB& session_keys_change_cb, |
29 const SessionExpirationUpdateCB& session_expiration_update_cb) = 0; | 33 const SessionExpirationUpdateCB& session_expiration_update_cb) = 0; |
30 | 34 |
31 private: | 35 private: |
32 DISALLOW_COPY_AND_ASSIGN(BrowserCdmFactory); | 36 DISALLOW_COPY_AND_ASSIGN(BrowserCdmFactory); |
33 }; | 37 }; |
34 | 38 |
35 // Provides a factory for creating BrowserCdm instances. There is only one | 39 // Provides a factory for creating BrowserCdm instances. There is only one |
36 // BrowserCdmFactory per process. | 40 // BrowserCdmFactory per process. |
37 void SetBrowserCdmFactory(BrowserCdmFactory* factory); | 41 void MEDIA_EXPORT SetBrowserCdmFactory(BrowserCdmFactory* factory); |
38 | 42 |
39 // Creates a BrowserCdm for |key_system|. Returns NULL if the CDM cannot be | 43 // Creates a BrowserCdm for |key_system|. Returns NULL if the CDM cannot be |
40 // created. | 44 // created. |
41 // |use_hw_secure_codecs| indicates that the CDM should be configured to use | 45 // |use_hw_secure_codecs| indicates that the CDM should be configured to use |
42 // hardware-secure codecs (for platforms that support it). | 46 // hardware-secure codecs (for platforms that support it). |
| 47 // |render_process_id| is used to get the URL context if the platform requires |
| 48 // HTTP communication for provisioning. |
43 // TODO(xhwang): Add ifdef for IPC based CDM. | 49 // TODO(xhwang): Add ifdef for IPC based CDM. |
44 ScopedBrowserCdmPtr MEDIA_EXPORT | 50 ScopedBrowserCdmPtr MEDIA_EXPORT |
45 CreateBrowserCdm(const std::string& key_system, | 51 CreateBrowserCdm(const std::string& key_system, |
46 bool use_hw_secure_codecs, | 52 bool use_hw_secure_codecs, |
| 53 scoped_ptr<ProvisionFetcher> provision_fetcher, |
47 const SessionMessageCB& session_message_cb, | 54 const SessionMessageCB& session_message_cb, |
48 const SessionClosedCB& session_closed_cb, | 55 const SessionClosedCB& session_closed_cb, |
49 const LegacySessionErrorCB& legacy_session_error_cb, | 56 const LegacySessionErrorCB& legacy_session_error_cb, |
50 const SessionKeysChangeCB& session_keys_change_cb, | 57 const SessionKeysChangeCB& session_keys_change_cb, |
51 const SessionExpirationUpdateCB& session_expiration_update_cb); | 58 const SessionExpirationUpdateCB& session_expiration_update_cb); |
52 | 59 |
53 } // namespace media | 60 } // namespace media |
54 | 61 |
55 #endif // MEDIA_BASE_BROWSER_CDM_FACTORY_H_ | 62 #endif // MEDIA_BASE_BROWSER_CDM_FACTORY_H_ |
OLD | NEW |