Chromium Code Reviews| 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 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 | 36 |
| 37 // Callback when the player needs decoding resources. | 37 // Callback when the player needs decoding resources. |
| 38 typedef base::Callback<void(int player_id)> RequestMediaResourcesCB; | 38 typedef base::Callback<void(int player_id)> RequestMediaResourcesCB; |
| 39 | 39 |
| 40 // Callback when the player releases decoding resources. | 40 // Callback when the player releases decoding resources. |
| 41 typedef base::Callback<void(int player_id)> ReleaseMediaResourcesCB; | 41 typedef base::Callback<void(int player_id)> ReleaseMediaResourcesCB; |
| 42 | 42 |
| 43 // Passing an external java surface object to the player. | 43 // Passing an external java surface object to the player. |
| 44 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) = 0; | 44 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) = 0; |
| 45 | 45 |
| 46 // Sets the url of the frame that contains this player. | |
| 47 virtual void SetFrameUrl(const GURL& frame_url); | |
|
qinmin
2014/06/02 17:19:21
no need to be virtual, and for simple setter and g
May
2014/06/04 14:05:08
Done.
| |
| 48 | |
| 46 // Start playing the media. | 49 // Start playing the media. |
| 47 virtual void Start() = 0; | 50 virtual void Start() = 0; |
| 48 | 51 |
| 49 // Pause the media. | 52 // Pause the media. |
| 50 virtual void Pause(bool is_media_related_action) = 0; | 53 virtual void Pause(bool is_media_related_action) = 0; |
| 51 | 54 |
| 52 // Seek to a particular position, based on renderer signaling actual seek | 55 // Seek to a particular position, based on renderer signaling actual seek |
| 53 // with MediaPlayerHostMsg_Seek. If eventual success, OnSeekComplete() will be | 56 // with MediaPlayerHostMsg_Seek. If eventual success, OnSeekComplete() will be |
| 54 // called. | 57 // called. |
| 55 virtual void SeekTo(base::TimeDelta timestamp) = 0; | 58 virtual void SeekTo(base::TimeDelta timestamp) = 0; |
| 56 | 59 |
| 57 // Release the player resources. | 60 // Release the player resources. |
| 58 virtual void Release() = 0; | 61 virtual void Release() = 0; |
| 59 | 62 |
| 60 // Set the player volume. | 63 // Set the player volume. |
| 61 virtual void SetVolume(double volume) = 0; | 64 virtual void SetVolume(double volume) = 0; |
| 62 | 65 |
| 63 // Get the media information from the player. | 66 // Get the media information from the player. |
| 64 virtual int GetVideoWidth() = 0; | 67 virtual int GetVideoWidth() = 0; |
| 65 virtual int GetVideoHeight() = 0; | 68 virtual int GetVideoHeight() = 0; |
| 66 virtual base::TimeDelta GetDuration() = 0; | 69 virtual base::TimeDelta GetDuration() = 0; |
| 67 virtual base::TimeDelta GetCurrentTime() = 0; | 70 virtual base::TimeDelta GetCurrentTime() = 0; |
| 68 virtual bool IsPlaying() = 0; | 71 virtual bool IsPlaying() = 0; |
| 69 virtual bool IsPlayerReady() = 0; | 72 virtual bool IsPlayerReady() = 0; |
| 70 virtual bool CanPause() = 0; | 73 virtual bool CanPause() = 0; |
| 71 virtual bool CanSeekForward() = 0; | 74 virtual bool CanSeekForward() = 0; |
| 72 virtual bool CanSeekBackward() = 0; | 75 virtual bool CanSeekBackward() = 0; |
| 73 virtual GURL GetUrl(); | 76 virtual GURL GetUrl(); |
| 74 virtual GURL GetFirstPartyForCookies(); | 77 virtual GURL GetFirstPartyForCookies(); |
| 78 virtual GURL GetFrameUrl(); | |
|
qinmin
2014/06/02 17:19:21
GURL frame_url() const {
return frame_url_;
}
May
2014/06/04 14:05:08
Done.
| |
| 75 | 79 |
| 76 // Associates the |cdm| with this player. | 80 // Associates the |cdm| with this player. |
| 77 virtual void SetCdm(MediaKeys* cdm); | 81 virtual void SetCdm(MediaKeys* cdm); |
| 78 | 82 |
| 79 // Notifies the player that a decryption key has been added. The player | 83 // Notifies the player that a decryption key has been added. The player |
| 80 // may want to start/resume playback if it is waiting for a key. | 84 // may want to start/resume playback if it is waiting for a key. |
| 81 virtual void OnKeyAdded(); | 85 virtual void OnKeyAdded(); |
| 82 | 86 |
| 83 // Check whether the player still uses the current surface. | 87 // Check whether the player still uses the current surface. |
| 84 virtual bool IsSurfaceInUse() const = 0; | 88 virtual bool IsSurfaceInUse() const = 0; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 97 | 101 |
| 98 ReleaseMediaResourcesCB release_media_resources_cb_; | 102 ReleaseMediaResourcesCB release_media_resources_cb_; |
| 99 | 103 |
| 100 private: | 104 private: |
| 101 // Player ID assigned to this player. | 105 // Player ID assigned to this player. |
| 102 int player_id_; | 106 int player_id_; |
| 103 | 107 |
| 104 // Resource manager for all the media players. | 108 // Resource manager for all the media players. |
| 105 MediaPlayerManager* manager_; | 109 MediaPlayerManager* manager_; |
| 106 | 110 |
| 111 // Url for the frame that contains this player. | |
| 112 GURL frame_url_; | |
| 113 | |
| 107 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); | 114 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); |
| 108 }; | 115 }; |
| 109 | 116 |
| 110 } // namespace media | 117 } // namespace media |
| 111 | 118 |
| 112 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 119 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
| OLD | NEW |