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 16 matching lines...) Expand all Loading... |
27 virtual ~MediaPlayerAndroid(); | 27 virtual ~MediaPlayerAndroid(); |
28 | 28 |
29 // Error types for MediaErrorCB. | 29 // Error types for MediaErrorCB. |
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 // Types of media source that this object will play. |
| 38 enum SourceType { |
| 39 SOURCE_TYPE_URL, |
| 40 SOURCE_TYPE_MSE, // W3C Media Source Extensions |
| 41 SOURCE_TYPE_STREAM, // W3C Media Stream, e.g. getUserMedia(). |
| 42 }; |
| 43 |
37 // Construct a MediaPlayerAndroid object with all the needed media player | 44 // Construct a MediaPlayerAndroid object with all the needed media player |
38 // callbacks. This object needs to call |manager_|'s RequestMediaResources() | 45 // callbacks. This object needs to call |manager_|'s RequestMediaResources() |
39 // before decoding the media stream. This allows |manager_| to track | 46 // before decoding the media stream. This allows |manager_| to track |
40 // unused resources and free them when needed. On the other hand, it needs | 47 // unused resources and free them when needed. On the other hand, it needs |
41 // to call ReleaseMediaResources() when it is done with decoding. | 48 // to call ReleaseMediaResources() when it is done with decoding. |
42 static MediaPlayerAndroid* Create( | 49 static MediaPlayerAndroid* Create(int player_id, |
43 int player_id, | 50 const GURL& url, |
44 const GURL& url, | 51 SourceType source_type, |
45 bool is_media_source, | 52 const GURL& first_party_for_cookies, |
46 const GURL& first_party_for_cookies, | 53 bool hide_url_log, |
47 bool hide_url_log, | 54 MediaPlayerManager* manager); |
48 MediaPlayerManager* manager); | |
49 | 55 |
50 // Passing an external java surface object to the player. | 56 // Passing an external java surface object to the player. |
51 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) = 0; | 57 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) = 0; |
52 | 58 |
53 // Start playing the media. | 59 // Start playing the media. |
54 virtual void Start() = 0; | 60 virtual void Start() = 0; |
55 | 61 |
56 // Pause the media. | 62 // Pause the media. |
57 virtual void Pause() = 0; | 63 virtual void Pause() = 0; |
58 | 64 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 125 |
120 // Resource manager for all the media players. | 126 // Resource manager for all the media players. |
121 MediaPlayerManager* manager_; | 127 MediaPlayerManager* manager_; |
122 | 128 |
123 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); | 129 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); |
124 }; | 130 }; |
125 | 131 |
126 } // namespace media | 132 } // namespace media |
127 | 133 |
128 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 134 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
OLD | NEW |