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 WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_ | 5 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_ |
6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_ | 6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "cc/layers/video_frame_provider.h" | 12 #include "cc/layers/video_frame_provider.h" |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 #include "media/filters/skcanvas_video_renderer.h" | 14 #include "media/filters/skcanvas_video_renderer.h" |
15 #include "skia/ext/platform_canvas.h" | 15 #include "skia/ext/platform_canvas.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" |
17 | 17 |
18 namespace WebKit { | 18 namespace WebKit { |
19 class WebFrame; | 19 class WebFrame; |
20 class WebMediaPlayerClient; | 20 class WebMediaPlayerClient; |
21 class WebVideoFrame; | |
22 } | 21 } |
23 | 22 |
24 namespace media { | 23 namespace media { |
25 class MediaLog; | 24 class MediaLog; |
26 } | 25 } |
27 | 26 |
28 namespace webkit { | 27 namespace webkit { |
29 class WebLayerImpl; | 28 class WebLayerImpl; |
30 } | 29 } |
31 | 30 |
(...skipping 13 matching lines...) Expand all Loading... |
45 // provides video frames for rendering. | 44 // provides video frames for rendering. |
46 // | 45 // |
47 // TODO(wjia): add AudioPlayer. | 46 // TODO(wjia): add AudioPlayer. |
48 // AudioPlayer | 47 // AudioPlayer |
49 // plays audio streams. | 48 // plays audio streams. |
50 // | 49 // |
51 // WebKit::WebMediaPlayerClient | 50 // WebKit::WebMediaPlayerClient |
52 // WebKit client of this media player object. | 51 // WebKit client of this media player object. |
53 class WebMediaPlayerMS | 52 class WebMediaPlayerMS |
54 : public WebKit::WebMediaPlayer, | 53 : public WebKit::WebMediaPlayer, |
55 #ifdef REMOVE_WEBVIDEOFRAME | |
56 public cc::VideoFrameProvider, | 54 public cc::VideoFrameProvider, |
57 #endif | |
58 public base::SupportsWeakPtr<WebMediaPlayerMS> { | 55 public base::SupportsWeakPtr<WebMediaPlayerMS> { |
59 public: | 56 public: |
60 // Construct a WebMediaPlayerMS with reference to the client, and | 57 // Construct a WebMediaPlayerMS with reference to the client, and |
61 // a MediaStreamClient which provides VideoFrameProvider. | 58 // a MediaStreamClient which provides VideoFrameProvider. |
62 WebMediaPlayerMS(WebKit::WebFrame* frame, | 59 WebMediaPlayerMS(WebKit::WebFrame* frame, |
63 WebKit::WebMediaPlayerClient* client, | 60 WebKit::WebMediaPlayerClient* client, |
64 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 61 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
65 MediaStreamClient* media_stream_client, | 62 MediaStreamClient* media_stream_client, |
66 media::MediaLog* media_log); | 63 media::MediaLog* media_log); |
67 virtual ~WebMediaPlayerMS(); | 64 virtual ~WebMediaPlayerMS(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 virtual bool didPassCORSAccessCheck() const OVERRIDE; | 118 virtual bool didPassCORSAccessCheck() const OVERRIDE; |
122 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const OVERRIDE; | 119 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const OVERRIDE; |
123 | 120 |
124 virtual float mediaTimeForTimeValue(float timeValue) const OVERRIDE; | 121 virtual float mediaTimeForTimeValue(float timeValue) const OVERRIDE; |
125 | 122 |
126 virtual unsigned decodedFrameCount() const OVERRIDE; | 123 virtual unsigned decodedFrameCount() const OVERRIDE; |
127 virtual unsigned droppedFrameCount() const OVERRIDE; | 124 virtual unsigned droppedFrameCount() const OVERRIDE; |
128 virtual unsigned audioDecodedByteCount() const OVERRIDE; | 125 virtual unsigned audioDecodedByteCount() const OVERRIDE; |
129 virtual unsigned videoDecodedByteCount() const OVERRIDE; | 126 virtual unsigned videoDecodedByteCount() const OVERRIDE; |
130 | 127 |
131 #ifndef REMOVE_WEBVIDEOFRAME | |
132 virtual WebKit::WebVideoFrame* getCurrentFrame() OVERRIDE; | |
133 virtual void putCurrentFrame(WebKit::WebVideoFrame* web_video_frame) OVERRIDE; | |
134 #else | |
135 // VideoFrameProvider implementation. | 128 // VideoFrameProvider implementation. |
136 virtual void SetVideoFrameProviderClient( | 129 virtual void SetVideoFrameProviderClient( |
137 cc::VideoFrameProvider::Client* client) OVERRIDE; | 130 cc::VideoFrameProvider::Client* client) OVERRIDE; |
138 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE; | 131 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE; |
139 virtual void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame) | 132 virtual void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame) |
140 OVERRIDE; | 133 OVERRIDE; |
141 #endif | |
142 | 134 |
143 private: | 135 private: |
144 // The callback for VideoFrameProvider to signal a new frame is available. | 136 // The callback for VideoFrameProvider to signal a new frame is available. |
145 void OnFrameAvailable(const scoped_refptr<media::VideoFrame>& frame); | 137 void OnFrameAvailable(const scoped_refptr<media::VideoFrame>& frame); |
146 // Need repaint due to state change. | 138 // Need repaint due to state change. |
147 void RepaintInternal(); | 139 void RepaintInternal(); |
148 | 140 |
149 // The callback for source to report error. | 141 // The callback for source to report error. |
150 void OnSourceError(); | 142 void OnSourceError(); |
151 | 143 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; | 194 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; |
203 | 195 |
204 scoped_refptr<media::MediaLog> media_log_; | 196 scoped_refptr<media::MediaLog> media_log_; |
205 | 197 |
206 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); | 198 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); |
207 }; | 199 }; |
208 | 200 |
209 } // namespace webkit_media | 201 } // namespace webkit_media |
210 | 202 |
211 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_ | 203 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_ |
OLD | NEW |