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/ref_counted.h" |
12 #include "media/base/browser_cdm.h" | |
13 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
| 13 #include "media/base/media_keys.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 | 16 |
| 17 // TODO(xhwang): Merge this with media::CdmFactory. |
17 class MEDIA_EXPORT BrowserCdmFactory { | 18 class MEDIA_EXPORT BrowserCdmFactory { |
18 public: | 19 public: |
19 BrowserCdmFactory() {} | 20 BrowserCdmFactory() {} |
20 virtual ~BrowserCdmFactory() {} | 21 virtual ~BrowserCdmFactory() {} |
21 | 22 |
22 virtual ScopedBrowserCdmPtr CreateBrowserCdm( | 23 virtual scoped_refptr<MediaKeys> CreateBrowserCdm( |
23 const std::string& key_system, | 24 const std::string& key_system, |
24 bool use_hw_secure_codecs, | 25 bool use_hw_secure_codecs, |
25 const SessionMessageCB& session_message_cb, | 26 const SessionMessageCB& session_message_cb, |
26 const SessionClosedCB& session_closed_cb, | 27 const SessionClosedCB& session_closed_cb, |
27 const LegacySessionErrorCB& legacy_session_error_cb, | 28 const LegacySessionErrorCB& legacy_session_error_cb, |
28 const SessionKeysChangeCB& session_keys_change_cb, | 29 const SessionKeysChangeCB& session_keys_change_cb, |
29 const SessionExpirationUpdateCB& session_expiration_update_cb) = 0; | 30 const SessionExpirationUpdateCB& session_expiration_update_cb) = 0; |
30 | 31 |
31 private: | 32 private: |
32 DISALLOW_COPY_AND_ASSIGN(BrowserCdmFactory); | 33 DISALLOW_COPY_AND_ASSIGN(BrowserCdmFactory); |
33 }; | 34 }; |
34 | 35 |
35 // Provides a factory for creating BrowserCdm instances. There is only one | 36 // Provides a factory for creating BrowserCdm instances. There is only one |
36 // BrowserCdmFactory per process. | 37 // BrowserCdmFactory per process. |
37 void SetBrowserCdmFactory(BrowserCdmFactory* factory); | 38 void SetBrowserCdmFactory(BrowserCdmFactory* factory); |
38 | 39 |
39 // Creates a BrowserCdm for |key_system|. Returns NULL if the CDM cannot be | 40 // Creates a MediaKeys for |key_system|. Returns NULL if the CDM cannot be |
40 // created. | 41 // created. |
41 // |use_hw_secure_codecs| indicates that the CDM should be configured to use | 42 // |use_hw_secure_codecs| indicates that the CDM should be configured to use |
42 // hardware-secure codecs (for platforms that support it). | 43 // hardware-secure codecs (for platforms that support it). |
43 // TODO(xhwang): Add ifdef for IPC based CDM. | 44 // TODO(xhwang): Add ifdef for IPC based CDM. |
44 ScopedBrowserCdmPtr MEDIA_EXPORT | 45 scoped_refptr<MediaKeys> MEDIA_EXPORT |
45 CreateBrowserCdm(const std::string& key_system, | 46 CreateBrowserCdm(const std::string& key_system, |
46 bool use_hw_secure_codecs, | 47 bool use_hw_secure_codecs, |
47 const SessionMessageCB& session_message_cb, | 48 const SessionMessageCB& session_message_cb, |
48 const SessionClosedCB& session_closed_cb, | 49 const SessionClosedCB& session_closed_cb, |
49 const LegacySessionErrorCB& legacy_session_error_cb, | 50 const LegacySessionErrorCB& legacy_session_error_cb, |
50 const SessionKeysChangeCB& session_keys_change_cb, | 51 const SessionKeysChangeCB& session_keys_change_cb, |
51 const SessionExpirationUpdateCB& session_expiration_update_cb); | 52 const SessionExpirationUpdateCB& session_expiration_update_cb); |
52 | 53 |
53 } // namespace media | 54 } // namespace media |
54 | 55 |
55 #endif // MEDIA_BASE_BROWSER_CDM_FACTORY_H_ | 56 #endif // MEDIA_BASE_BROWSER_CDM_FACTORY_H_ |
OLD | NEW |