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 19 matching lines...) Expand all Loading... |
30 enum MediaErrorType { | 30 enum MediaErrorType { |
31 MEDIA_ERROR_FORMAT, | 31 MEDIA_ERROR_FORMAT, |
32 MEDIA_ERROR_DECODE, | 32 MEDIA_ERROR_DECODE, |
33 MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK, | 33 MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK, |
34 MEDIA_ERROR_INVALID_CODE, | 34 MEDIA_ERROR_INVALID_CODE, |
35 }; | 35 }; |
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. | |
41 typedef base::Callback<void(int player_id)> ReleaseMediaResourcesCB; | |
42 | |
43 // Passing an external java surface object to the player. | 40 // Passing an external java surface object to the player. |
44 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) = 0; | 41 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) = 0; |
45 | 42 |
46 // Start playing the media. | 43 // Start playing the media. |
47 virtual void Start() = 0; | 44 virtual void Start() = 0; |
48 | 45 |
49 // Pause the media. | 46 // Pause the media. |
50 virtual void Pause(bool is_media_related_action) = 0; | 47 virtual void Pause(bool is_media_related_action) = 0; |
51 | 48 |
52 // Seek to a particular position, based on renderer signaling actual seek | 49 // Seek to a particular position, based on renderer signaling actual seek |
(...skipping 27 matching lines...) Expand all Loading... |
80 virtual bool IsSurfaceInUse() const = 0; | 77 virtual bool IsSurfaceInUse() const = 0; |
81 | 78 |
82 int player_id() { return player_id_; } | 79 int player_id() { return player_id_; } |
83 | 80 |
84 GURL frame_url() { return frame_url_; } | 81 GURL frame_url() { return frame_url_; } |
85 | 82 |
86 protected: | 83 protected: |
87 MediaPlayerAndroid(int player_id, | 84 MediaPlayerAndroid(int player_id, |
88 MediaPlayerManager* manager, | 85 MediaPlayerManager* manager, |
89 const RequestMediaResourcesCB& request_media_resources_cb, | 86 const RequestMediaResourcesCB& request_media_resources_cb, |
90 const ReleaseMediaResourcesCB& release_media_resources_cb, | |
91 const GURL& frame_url); | 87 const GURL& frame_url); |
92 | 88 |
93 MediaPlayerManager* manager() { return manager_; } | 89 MediaPlayerManager* manager() { return manager_; } |
94 | 90 |
95 RequestMediaResourcesCB request_media_resources_cb_; | 91 RequestMediaResourcesCB request_media_resources_cb_; |
96 | 92 |
97 ReleaseMediaResourcesCB release_media_resources_cb_; | |
98 | |
99 private: | 93 private: |
100 // Player ID assigned to this player. | 94 // Player ID assigned to this player. |
101 int player_id_; | 95 int player_id_; |
102 | 96 |
103 // Resource manager for all the media players. | 97 // Resource manager for all the media players. |
104 MediaPlayerManager* manager_; | 98 MediaPlayerManager* manager_; |
105 | 99 |
106 // Url for the frame that contains this player. | 100 // Url for the frame that contains this player. |
107 GURL frame_url_; | 101 GURL frame_url_; |
108 | 102 |
109 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); | 103 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); |
110 }; | 104 }; |
111 | 105 |
112 } // namespace media | 106 } // namespace media |
113 | 107 |
114 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 108 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
OLD | NEW |