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

Side by Side Diff: cc/video_layer_impl.h

Issue 11274017: Added support for YUV videos to the software compositor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cosmetics. Created 8 years, 1 month 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
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 CCVideoLayerImpl_h 5 #ifndef CCVideoLayerImpl_h
6 #define CCVideoLayerImpl_h 6 #define CCVideoLayerImpl_h
7 7
8 #include "IntSize.h" 8 #include "IntSize.h"
9 #include "base/callback.h"
9 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
10 #include "cc/layer_impl.h" 11 #include "cc/layer_impl.h"
12 #include "media/base/video_frame.h"
11 #include "third_party/khronos/GLES2/gl2.h" 13 #include "third_party/khronos/GLES2/gl2.h"
12 #include <public/WebTransformationMatrix.h> 14 #include <public/WebTransformationMatrix.h>
13 #include <public/WebVideoFrameProvider.h> 15 #include <public/WebVideoFrameProvider.h>
14 #include <wtf/ThreadingPrimitives.h>
15 16
16 namespace WebKit { 17 namespace WebKit {
17 class WebVideoFrame; 18 class WebVideoFrame;
18 } 19 }
19 20
20 namespace cc { 21 namespace cc {
21 22
22 class LayerTreeHostImpl; 23 class LayerTreeHostImpl;
23 class VideoLayerImpl; 24 class VideoLayerImpl;
24 25
25 class VideoLayerImpl : public LayerImpl 26 class VideoLayerImpl : public LayerImpl
26 , public WebKit::WebVideoFrameProvider::Client { 27 , public WebKit::WebVideoFrameProvider::Client {
27 public: 28 public:
28 static scoped_ptr<VideoLayerImpl> create(int id, WebKit::WebVideoFrameProvid er* provider) 29 typedef base::Callback<media::VideoFrame* (WebKit::WebVideoFrame*)> FrameUnw rapper;
30
31 static scoped_ptr<VideoLayerImpl> create(int id, WebKit::WebVideoFrameProvid er* provider,
32 const FrameUnwrapper& unwrapper)
29 { 33 {
30 return make_scoped_ptr(new VideoLayerImpl(id, provider)); 34 return make_scoped_ptr(new VideoLayerImpl(id, provider, unwrapper));
31 } 35 }
32 virtual ~VideoLayerImpl(); 36 virtual ~VideoLayerImpl();
33 37
34 virtual void willDraw(ResourceProvider*) OVERRIDE; 38 virtual void willDraw(ResourceProvider*) OVERRIDE;
35 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; 39 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
36 virtual void didDraw(ResourceProvider*) OVERRIDE; 40 virtual void didDraw(ResourceProvider*) OVERRIDE;
37 41
38 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; 42 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
39 43
40 // WebKit::WebVideoFrameProvider::Client implementation. 44 // WebKit::WebVideoFrameProvider::Client implementation.
(...skipping 11 matching lines...) Expand all
52 GLenum format; 56 GLenum format;
53 IntSize visibleSize; 57 IntSize visibleSize;
54 58
55 FramePlane() : resourceId(0) { } 59 FramePlane() : resourceId(0) { }
56 60
57 bool allocateData(ResourceProvider*); 61 bool allocateData(ResourceProvider*);
58 void freeData(ResourceProvider*); 62 void freeData(ResourceProvider*);
59 }; 63 };
60 64
61 private: 65 private:
62 VideoLayerImpl(int, WebKit::WebVideoFrameProvider*); 66 VideoLayerImpl(int, WebKit::WebVideoFrameProvider*, const FrameUnwrapper&);
63 67
64 static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned pla ne);
65 virtual const char* layerTypeAsString() const OVERRIDE; 68 virtual const char* layerTypeAsString() const OVERRIDE;
66 69
67 void willDrawInternal(ResourceProvider*); 70 void willDrawInternal(ResourceProvider*);
68 bool allocatePlaneData(ResourceProvider*); 71 bool allocatePlaneData(ResourceProvider*);
69 bool copyPlaneData(ResourceProvider*); 72 bool copyPlaneData(ResourceProvider*);
70 void freePlaneData(ResourceProvider*); 73 void freePlaneData(ResourceProvider*);
71 void freeUnusedPlaneData(ResourceProvider*); 74 void freeUnusedPlaneData(ResourceProvider*);
72 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 FrameUnwrapper m_unwrapper;
83 WebKit::WebVideoFrame *m_webFrame;
84 media::VideoFrame* m_frame;
80 GLenum m_format; 85 GLenum m_format;
86 bool m_emitFrameQuad;
81 ResourceProvider::ResourceId m_externalTextureResource; 87 ResourceProvider::ResourceId m_externalTextureResource;
82 88
83 // Each index in this array corresponds to a plane in WebKit::WebVideoFrame. 89 // Each index in this array corresponds to a plane in media::VideoFrame.
84 FramePlane m_framePlanes[WebKit::WebVideoFrame::maxPlanes]; 90 FramePlane m_framePlanes[media::VideoFrame::kMaxPlanes];
85 }; 91 };
86 92
87 } 93 }
88 94
89 #endif // CCVideoLayerImpl_h 95 #endif // CCVideoLayerImpl_h
OLDNEW
« cc/video_frame_draw_quad.h ('K') | « 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