| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BRIDGE_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 class MEDIA_EXPORT MediaPlayerBridge { | 36 class MEDIA_EXPORT MediaPlayerBridge { |
| 37 public: | 37 public: |
| 38 // Error types for MediaErrorCB. | 38 // Error types for MediaErrorCB. |
| 39 enum MediaErrorType { | 39 enum MediaErrorType { |
| 40 MEDIA_ERROR_FORMAT, | 40 MEDIA_ERROR_FORMAT, |
| 41 MEDIA_ERROR_DECODE, | 41 MEDIA_ERROR_DECODE, |
| 42 MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK, | 42 MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK, |
| 43 MEDIA_ERROR_INVALID_CODE, | 43 MEDIA_ERROR_INVALID_CODE, |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Types of media source that this object will play. |
| 47 enum MediaSource { |
| 48 MEDIA_SOURCE_URL, |
| 49 MEDIA_SOURCE_MSE, // W3C Media Source Extensions |
| 50 MEDIA_SOURCE_STREAM, // W3C Media Stream, e.g. getUserMedia(). |
| 51 }; |
| 52 |
| 46 // Callback when error happens. Args: player ID, error type. | 53 // Callback when error happens. Args: player ID, error type. |
| 47 typedef base::Callback<void(int, int)> MediaErrorCB; | 54 typedef base::Callback<void(int, int)> MediaErrorCB; |
| 48 | 55 |
| 49 // Callback when video size has changed. Args: player ID, width, height. | 56 // Callback when video size has changed. Args: player ID, width, height. |
| 50 typedef base::Callback<void(int, int, int)> VideoSizeChangedCB; | 57 typedef base::Callback<void(int, int, int)> VideoSizeChangedCB; |
| 51 | 58 |
| 52 // Callback when buffering has changed. Args: player ID, percentage | 59 // Callback when buffering has changed. Args: player ID, percentage |
| 53 // of the media. | 60 // of the media. |
| 54 typedef base::Callback<void(int, int)> BufferingUpdateCB; | 61 typedef base::Callback<void(int, int)> BufferingUpdateCB; |
| 55 | 62 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 74 // Callback when DemuxerStreamPlayer wants to read data from the demuxer. | 81 // Callback when DemuxerStreamPlayer wants to read data from the demuxer. |
| 75 typedef base::Callback<void(int, DemuxerStream::Type, bool)> | 82 typedef base::Callback<void(int, DemuxerStream::Type, bool)> |
| 76 ReadFromDemuxerCB; | 83 ReadFromDemuxerCB; |
| 77 #endif | 84 #endif |
| 78 | 85 |
| 79 static bool RegisterMediaPlayerBridge(JNIEnv* env); | 86 static bool RegisterMediaPlayerBridge(JNIEnv* env); |
| 80 | 87 |
| 81 static MediaPlayerBridge* Create( | 88 static MediaPlayerBridge* Create( |
| 82 int player_id, | 89 int player_id, |
| 83 const GURL& url, | 90 const GURL& url, |
| 84 bool is_media_source, | 91 MediaSource media_source, |
| 85 const GURL& first_party_for_cookies, | 92 const GURL& first_party_for_cookies, |
| 86 bool hide_url_log, | 93 bool hide_url_log, |
| 87 MediaPlayerManager* manager, | 94 MediaPlayerManager* manager, |
| 88 #if defined(GOOGLE_TV) | 95 #if defined(GOOGLE_TV) |
| 89 const ReadFromDemuxerCB read_from_demuxer_cb, | 96 const ReadFromDemuxerCB read_from_demuxer_cb, |
| 90 #endif | 97 #endif |
| 91 const MediaErrorCB& media_error_cb, | 98 const MediaErrorCB& media_error_cb, |
| 92 const VideoSizeChangedCB& video_size_changed_cb, | 99 const VideoSizeChangedCB& video_size_changed_cb, |
| 93 const BufferingUpdateCB& buffering_update_cb, | 100 const BufferingUpdateCB& buffering_update_cb, |
| 94 const MediaMetadataChangedCB& media_prepared_cb, | 101 const MediaMetadataChangedCB& media_prepared_cb, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 280 |
| 274 // Listener object that listens to all the media player events. | 281 // Listener object that listens to all the media player events. |
| 275 MediaPlayerListener listener_; | 282 MediaPlayerListener listener_; |
| 276 | 283 |
| 277 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); | 284 DISALLOW_COPY_AND_ASSIGN(MediaPlayerBridge); |
| 278 }; | 285 }; |
| 279 | 286 |
| 280 } // namespace media | 287 } // namespace media |
| 281 | 288 |
| 282 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ | 289 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_BRIDGE_H_ |
| OLD | NEW |