OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_VIDEO_LAYER_IMPL_H_ | 5 #ifndef CC_VIDEO_LAYER_IMPL_H_ |
6 #define CC_VIDEO_LAYER_IMPL_H_ | 6 #define CC_VIDEO_LAYER_IMPL_H_ |
7 | 7 |
8 #include <public/WebVideoFrameProvider.h> | 8 #include <public/WebVideoFrameProvider.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 namespace cc { | 27 namespace cc { |
28 | 28 |
29 class LayerTreeHostImpl; | 29 class LayerTreeHostImpl; |
30 class VideoLayerImpl; | 30 class VideoLayerImpl; |
31 | 31 |
32 class CC_EXPORT VideoLayerImpl : public LayerImpl | 32 class CC_EXPORT VideoLayerImpl : public LayerImpl |
33 , public WebKit::WebVideoFrameProvider::Client { | 33 , public WebKit::WebVideoFrameProvider::Client { |
34 public: | 34 public: |
35 typedef base::Callback<media::VideoFrame* (WebKit::WebVideoFrame*)> FrameUnw
rapper; | 35 typedef base::Callback<media::VideoFrame* (WebKit::WebVideoFrame*)> FrameUnw
rapper; |
36 | 36 |
37 static scoped_ptr<VideoLayerImpl> create(int id, WebKit::WebVideoFrameProvid
er* provider, | 37 static scoped_ptr<VideoLayerImpl> create(LayerTreeHostImpl* hostImpl, int id
, WebKit::WebVideoFrameProvider* provider, |
38 const FrameUnwrapper& unwrapper) | 38 const FrameUnwrapper& unwrapper) |
39 { | 39 { |
40 return make_scoped_ptr(new VideoLayerImpl(id, provider, unwrapper)); | 40 return make_scoped_ptr(new VideoLayerImpl(hostImpl, id, provider, unwrap
per)); |
41 } | 41 } |
42 virtual ~VideoLayerImpl(); | 42 virtual ~VideoLayerImpl(); |
43 | 43 |
44 virtual void willDraw(ResourceProvider*) OVERRIDE; | 44 virtual void willDraw(ResourceProvider*) OVERRIDE; |
45 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; | 45 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; |
46 virtual void didDraw(ResourceProvider*) OVERRIDE; | 46 virtual void didDraw(ResourceProvider*) OVERRIDE; |
47 | 47 |
48 // WebKit::WebVideoFrameProvider::Client implementation. | 48 // WebKit::WebVideoFrameProvider::Client implementation. |
49 virtual void stopUsingProvider(); // Callable on any thread. | 49 virtual void stopUsingProvider(); // Callable on any thread. |
50 virtual void didReceiveFrame(); // Callable on impl thread. | 50 virtual void didReceiveFrame(); // Callable on impl thread. |
51 virtual void didUpdateMatrix(const float*); // Callable on impl thread. | 51 virtual void didUpdateMatrix(const float*); // Callable on impl thread. |
52 | 52 |
53 virtual void didLoseOutputSurface() OVERRIDE; | 53 virtual void didLoseOutputSurface() OVERRIDE; |
54 | 54 |
55 void setNeedsRedraw(); | 55 void setNeedsRedraw(); |
56 | 56 |
57 struct FramePlane { | 57 struct FramePlane { |
58 ResourceProvider::ResourceId resourceId; | 58 ResourceProvider::ResourceId resourceId; |
59 gfx::Size size; | 59 gfx::Size size; |
60 GLenum format; | 60 GLenum format; |
61 | 61 |
62 FramePlane() : resourceId(0) { } | 62 FramePlane() : resourceId(0) { } |
63 | 63 |
64 bool allocateData(ResourceProvider*); | 64 bool allocateData(ResourceProvider*); |
65 void freeData(ResourceProvider*); | 65 void freeData(ResourceProvider*); |
66 }; | 66 }; |
67 | 67 |
68 private: | 68 private: |
69 VideoLayerImpl(int, WebKit::WebVideoFrameProvider*, const FrameUnwrapper&); | 69 VideoLayerImpl(LayerTreeHostImpl*, int, WebKit::WebVideoFrameProvider*, cons
t FrameUnwrapper&); |
70 | 70 |
71 virtual const char* layerTypeAsString() const OVERRIDE; | 71 virtual const char* layerTypeAsString() const OVERRIDE; |
72 | 72 |
73 void willDrawInternal(ResourceProvider*); | 73 void willDrawInternal(ResourceProvider*); |
74 bool allocatePlaneData(ResourceProvider*); | 74 bool allocatePlaneData(ResourceProvider*); |
75 bool copyPlaneData(ResourceProvider*); | 75 bool copyPlaneData(ResourceProvider*); |
76 void freePlaneData(ResourceProvider*); | 76 void freePlaneData(ResourceProvider*); |
77 void freeUnusedPlaneData(ResourceProvider*); | 77 void freeUnusedPlaneData(ResourceProvider*); |
78 size_t numPlanes() const; | 78 size_t numPlanes() const; |
79 | 79 |
(...skipping 11 matching lines...) Expand all Loading... |
91 ResourceProvider::ResourceId m_externalTextureResource; | 91 ResourceProvider::ResourceId m_externalTextureResource; |
92 scoped_ptr<media::SkCanvasVideoRenderer> m_videoRenderer; | 92 scoped_ptr<media::SkCanvasVideoRenderer> m_videoRenderer; |
93 | 93 |
94 // Each index in this array corresponds to a plane in media::VideoFrame. | 94 // Each index in this array corresponds to a plane in media::VideoFrame. |
95 FramePlane m_framePlanes[media::VideoFrame::kMaxPlanes]; | 95 FramePlane m_framePlanes[media::VideoFrame::kMaxPlanes]; |
96 }; | 96 }; |
97 | 97 |
98 } // namespace cc | 98 } // namespace cc |
99 | 99 |
100 #endif // CC_VIDEO_LAYER_IMPL_H_ | 100 #endif // CC_VIDEO_LAYER_IMPL_H_ |
OLD | NEW |