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

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: Rebase. 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
« 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 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 16
15 namespace WebKit { 17 namespace WebKit {
16 class WebVideoFrame; 18 class WebVideoFrame;
17 } 19 }
18 20
21 namespace media {
22 class SkCanvasVideoRenderer;
23 }
24
19 namespace cc { 25 namespace cc {
20 26
21 class LayerTreeHostImpl; 27 class LayerTreeHostImpl;
22 class VideoLayerImpl; 28 class VideoLayerImpl;
23 29
24 class VideoLayerImpl : public LayerImpl 30 class VideoLayerImpl : public LayerImpl
25 , public WebKit::WebVideoFrameProvider::Client { 31 , public WebKit::WebVideoFrameProvider::Client {
26 public: 32 public:
27 static scoped_ptr<VideoLayerImpl> create(int id, WebKit::WebVideoFrameProvid er* provider) 33 typedef base::Callback<media::VideoFrame* (WebKit::WebVideoFrame*)> FrameUnw rapper;
34
35 static scoped_ptr<VideoLayerImpl> create(int id, WebKit::WebVideoFrameProvid er* provider,
36 const FrameUnwrapper& unwrapper)
28 { 37 {
29 return make_scoped_ptr(new VideoLayerImpl(id, provider)); 38 return make_scoped_ptr(new VideoLayerImpl(id, provider, unwrapper));
30 } 39 }
31 virtual ~VideoLayerImpl(); 40 virtual ~VideoLayerImpl();
32 41
33 virtual void willDraw(ResourceProvider*) OVERRIDE; 42 virtual void willDraw(ResourceProvider*) OVERRIDE;
34 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; 43 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
35 virtual void didDraw(ResourceProvider*) OVERRIDE; 44 virtual void didDraw(ResourceProvider*) OVERRIDE;
36 45
37 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; 46 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
38 47
39 // WebKit::WebVideoFrameProvider::Client implementation. 48 // WebKit::WebVideoFrameProvider::Client implementation.
(...skipping 11 matching lines...) Expand all
51 GLenum format; 60 GLenum format;
52 IntSize visibleSize; 61 IntSize visibleSize;
53 62
54 FramePlane() : resourceId(0) { } 63 FramePlane() : resourceId(0) { }
55 64
56 bool allocateData(ResourceProvider*); 65 bool allocateData(ResourceProvider*);
57 void freeData(ResourceProvider*); 66 void freeData(ResourceProvider*);
58 }; 67 };
59 68
60 private: 69 private:
61 VideoLayerImpl(int, WebKit::WebVideoFrameProvider*); 70 VideoLayerImpl(int, WebKit::WebVideoFrameProvider*, const FrameUnwrapper&);
62 71
63 static IntSize computeVisibleSize(const WebKit::WebVideoFrame&, unsigned pla ne);
64 virtual const char* layerTypeAsString() const OVERRIDE; 72 virtual const char* layerTypeAsString() const OVERRIDE;
65 73
66 void willDrawInternal(ResourceProvider*); 74 void willDrawInternal(ResourceProvider*);
67 bool allocatePlaneData(ResourceProvider*); 75 bool allocatePlaneData(ResourceProvider*);
68 bool copyPlaneData(ResourceProvider*); 76 bool copyPlaneData(ResourceProvider*);
69 void freePlaneData(ResourceProvider*); 77 void freePlaneData(ResourceProvider*);
70 void freeUnusedPlaneData(ResourceProvider*); 78 void freeUnusedPlaneData(ResourceProvider*);
79 size_t numPlanes() const;
71 80
72 // Guards the destruction of m_provider and the frame that it provides 81 // Guards the destruction of m_provider and the frame that it provides
73 base::Lock m_providerLock; 82 base::Lock m_providerLock;
74 WebKit::WebVideoFrameProvider* m_provider; 83 WebKit::WebVideoFrameProvider* m_provider;
75 84
76 WebKit::WebTransformationMatrix m_streamTextureMatrix; 85 WebKit::WebTransformationMatrix m_streamTextureMatrix;
77 86
78 WebKit::WebVideoFrame* m_frame; 87 FrameUnwrapper m_unwrapper;
88 WebKit::WebVideoFrame *m_webFrame;
89 media::VideoFrame* m_frame;
79 GLenum m_format; 90 GLenum m_format;
91 bool m_convertYUV;
80 ResourceProvider::ResourceId m_externalTextureResource; 92 ResourceProvider::ResourceId m_externalTextureResource;
93 scoped_ptr<media::SkCanvasVideoRenderer> m_videoRenderer;
81 94
82 // Each index in this array corresponds to a plane in WebKit::WebVideoFrame. 95 // Each index in this array corresponds to a plane in media::VideoFrame.
83 FramePlane m_framePlanes[WebKit::WebVideoFrame::maxPlanes]; 96 FramePlane m_framePlanes[media::VideoFrame::kMaxPlanes];
84 }; 97 };
85 98
86 } // namespace cc 99 } // namespace cc
87 100
88 #endif // CCVideoLayerImpl_h 101 #endif // CCVideoLayerImpl_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