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.
5 #ifndef CC_LAYERS_VIDEO_LAYER_IMPL_H_
6 #define CC_LAYERS_VIDEO_LAYER_IMPL_H_
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"
20 class VideoFrameProvider
;
21 class VideoFrameProviderClientImpl
;
23 class CC_EXPORT VideoLayerImpl
: public LayerImpl
{
25 static scoped_ptr
<VideoLayerImpl
> Create(LayerTreeImpl
* tree_impl
,
27 VideoFrameProvider
* provider
);
28 virtual ~VideoLayerImpl();
30 // LayerImpl implementation.
31 virtual scoped_ptr
<LayerImpl
> CreateLayerImpl(LayerTreeImpl
* tree_impl
)
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
;
42 void SetNeedsRedraw();
44 void SetProviderClientImpl(
45 scoped_refptr
<VideoFrameProviderClientImpl
> provider_client_impl
);
48 VideoLayerImpl(LayerTreeImpl
* tree_impl
, int id
);
50 virtual const char* LayerTypeAsString() const OVERRIDE
;
52 scoped_refptr
<VideoFrameProviderClientImpl
> provider_client_impl_
;
54 scoped_refptr
<media::VideoFrame
> frame_
;
56 scoped_ptr
<VideoResourceUpdater
> updater_
;
57 VideoFrameExternalResources::ResourceType frame_resource_type_
;
58 std::vector
<ResourceProvider::ResourceId
> frame_resources_
;
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_
;
66 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl
);
71 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_