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"
14 #include "media/base/video_rotation.h"
21 class VideoFrameProvider
;
22 class VideoFrameProviderClientImpl
;
24 class CC_EXPORT VideoLayerImpl
: public LayerImpl
{
26 static scoped_ptr
<VideoLayerImpl
> Create(LayerTreeImpl
* tree_impl
,
28 VideoFrameProvider
* provider
,
29 media::VideoRotation video_rotation
);
30 virtual ~VideoLayerImpl();
32 // LayerImpl implementation.
33 virtual scoped_ptr
<LayerImpl
> CreateLayerImpl(LayerTreeImpl
* tree_impl
)
35 virtual void PushPropertiesTo(LayerImpl
* layer
) OVERRIDE
;
36 virtual bool WillDraw(DrawMode draw_mode
,
37 ResourceProvider
* resource_provider
) OVERRIDE
;
38 virtual void AppendQuads(RenderPass
* render_pass
,
39 const OcclusionTracker
<LayerImpl
>& occlusion_tracker
,
40 AppendQuadsData
* append_quads_data
) OVERRIDE
;
41 virtual void DidDraw(ResourceProvider
* resource_provider
) OVERRIDE
;
42 virtual void DidBecomeActive() OVERRIDE
;
43 virtual void ReleaseResources() OVERRIDE
;
45 void SetNeedsRedraw();
47 void SetProviderClientImpl(
48 scoped_refptr
<VideoFrameProviderClientImpl
> provider_client_impl
);
50 media::VideoRotation
video_rotation() const { return video_rotation_
; }
53 VideoLayerImpl(LayerTreeImpl
* tree_impl
,
55 media::VideoRotation video_rotation
);
57 virtual const char* LayerTypeAsString() const OVERRIDE
;
59 scoped_refptr
<VideoFrameProviderClientImpl
> provider_client_impl_
;
61 scoped_refptr
<media::VideoFrame
> frame_
;
63 media::VideoRotation video_rotation_
;
65 scoped_ptr
<VideoResourceUpdater
> updater_
;
66 VideoFrameExternalResources::ResourceType frame_resource_type_
;
67 std::vector
<ResourceProvider::ResourceId
> frame_resources_
;
69 // TODO(danakj): Remove these, hide software path inside ResourceProvider and
70 // ExternalResource (aka TextureMailbox) classes.
71 std::vector
<unsigned> software_resources_
;
72 // Called once for each software resource.
73 ReleaseCallback software_release_callback_
;
75 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl
);
80 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_