| 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_PROXY_H_ | 5 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ |
| 6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ | 6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "media/base/pipeline.h" | 10 #include "media/base/pipeline.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 public: | 37 public: |
| 38 WebMediaPlayerProxy(const scoped_refptr<base::MessageLoopProxy>& render_loop, | 38 WebMediaPlayerProxy(const scoped_refptr<base::MessageLoopProxy>& render_loop, |
| 39 WebMediaPlayerImpl* webmediaplayer); | 39 WebMediaPlayerImpl* webmediaplayer); |
| 40 const scoped_refptr<BufferedDataSource>& data_source() { | 40 const scoped_refptr<BufferedDataSource>& data_source() { |
| 41 return data_source_; | 41 return data_source_; |
| 42 } | 42 } |
| 43 void set_data_source(const scoped_refptr<BufferedDataSource>& data_source) { | 43 void set_data_source(const scoped_refptr<BufferedDataSource>& data_source) { |
| 44 data_source_ = data_source; | 44 data_source_ = data_source; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Called by VideoRendererBase on its internal thread with the new frame to be | 47 // TODO(scherkus): remove this once VideoRendererBase::PaintCB passes |
| 48 // painted. | 48 // ownership of the VideoFrame http://crbug.com/108435 |
| 49 void FrameReady(const scoped_refptr<media::VideoFrame>& frame); | 49 void set_frame_provider(media::VideoRendererBase* frame_provider) { |
| 50 frame_provider_ = frame_provider; |
| 51 } |
| 52 |
| 53 // Methods for Filter -> WebMediaPlayerImpl communication. |
| 54 void Repaint(); |
| 50 | 55 |
| 51 // Methods for WebMediaPlayerImpl -> Filter communication. | 56 // Methods for WebMediaPlayerImpl -> Filter communication. |
| 52 void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect, uint8_t alpha); | 57 void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect, uint8_t alpha); |
| 53 void Detach(); | 58 void Detach(); |
| 54 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); | 59 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); |
| 60 void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); |
| 55 bool HasSingleOrigin(); | 61 bool HasSingleOrigin(); |
| 56 bool DidPassCORSAccessCheck() const; | 62 bool DidPassCORSAccessCheck() const; |
| 57 | 63 |
| 58 void AbortDataSource(); | 64 void AbortDataSource(); |
| 59 | 65 |
| 60 private: | 66 private: |
| 61 friend class base::RefCountedThreadSafe<WebMediaPlayerProxy>; | 67 friend class base::RefCountedThreadSafe<WebMediaPlayerProxy>; |
| 62 virtual ~WebMediaPlayerProxy(); | 68 virtual ~WebMediaPlayerProxy(); |
| 63 | 69 |
| 64 // Invoke |webmediaplayer_| to perform a repaint. | 70 // Invoke |webmediaplayer_| to perform a repaint. |
| 65 void RepaintTask(); | 71 void RepaintTask(); |
| 66 | 72 |
| 67 // The render message loop where WebKit lives. | 73 // The render message loop where WebKit lives. |
| 68 scoped_refptr<base::MessageLoopProxy> render_loop_; | 74 scoped_refptr<base::MessageLoopProxy> render_loop_; |
| 69 WebMediaPlayerImpl* webmediaplayer_; | 75 WebMediaPlayerImpl* webmediaplayer_; |
| 70 | 76 |
| 71 scoped_refptr<BufferedDataSource> data_source_; | 77 scoped_refptr<BufferedDataSource> data_source_; |
| 78 scoped_refptr<media::VideoRendererBase> frame_provider_; |
| 72 media::SkCanvasVideoRenderer video_renderer_; | 79 media::SkCanvasVideoRenderer video_renderer_; |
| 73 | 80 |
| 74 base::Lock lock_; | 81 base::Lock lock_; |
| 75 scoped_refptr<media::VideoFrame> current_frame_; | |
| 76 int outstanding_repaints_; | 82 int outstanding_repaints_; |
| 77 | 83 |
| 78 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); | 84 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); |
| 79 }; | 85 }; |
| 80 | 86 |
| 81 } // namespace webkit_media | 87 } // namespace webkit_media |
| 82 | 88 |
| 83 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ | 89 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ |
| OLD | NEW |