| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_PLAYER_ANDROID_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "media/base/android/media_player_listener.h" | 18 #include "media/base/android/media_player_listener.h" |
| 19 #include "media/base/media_export.h" | 19 #include "media/base/media_export.h" |
| 20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 21 #include "ui/gl/android/scoped_java_surface.h" | 21 #include "ui/gl/android/scoped_java_surface.h" |
| 22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 23 | 23 |
| 24 namespace media { | 24 namespace media { |
| 25 | 25 |
| 26 class MediaKeys; | 26 class ContentDecryptionModule; |
| 27 class MediaPlayerManager; | 27 class MediaPlayerManager; |
| 28 | 28 |
| 29 // This class serves as the base class for different media player | 29 // This class serves as the base class for different media player |
| 30 // implementations on Android. Subclasses need to provide their own | 30 // implementations on Android. Subclasses need to provide their own |
| 31 // MediaPlayerAndroid::Create() implementation. | 31 // MediaPlayerAndroid::Create() implementation. |
| 32 class MEDIA_EXPORT MediaPlayerAndroid { | 32 class MEDIA_EXPORT MediaPlayerAndroid { |
| 33 public: | 33 public: |
| 34 virtual ~MediaPlayerAndroid(); | 34 virtual ~MediaPlayerAndroid(); |
| 35 | 35 |
| 36 // Error types for MediaErrorCB. | 36 // Error types for MediaErrorCB. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 virtual base::TimeDelta GetCurrentTime() = 0; | 85 virtual base::TimeDelta GetCurrentTime() = 0; |
| 86 virtual bool IsPlaying() = 0; | 86 virtual bool IsPlaying() = 0; |
| 87 virtual bool CanPause() = 0; | 87 virtual bool CanPause() = 0; |
| 88 virtual bool CanSeekForward() = 0; | 88 virtual bool CanSeekForward() = 0; |
| 89 virtual bool CanSeekBackward() = 0; | 89 virtual bool CanSeekBackward() = 0; |
| 90 virtual bool IsPlayerReady() = 0; | 90 virtual bool IsPlayerReady() = 0; |
| 91 virtual GURL GetUrl(); | 91 virtual GURL GetUrl(); |
| 92 virtual GURL GetFirstPartyForCookies(); | 92 virtual GURL GetFirstPartyForCookies(); |
| 93 | 93 |
| 94 // Associates the |cdm| with this player. | 94 // Associates the |cdm| with this player. |
| 95 virtual void SetCdm(const scoped_refptr<MediaKeys>& cdm); | 95 virtual void SetCdm(const scoped_refptr<ContentDecryptionModule>& cdm); |
| 96 | 96 |
| 97 // Requests playback permission from MediaPlayerManager. | 97 // Requests playback permission from MediaPlayerManager. |
| 98 // Overridden in MediaCodecPlayer to pass data between threads. | 98 // Overridden in MediaCodecPlayer to pass data between threads. |
| 99 virtual void RequestPermissionAndPostResult(base::TimeDelta duration, | 99 virtual void RequestPermissionAndPostResult(base::TimeDelta duration, |
| 100 bool has_audio) {} | 100 bool has_audio) {} |
| 101 | 101 |
| 102 // Overridden in MediaCodecPlayer to pass data between threads. | 102 // Overridden in MediaCodecPlayer to pass data between threads. |
| 103 virtual void OnMediaMetadataChanged(base::TimeDelta duration, | 103 virtual void OnMediaMetadataChanged(base::TimeDelta duration, |
| 104 const gfx::Size& video_size) {} | 104 const gfx::Size& video_size) {} |
| 105 | 105 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // Weak pointer passed to |listener_| for callbacks. | 179 // Weak pointer passed to |listener_| for callbacks. |
| 180 // NOTE: Weak pointers must be invalidated before all other member variables. | 180 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 181 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; | 181 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; |
| 182 | 182 |
| 183 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); | 183 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 } // namespace media | 186 } // namespace media |
| 187 | 187 |
| 188 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 188 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
| OLD | NEW |