| 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 CCVideoLayerImpl_h | 5 #ifndef CCVideoLayerImpl_h |
| 6 #define CCVideoLayerImpl_h | 6 #define CCVideoLayerImpl_h |
| 7 | 7 |
| 8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
| 9 #include "CCLayerImpl.h" | 9 #include "CCLayerImpl.h" |
| 10 #include "third_party/khronos/GLES2/gl2.h" | 10 #include "third_party/khronos/GLES2/gl2.h" |
| 11 #include "IntSize.h" | 11 #include "IntSize.h" |
| 12 #include <public/WebTransformationMatrix.h> | 12 #include <public/WebTransformationMatrix.h> |
| 13 #include <public/WebVideoFrameProvider.h> | 13 #include <public/WebVideoFrameProvider.h> |
| 14 #include <wtf/ThreadingPrimitives.h> | 14 #include <wtf/ThreadingPrimitives.h> |
| 15 | 15 |
| 16 namespace WebKit { | 16 namespace WebKit { |
| 17 class WebVideoFrame; | 17 class WebVideoFrame; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 class CCLayerTreeHostImpl; | 22 class CCLayerTreeHostImpl; |
| 23 class CCProxy; |
| 23 class CCVideoLayerImpl; | 24 class CCVideoLayerImpl; |
| 24 | 25 |
| 25 class CCVideoLayerImpl : public CCLayerImpl | 26 class CCVideoLayerImpl : public CCLayerImpl |
| 26 , public WebKit::WebVideoFrameProvider::Client { | 27 , public WebKit::WebVideoFrameProvider::Client { |
| 27 public: | 28 public: |
| 28 static scoped_ptr<CCVideoLayerImpl> create(int id, WebKit::WebVideoFrameProv
ider* provider) | 29 static scoped_ptr<CCVideoLayerImpl> create(int id, WebKit::WebVideoFrameProv
ider* provider) |
| 29 { | 30 { |
| 30 return make_scoped_ptr(new CCVideoLayerImpl(id, provider)); | 31 return make_scoped_ptr(new CCVideoLayerImpl(id, provider, NULL)); // FI
XME |
| 31 } | 32 } |
| 32 virtual ~CCVideoLayerImpl(); | 33 virtual ~CCVideoLayerImpl(); |
| 33 | 34 |
| 34 virtual void willDraw(CCResourceProvider*) OVERRIDE; | 35 virtual void willDraw(CCResourceProvider*) OVERRIDE; |
| 35 virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; | 36 virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; |
| 36 virtual void didDraw(CCResourceProvider*) OVERRIDE; | 37 virtual void didDraw(CCResourceProvider*) OVERRIDE; |
| 37 | 38 |
| 38 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; | 39 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; |
| 39 | 40 |
| 40 // WebKit::WebVideoFrameProvider::Client implementation. | 41 // WebKit::WebVideoFrameProvider::Client implementation. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 52 GLenum format; | 53 GLenum format; |
| 53 IntSize visibleSize; | 54 IntSize visibleSize; |
| 54 | 55 |
| 55 FramePlane() : resourceId(0) { } | 56 FramePlane() : resourceId(0) { } |
| 56 | 57 |
| 57 bool allocateData(CCResourceProvider*); | 58 bool allocateData(CCResourceProvider*); |
| 58 void freeData(CCResourceProvider*); | 59 void freeData(CCResourceProvider*); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 CCVideoLayerImpl(int, WebKit::WebVideoFrameProvider*); | 63 CCVideoLayerImpl(int, WebKit::WebVideoFrameProvider*, CCProxy*); |
| 63 | 64 |
| 64 static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned pla
ne); | 65 static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned pla
ne); |
| 65 virtual const char* layerTypeAsString() const OVERRIDE; | 66 virtual const char* layerTypeAsString() const OVERRIDE; |
| 66 | 67 |
| 67 void willDrawInternal(CCResourceProvider*); | 68 void willDrawInternal(CCResourceProvider*); |
| 68 bool allocatePlaneData(CCResourceProvider*); | 69 bool allocatePlaneData(CCResourceProvider*); |
| 69 bool copyPlaneData(CCResourceProvider*); | 70 bool copyPlaneData(CCResourceProvider*); |
| 70 void freePlaneData(CCResourceProvider*); | 71 void freePlaneData(CCResourceProvider*); |
| 71 void freeUnusedPlaneData(CCResourceProvider*); | 72 void freeUnusedPlaneData(CCResourceProvider*); |
| 72 | 73 |
| 74 CCProxy* m_proxy; |
| 75 |
| 73 // Guards the destruction of m_provider and the frame that it provides | 76 // Guards the destruction of m_provider and the frame that it provides |
| 74 base::Lock m_providerLock; | 77 base::Lock m_providerLock; |
| 75 WebKit::WebVideoFrameProvider* m_provider; | 78 WebKit::WebVideoFrameProvider* m_provider; |
| 76 | 79 |
| 77 WebKit::WebTransformationMatrix m_streamTextureMatrix; | 80 WebKit::WebTransformationMatrix m_streamTextureMatrix; |
| 78 | 81 |
| 79 WebKit::WebVideoFrame* m_frame; | 82 WebKit::WebVideoFrame* m_frame; |
| 80 GLenum m_format; | 83 GLenum m_format; |
| 81 CCResourceProvider::ResourceId m_externalTextureResource; | 84 CCResourceProvider::ResourceId m_externalTextureResource; |
| 82 | 85 |
| 83 // Each index in this array corresponds to a plane in WebKit::WebVideoFrame. | 86 // Each index in this array corresponds to a plane in WebKit::WebVideoFrame. |
| 84 FramePlane m_framePlanes[WebKit::WebVideoFrame::maxPlanes]; | 87 FramePlane m_framePlanes[WebKit::WebVideoFrame::maxPlanes]; |
| 85 }; | 88 }; |
| 86 | 89 |
| 87 } | 90 } |
| 88 | 91 |
| 89 #endif // CCVideoLayerImpl_h | 92 #endif // CCVideoLayerImpl_h |
| OLD | NEW |