Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Side by Side Diff: cc/video_layer_impl.h

Issue 12774006: cc: Chromify Layer and LayerImpl classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MoreAndroidCompilings Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/video_layer.cc ('k') | cc/video_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/callback.h" 8 #include "base/callback.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "cc/cc_export.h" 10 #include "cc/cc_export.h"
11 #include "cc/layer_impl.h" 11 #include "cc/layer_impl.h"
12 #include "cc/video_frame_provider.h" 12 #include "cc/video_frame_provider.h"
13 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
14 #include "third_party/khronos/GLES2/gl2.h" 14 #include "third_party/khronos/GLES2/gl2.h"
15 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
16 #include "ui/gfx/transform.h" 16 #include "ui/gfx/transform.h"
17 17
18 namespace media { 18 namespace media {
19 class SkCanvasVideoRenderer; 19 class SkCanvasVideoRenderer;
20 } 20 }
21 21
22 namespace cc { 22 namespace cc {
23 class LayerTreeHostImpl; 23 class LayerTreeHostImpl;
24 class VideoFrameProviderClientImpl; 24 class VideoFrameProviderClientImpl;
25 25
26 class CC_EXPORT VideoLayerImpl : public LayerImpl { 26 class CC_EXPORT VideoLayerImpl : public LayerImpl {
27 public: 27 public:
28 static scoped_ptr<VideoLayerImpl> create(LayerTreeImpl* treeImpl, int id, Vi deoFrameProvider* provider); 28 static scoped_ptr<VideoLayerImpl> Create(LayerTreeImpl* treeImpl, int id, Vi deoFrameProvider* provider);
29 virtual ~VideoLayerImpl(); 29 virtual ~VideoLayerImpl();
30 30
31 // LayerImpl implementation. 31 // LayerImpl implementation.
32 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl*) OVERRIDE; 32 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl*) OVERRIDE;
33 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; 33 virtual void PushPropertiesTo(LayerImpl*) OVERRIDE;
34 virtual void willDraw(ResourceProvider*) OVERRIDE; 34 virtual void WillDraw(ResourceProvider*) OVERRIDE;
35 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; 35 virtual void AppendQuads(QuadSink* quad_sink,
36 virtual void didDraw(ResourceProvider*) OVERRIDE; 36 AppendQuadsData* append_quads_data) OVERRIDE;
37 virtual void didBecomeActive() OVERRIDE; 37 virtual void DidDraw(ResourceProvider*) OVERRIDE;
38 virtual void didLoseOutputSurface() OVERRIDE; 38 virtual void DidBecomeActive() OVERRIDE;
39 virtual void DidLoseOutputSurface() OVERRIDE;
39 40
40 void setNeedsRedraw(); 41 void setNeedsRedraw();
41 42
42 void setProviderClientImpl(scoped_refptr<VideoFrameProviderClientImpl>); 43 void setProviderClientImpl(scoped_refptr<VideoFrameProviderClientImpl>);
43 44
44 struct FramePlane { 45 struct FramePlane {
45 ResourceProvider::ResourceId resourceId; 46 ResourceProvider::ResourceId resourceId;
46 gfx::Size size; 47 gfx::Size size;
47 GLenum format; 48 GLenum format;
48 49
49 FramePlane() : resourceId(0), format(GL_LUMINANCE) { } 50 FramePlane() : resourceId(0), format(GL_LUMINANCE) { }
50 51
51 bool allocateData(ResourceProvider*); 52 bool allocateData(ResourceProvider*);
52 void freeData(ResourceProvider*); 53 void freeData(ResourceProvider*);
53 }; 54 };
54 55
55 private: 56 private:
56 VideoLayerImpl(LayerTreeImpl*, int); 57 VideoLayerImpl(LayerTreeImpl*, int);
57 58
58 virtual const char* layerTypeAsString() const OVERRIDE; 59 virtual const char* LayerTypeAsString() const OVERRIDE;
59 60
60 void willDrawInternal(ResourceProvider*); 61 void willDrawInternal(ResourceProvider*);
61 bool allocatePlaneData(ResourceProvider*); 62 bool allocatePlaneData(ResourceProvider*);
62 bool copyPlaneData(ResourceProvider*); 63 bool copyPlaneData(ResourceProvider*);
63 void freePlaneData(ResourceProvider*); 64 void freePlaneData(ResourceProvider*);
64 void freeUnusedPlaneData(ResourceProvider*); 65 void freeUnusedPlaneData(ResourceProvider*);
65 size_t numPlanes() const; 66 size_t numPlanes() const;
66 67
67 scoped_refptr<VideoFrameProviderClientImpl> m_providerClientImpl; 68 scoped_refptr<VideoFrameProviderClientImpl> m_providerClientImpl;
68 69
69 media::VideoFrame* m_frame; 70 media::VideoFrame* m_frame;
70 GLenum m_format; 71 GLenum m_format;
71 bool m_convertYUV; 72 bool m_convertYUV;
72 ResourceProvider::ResourceId m_externalTextureResource; 73 ResourceProvider::ResourceId m_externalTextureResource;
73 scoped_ptr<media::SkCanvasVideoRenderer> m_videoRenderer; 74 scoped_ptr<media::SkCanvasVideoRenderer> m_videoRenderer;
74 75
75 // Each index in this array corresponds to a plane in media::VideoFrame. 76 // Each index in this array corresponds to a plane in media::VideoFrame.
76 FramePlane m_framePlanes[media::VideoFrame::kMaxPlanes]; 77 FramePlane m_framePlanes[media::VideoFrame::kMaxPlanes];
77 }; 78 };
78 79
79 } // namespace cc 80 } // namespace cc
80 81
81 #endif // CC_VIDEO_LAYER_IMPL_H_ 82 #endif // CC_VIDEO_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/video_layer.cc ('k') | cc/video_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698