Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: webkit/media/android/webmediaplayer_android.h

Issue 10469003: Prepare WebMediaPlayerAndroid for bytesLoaded() -> didLoadingProgress() transition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 5 #ifndef WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 6 #define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 19 matching lines...) Expand all
30 30
31 // This class serves as the android implementation of WebKit::WebMediaPlayer. 31 // This class serves as the android implementation of WebKit::WebMediaPlayer.
32 // It implements all the playback functions by forwarding calls to android 32 // It implements all the playback functions by forwarding calls to android
33 // media player, and reports player state changes to the webkit. 33 // media player, and reports player state changes to the webkit.
34 class WebMediaPlayerAndroid : 34 class WebMediaPlayerAndroid :
35 public WebKit::WebMediaPlayer, 35 public WebKit::WebMediaPlayer,
36 public base::SupportsWeakPtr<WebMediaPlayerAndroid> { 36 public base::SupportsWeakPtr<WebMediaPlayerAndroid> {
37 public: 37 public:
38 WebMediaPlayerAndroid(WebKit::WebMediaPlayerClient* client, 38 WebMediaPlayerAndroid(WebKit::WebMediaPlayerClient* client,
39 WebKit::WebCookieJar* cookie_jar); 39 WebKit::WebCookieJar* cookie_jar);
40 virtual ~WebMediaPlayerAndroid() OVERRIDE; 40 virtual ~WebMediaPlayerAndroid();
41 41
42 // Set |incognito_mode_| to true if in incognito mode. 42 // Set |incognito_mode_| to true if in incognito mode.
43 static void InitIncognito(bool incognito_mode); 43 static void InitIncognito(bool incognito_mode);
44 44
45 // Resource loading. 45 // Resource loading.
46 virtual void load(const WebKit::WebURL& url) OVERRIDE; 46 virtual void load(const WebKit::WebURL& url);
47 virtual void cancelLoad() OVERRIDE; 47 virtual void cancelLoad();
48 48
49 // Playback controls. 49 // Playback controls.
50 virtual void play() OVERRIDE; 50 virtual void play();
51 virtual void pause() OVERRIDE; 51 virtual void pause();
52 virtual void seek(float seconds) OVERRIDE; 52 virtual void seek(float seconds);
53 virtual bool supportsFullscreen() const OVERRIDE; 53 virtual bool supportsFullscreen() const;
54 virtual bool supportsSave() const OVERRIDE; 54 virtual bool supportsSave() const;
55 virtual void setEndTime(float seconds) OVERRIDE; 55 virtual void setEndTime(float seconds);
56 virtual void setRate(float rate) OVERRIDE; 56 virtual void setRate(float rate);
57 virtual void setVolume(float volume) OVERRIDE; 57 virtual void setVolume(float volume);
58 virtual void setVisible(bool visible) OVERRIDE; 58 virtual void setVisible(bool visible);
59 virtual bool totalBytesKnown() OVERRIDE; 59 virtual bool totalBytesKnown();
60 virtual const WebKit::WebTimeRanges& buffered() OVERRIDE; 60 virtual const WebKit::WebTimeRanges& buffered();
61 virtual float maxTimeSeekable() const OVERRIDE; 61 virtual float maxTimeSeekable() const;
62 62
63 // Methods for painting. 63 // Methods for painting.
64 virtual void setSize(const WebKit::WebSize& size) OVERRIDE; 64 virtual void setSize(const WebKit::WebSize& size);
65 virtual void paint(WebKit::WebCanvas* canvas, 65 virtual void paint(WebKit::WebCanvas* canvas,
66 const WebKit::WebRect& rect, 66 const WebKit::WebRect& rect,
67 uint8_t alpha) OVERRIDE; 67 uint8_t alpha);
68 68
69 // True if the loaded media has a playable video/audio track. 69 // True if the loaded media has a playable video/audio track.
70 virtual bool hasVideo() const OVERRIDE; 70 virtual bool hasVideo() const;
71 virtual bool hasAudio() const OVERRIDE; 71 virtual bool hasAudio() const;
72 72
73 // Dimensions of the video. 73 // Dimensions of the video.
74 virtual WebKit::WebSize naturalSize() const OVERRIDE; 74 virtual WebKit::WebSize naturalSize() const;
75 75
76 // Getters of playback state. 76 // Getters of playback state.
77 virtual bool paused() const OVERRIDE; 77 virtual bool paused() const;
78 virtual bool seeking() const OVERRIDE; 78 virtual bool seeking() const;
79 virtual float duration() const OVERRIDE; 79 virtual float duration() const;
80 virtual float currentTime() const OVERRIDE; 80 virtual float currentTime() const;
81 81
82 // Get rate of loading the resource. 82 // Get rate of loading the resource.
83 virtual int32 dataRate() const OVERRIDE; 83 virtual int32 dataRate() const;
84 84
85 virtual unsigned long long bytesLoaded() const OVERRIDE; 85 virtual unsigned long long bytesLoaded() const;
86 virtual unsigned long long totalBytes() const OVERRIDE; 86 virtual bool didLoadingProgress() const;
87 virtual unsigned long long totalBytes() const;
87 88
88 // Internal states of loading and network. 89 // Internal states of loading and network.
89 virtual WebKit::WebMediaPlayer::NetworkState networkState() const OVERRIDE; 90 virtual WebKit::WebMediaPlayer::NetworkState networkState() const;
90 virtual WebKit::WebMediaPlayer::ReadyState readyState() const OVERRIDE; 91 virtual WebKit::WebMediaPlayer::ReadyState readyState() const;
91 92
92 virtual bool hasSingleSecurityOrigin() const OVERRIDE; 93 virtual bool hasSingleSecurityOrigin() const;
93 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const OVERRIDE; 94 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const;
94 95
95 virtual float mediaTimeForTimeValue(float timeValue) const OVERRIDE; 96 virtual float mediaTimeForTimeValue(float timeValue) const;
96 97
97 // Provide statistics. 98 // Provide statistics.
98 virtual unsigned decodedFrameCount() const OVERRIDE; 99 virtual unsigned decodedFrameCount() const;
99 virtual unsigned droppedFrameCount() const OVERRIDE; 100 virtual unsigned droppedFrameCount() const;
100 virtual unsigned audioDecodedByteCount() const OVERRIDE; 101 virtual unsigned audioDecodedByteCount() const;
101 virtual unsigned videoDecodedByteCount() const OVERRIDE; 102 virtual unsigned videoDecodedByteCount() const;
102 103
103 // Methods called from VideoLayerChromium. These methods are running on the 104 // Methods called from VideoLayerChromium. These methods are running on the
104 // compositor thread. 105 // compositor thread.
105 virtual WebKit::WebVideoFrame* getCurrentFrame() OVERRIDE; 106 virtual WebKit::WebVideoFrame* getCurrentFrame();
106 virtual void putCurrentFrame(WebKit::WebVideoFrame*) OVERRIDE; 107 virtual void putCurrentFrame(WebKit::WebVideoFrame*);
107 108
108 // Media player callback handlers. 109 // Media player callback handlers.
109 void OnMediaPrepared(); 110 void OnMediaPrepared();
110 void OnPlaybackComplete(); 111 void OnPlaybackComplete();
111 void OnBufferingUpdate(int percentage); 112 void OnBufferingUpdate(int percentage);
112 void OnSeekComplete(); 113 void OnSeekComplete();
113 void OnMediaError(int error_type); 114 void OnMediaError(int error_type);
114 void OnMediaInfo(int info_type); 115 void OnMediaInfo(int info_type);
115 void OnVideoSizeChanged(int width, int height); 116 void OnVideoSizeChanged(int width, int height);
116 117
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 175
175 // Internal seek state. 176 // Internal seek state.
176 bool seeking_; 177 bool seeking_;
177 178
178 // Whether playback has completed. 179 // Whether playback has completed.
179 float playback_completed_; 180 float playback_completed_;
180 181
181 // Fake it by self increasing on every OnBufferingUpdate event. 182 // Fake it by self increasing on every OnBufferingUpdate event.
182 int64 buffered_bytes_; 183 int64 buffered_bytes_;
183 184
185 // Whether loading has progressed since the last call to didLoadingProgress.
186 mutable bool did_loading_progress_;
187
184 // Pointer to the cookie jar to get the cookie for the media url. 188 // Pointer to the cookie jar to get the cookie for the media url.
185 WebKit::WebCookieJar* cookie_jar_; 189 WebKit::WebCookieJar* cookie_jar_;
186 190
187 // Whether the user has clicked the play button while media player 191 // Whether the user has clicked the play button while media player
188 // is preparing. 192 // is preparing.
189 bool pending_play_event_; 193 bool pending_play_event_;
190 194
191 // Current player states. 195 // Current player states.
192 WebKit::WebMediaPlayer::NetworkState network_state_; 196 WebKit::WebMediaPlayer::NetworkState network_state_;
193 WebKit::WebMediaPlayer::ReadyState ready_state_; 197 WebKit::WebMediaPlayer::ReadyState ready_state_;
194 198
195 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); 199 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid);
196 }; 200 };
197 201
198 } // namespace webkit_media 202 } // namespace webkit_media
199 203
200 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ 204 #endif // WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698