| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ANDROID_MEDIA_DRM_BRIDGE_CDM_CONTEXT_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_CDM_CONTEXT_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_CDM_CONTEXT_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_CDM_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/callback.h" | 13 #include "base/callback.h" |
| 12 #include "base/macros.h" | 14 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "media/base/cdm_context.h" | 15 #include "media/base/cdm_context.h" |
| 15 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
| 16 #include "media/base/player_tracker.h" | 17 #include "media/base/player_tracker.h" |
| 17 | 18 |
| 18 namespace media { | 19 namespace media { |
| 19 | 20 |
| 20 class MediaDrmBridge; | 21 class MediaDrmBridge; |
| 21 | 22 |
| 22 // The CdmContext implementation for MediaDrmBridge. MediaDrmBridge supports | 23 // The CdmContext implementation for MediaDrmBridge. MediaDrmBridge supports |
| 23 // neither Decryptor nor CDM ID, but uses MediaCrypto to connect to MediaCodec. | 24 // neither Decryptor nor CDM ID, but uses MediaCrypto to connect to MediaCodec. |
| 24 // MediaCodec-based decoders should cast the given CdmContext to this class to | 25 // MediaCodec-based decoders should cast the given CdmContext to this class to |
| 25 // access APIs defined in this class. | 26 // access APIs defined in this class. |
| 26 // | 27 // |
| 27 // Methods can be called on any thread. The registered callbacks will be fired | 28 // Methods can be called on any thread. The registered callbacks will be fired |
| 28 // on the thread |media_drm_bridge_| is running on. The caller should make sure | 29 // on the thread |media_drm_bridge_| is running on. The caller should make sure |
| 29 // that the callbacks are posted to the correct thread. | 30 // that the callbacks are posted to the correct thread. |
| 30 // | 31 // |
| 31 // TODO(xhwang): Remove PlayerTracker interface. | 32 // TODO(xhwang): Remove PlayerTracker interface. |
| 32 class MEDIA_EXPORT MediaDrmBridgeCdmContext : public CdmContext, | 33 class MEDIA_EXPORT MediaDrmBridgeCdmContext : public CdmContext, |
| 33 public PlayerTracker { | 34 public PlayerTracker { |
| 34 public: | 35 public: |
| 35 using JavaObjectPtr = scoped_ptr<base::android::ScopedJavaGlobalRef<jobject>>; | 36 using JavaObjectPtr = |
| 37 std::unique_ptr<base::android::ScopedJavaGlobalRef<jobject>>; |
| 36 | 38 |
| 37 // Notification called when MediaCrypto object is ready. | 39 // Notification called when MediaCrypto object is ready. |
| 38 // Parameters: | 40 // Parameters: |
| 39 // |media_crypto| - reference to MediaCrypto object | 41 // |media_crypto| - reference to MediaCrypto object |
| 40 // |needs_protected_surface| - true if protected surface is required | 42 // |needs_protected_surface| - true if protected surface is required |
| 41 using MediaCryptoReadyCB = base::Callback<void(JavaObjectPtr media_crypto, | 43 using MediaCryptoReadyCB = base::Callback<void(JavaObjectPtr media_crypto, |
| 42 bool needs_protected_surface)>; | 44 bool needs_protected_surface)>; |
| 43 | 45 |
| 44 // The |media_drm_bridge| owns |this| and is guaranteed to outlive |this|. | 46 // The |media_drm_bridge| owns |this| and is guaranteed to outlive |this|. |
| 45 explicit MediaDrmBridgeCdmContext(MediaDrmBridge* media_drm_bridge); | 47 explicit MediaDrmBridgeCdmContext(MediaDrmBridge* media_drm_bridge); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 65 | 67 |
| 66 private: | 68 private: |
| 67 MediaDrmBridge* const media_drm_bridge_; | 69 MediaDrmBridge* const media_drm_bridge_; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridgeCdmContext); | 71 DISALLOW_COPY_AND_ASSIGN(MediaDrmBridgeCdmContext); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 } // namespace media | 74 } // namespace media |
| 73 | 75 |
| 74 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_CDM_CONTEXT_H_ | 76 #endif // MEDIA_BASE_ANDROID_MEDIA_DRM_BRIDGE_CDM_CONTEXT_H_ |
| OLD | NEW |