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

Side by Side Diff: cc/layers/video_layer_impl.h

Issue 13445009: cc: Move video upload to VideoResourceUpdater. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: consume textures that were produced Created 7 years, 8 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/layers/video_frame_provider_client_impl.cc ('k') | cc/layers/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_LAYERS_VIDEO_LAYER_IMPL_H_ 5 #ifndef CC_LAYERS_VIDEO_LAYER_IMPL_H_
6 #define CC_LAYERS_VIDEO_LAYER_IMPL_H_ 6 #define CC_LAYERS_VIDEO_LAYER_IMPL_H_
7 7
8 #include "base/callback.h"
9 #include "base/synchronization/lock.h"
10 #include "cc/base/cc_export.h" 8 #include "cc/base/cc_export.h"
11 #include "cc/layers/layer_impl.h" 9 #include "cc/layers/layer_impl.h"
12 #include "cc/layers/video_frame_provider.h" 10 #include "cc/resources/video_resource_updater.h"
13 #include "media/base/video_frame.h"
14 #include "third_party/khronos/GLES2/gl2.h"
15 #include "ui/gfx/size.h"
16 #include "ui/gfx/transform.h"
17 11
18 namespace media { 12 namespace media {
19 class SkCanvasVideoRenderer; 13 class VideoFrame;
20 } 14 }
21 15
22 namespace cc { 16 namespace cc {
23 class LayerTreeHostImpl; 17 class VideoFrameProvider;
24 class VideoFrameProviderClientImpl; 18 class VideoFrameProviderClientImpl;
25 19
26 class CC_EXPORT VideoLayerImpl : public LayerImpl { 20 class CC_EXPORT VideoLayerImpl : public LayerImpl {
27 public: 21 public:
28 static scoped_ptr<VideoLayerImpl> Create(LayerTreeImpl* tree_impl, 22 static scoped_ptr<VideoLayerImpl> Create(LayerTreeImpl* tree_impl,
29 int id, 23 int id,
30 VideoFrameProvider* provider); 24 VideoFrameProvider* provider);
31 virtual ~VideoLayerImpl(); 25 virtual ~VideoLayerImpl();
32 26
33 // LayerImpl implementation. 27 // LayerImpl implementation.
34 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) 28 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
35 OVERRIDE; 29 OVERRIDE;
36 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; 30 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
37 virtual void WillDraw(ResourceProvider* resource_provider) OVERRIDE; 31 virtual void WillDraw(ResourceProvider* resource_provider) OVERRIDE;
38 virtual void AppendQuads(QuadSink* quad_sink, 32 virtual void AppendQuads(QuadSink* quad_sink,
39 AppendQuadsData* append_quads_data) OVERRIDE; 33 AppendQuadsData* append_quads_data) OVERRIDE;
40 virtual void DidDraw(ResourceProvider* resource_provider) OVERRIDE; 34 virtual void DidDraw(ResourceProvider* resource_provider) OVERRIDE;
41 virtual void DidBecomeActive() OVERRIDE; 35 virtual void DidBecomeActive() OVERRIDE;
42 virtual void DidLoseOutputSurface() OVERRIDE; 36 virtual void DidLoseOutputSurface() OVERRIDE;
43 37
44 void SetNeedsRedraw(); 38 void SetNeedsRedraw();
45 39
46 void SetProviderClientImpl( 40 void SetProviderClientImpl(
47 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl); 41 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl);
48 42
49 struct FramePlane {
50 ResourceProvider::ResourceId resource_id;
51 gfx::Size size;
52 GLenum format;
53
54 FramePlane() : resource_id(0), format(GL_LUMINANCE) {}
55
56 bool AllocateData(ResourceProvider* resource_provider);
57 void FreeData(ResourceProvider* resource_provider);
58 };
59
60 private: 43 private:
61 VideoLayerImpl(LayerTreeImpl* tree_impl, int id); 44 VideoLayerImpl(LayerTreeImpl* tree_impl, int id);
62 45
63 virtual const char* LayerTypeAsString() const OVERRIDE; 46 virtual const char* LayerTypeAsString() const OVERRIDE;
64 47
65 void WillDrawInternal(ResourceProvider* resource_provider);
66 bool SetupFramePlanes(ResourceProvider* resource_provider);
67 void FreeFramePlanes(ResourceProvider* resource_provider);
68 void FreeUnusedFramePlanes(ResourceProvider* resource_provider);
69
70 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_; 48 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_;
71 49
72 scoped_refptr<media::VideoFrame> frame_; 50 scoped_refptr<media::VideoFrame> frame_;
73 media::VideoFrame::Format format_;
74 bool convert_yuv_;
75 ResourceProvider::ResourceId external_texture_resource_;
76 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_;
77 51
78 // Each index in this array corresponds to a plane in media::VideoFrame. 52 scoped_ptr<VideoResourceUpdater> updater_;
79 FramePlane frame_planes_[media::VideoFrame::kMaxPlanes]; 53 VideoFrameExternalResources::ResourceType frame_resource_type_;
54 std::vector<ResourceProvider::ResourceId> frame_resources_;
55
56 // TODO(danakj): Remove these, hide software path inside ResourceProvider and
57 // ExternalResource (aka TextureMailbox) classes.
58 std::vector<unsigned> software_resources_;
59 TextureMailbox::ReleaseCallback software_release_callback_;
80 60
81 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl); 61 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl);
82 }; 62 };
83 63
84 } // namespace cc 64 } // namespace cc
85 65
86 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_ 66 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/layers/video_frame_provider_client_impl.cc ('k') | cc/layers/video_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698