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