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 "base/macros.h"
11 #include "cc/cc_export.h"
12 #include "cc/layers/layer_impl.h"
13 #include "cc/resources/video_resource_updater.h"
14 #include "components/viz/common/resources/release_callback.h"
15 #include "media/base/video_rotation.h"
22 class VideoFrameProvider;
23 class VideoFrameProviderClientImpl;
25 class CC_EXPORT VideoLayerImpl : public LayerImpl {
27 // Must be called on the impl thread while the main thread is blocked. This is
28 // so that |provider| stays alive while this is being created.
29 static std::unique_ptr<VideoLayerImpl> Create(
30 LayerTreeImpl* tree_impl,
32 VideoFrameProvider* provider,
33 media::VideoRotation video_rotation);
34 ~VideoLayerImpl() override;
36 // LayerImpl implementation.
37 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
38 bool WillDraw(DrawMode draw_mode,
39 LayerTreeResourceProvider* resource_provider) override;
40 void AppendQuads(viz::RenderPass* render_pass,
41 AppendQuadsData* append_quads_data) override;
42 void DidDraw(LayerTreeResourceProvider* resource_provider) override;
43 SimpleEnclosedRegion VisibleOpaqueRegion() const override;
44 void DidBecomeActive() override;
45 void ReleaseResources() override;
47 void SetNeedsRedraw();
48 media::VideoRotation video_rotation() const { return video_rotation_; }
52 LayerTreeImpl* tree_impl,
54 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl,
55 media::VideoRotation video_rotation);
57 const char* LayerTypeAsString() const override;
59 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl_;
61 scoped_refptr<media::VideoFrame> frame_;
63 media::VideoRotation video_rotation_;
65 std::unique_ptr<VideoResourceUpdater> updater_;
67 DISALLOW_COPY_AND_ASSIGN(VideoLayerImpl);
72 #endif // CC_LAYERS_VIDEO_LAYER_IMPL_H_