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 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "media/base/android/media_player_listener.h" | 14 #include "media/base/android/media_player_listener.h" |
15 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 #include "ui/gl/android/scoped_java_surface.h" | 17 #include "ui/gl/android/scoped_java_surface.h" |
18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
19 | 19 |
20 namespace media { | 20 namespace media { |
21 | 21 |
22 class BrowserCdm; | 22 class MediaKeys; |
23 class MediaPlayerManager; | 23 class MediaPlayerManager; |
24 | 24 |
25 // This class serves as the base class for different media player | 25 // This class serves as the base class for different media player |
26 // implementations on Android. Subclasses need to provide their own | 26 // implementations on Android. Subclasses need to provide their own |
27 // MediaPlayerAndroid::Create() implementation. | 27 // MediaPlayerAndroid::Create() implementation. |
28 class MEDIA_EXPORT MediaPlayerAndroid { | 28 class MEDIA_EXPORT MediaPlayerAndroid { |
29 public: | 29 public: |
30 virtual ~MediaPlayerAndroid(); | 30 virtual ~MediaPlayerAndroid(); |
31 | 31 |
32 // Error types for MediaErrorCB. | 32 // Error types for MediaErrorCB. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 virtual base::TimeDelta GetCurrentTime() = 0; | 71 virtual base::TimeDelta GetCurrentTime() = 0; |
72 virtual bool IsPlaying() = 0; | 72 virtual bool IsPlaying() = 0; |
73 virtual bool CanPause() = 0; | 73 virtual bool CanPause() = 0; |
74 virtual bool CanSeekForward() = 0; | 74 virtual bool CanSeekForward() = 0; |
75 virtual bool CanSeekBackward() = 0; | 75 virtual bool CanSeekBackward() = 0; |
76 virtual bool IsPlayerReady() = 0; | 76 virtual bool IsPlayerReady() = 0; |
77 virtual GURL GetUrl(); | 77 virtual GURL GetUrl(); |
78 virtual GURL GetFirstPartyForCookies(); | 78 virtual GURL GetFirstPartyForCookies(); |
79 | 79 |
80 // Associates the |cdm| with this player. | 80 // Associates the |cdm| with this player. |
81 virtual void SetCdm(BrowserCdm* cdm); | 81 virtual void SetCdm(const scoped_refptr<MediaKeys>& cdm); |
82 | 82 |
83 // Requests playback permission from MediaPlayerManager. | 83 // Requests playback permission from MediaPlayerManager. |
84 // Overridden in MediaCodecPlayer to pass data between threads. | 84 // Overridden in MediaCodecPlayer to pass data between threads. |
85 virtual void RequestPermissionAndPostResult(base::TimeDelta duration) {} | 85 virtual void RequestPermissionAndPostResult(base::TimeDelta duration) {} |
86 | 86 |
87 // Overridden in MediaCodecPlayer to pass data between threads. | 87 // Overridden in MediaCodecPlayer to pass data between threads. |
88 virtual void OnMediaMetadataChanged(base::TimeDelta duration, | 88 virtual void OnMediaMetadataChanged(base::TimeDelta duration, |
89 const gfx::Size& video_size) {} | 89 const gfx::Size& video_size) {} |
90 | 90 |
91 // Overridden in MediaCodecPlayer to pass data between threads. | 91 // Overridden in MediaCodecPlayer to pass data between threads. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // Weak pointer passed to |listener_| for callbacks. | 150 // Weak pointer passed to |listener_| for callbacks. |
151 // NOTE: Weak pointers must be invalidated before all other member variables. | 151 // NOTE: Weak pointers must be invalidated before all other member variables. |
152 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; | 152 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; |
153 | 153 |
154 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); | 154 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); |
155 }; | 155 }; |
156 | 156 |
157 } // namespace media | 157 } // namespace media |
158 | 158 |
159 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 159 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
OLD | NEW |