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