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 3 // found in the LICENSE file. 4 5 #ifndef CC_LAYERS_VIDEO_LAYER_IMPL_H_ 6 #define CC_LAYERS_VIDEO_LAYER_IMPL_H_ 7 8 #include <vector> 9 10 #include "cc/base/cc_export.h" 11 #include "cc/layers/layer_impl.h" 12 #include "cc/resources/release_callback.h" 13 #include "cc/resources/video_resource_updater.h" 14 15 namespace media { 16 class VideoFrame; 17 } 18 19 namespace cc { 20 class VideoFrameProvider; 21 class VideoFrameProviderClientImpl; 22 23 class CC_EXPORT VideoLayerImpl : public LayerImpl { 24 public: 25 static scoped_ptr<VideoLayerImpl> Create(LayerTreeImpl* tree_impl, 26 int id, 27 VideoFrameProvider* provider); 28 virtual ~VideoLayerImpl(); 29 30 // LayerImpl implementation. 31 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) 32 OVERRIDE; 33 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; 34 virtual bool WillDraw(DrawMode draw_mode, 35 ResourceProvider* resource_provider) OVERRIDE; 36 virtual void AppendQuads(QuadSink* quad_sink, 37 AppendQuadsData* append_quads_data) OVERRIDE; 38 virtual void DidDraw(ResourceProvider* resource_provider) OVERRIDE; 39 virtual void DidBecomeActive() OVERRIDE; 40 virtual void DidLoseOutputSurface() OVERRIDE; 41 42 void SetNeedsRedraw(); 43 44 void SetProviderClientImpl( 45 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl); 46 47 private: 48 VideoLayerImpl(LayerTreeImpl* tree_impl, int id); 49 50 virtual const char* LayerTypeAsString() const OVERRIDE; 51 52 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_; 53 54 scoped_refptr<media::VideoFrame> frame_; 55 56 scoped_ptr<VideoResourceUpdater> updater_; 57 VideoFrameExternalResources::ResourceType frame_resource_type_; 58 std::vector<ResourceProvider::ResourceId> frame_resources_; 59 60 // TODO(danakj): Remove these, hide software path inside ResourceProvider and 61 // ExternalResource (aka TextureMailbox) classes. 62 std::vector<unsigned> software_resources_; 63 // Called once for each software resource. 64 ReleaseCallback software_release_callback_; 65 66 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl); 67 }; 68 69 } // namespace cc 70 71 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_ 72