Use multiline attribute to check for IA2_STATE_MULTILINE.
[chromium-blink-merge.git] / cc / layers / video_frame_provider.h
blob45e6c4110c5364ec5deb36e2e1a7504fcbbf007d
1 // Copyright (c) 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_FRAME_PROVIDER_H_
6 #define CC_LAYERS_VIDEO_FRAME_PROVIDER_H_
8 #include "base/memory/ref_counted.h"
9 #include "cc/base/cc_export.h"
11 namespace media {
12 class VideoFrame;
15 namespace cc {
17 // Threading notes: This class may be used in a multi threaded manner.
18 // Specifically, the implementation may call GetCurrentFrame() or
19 // PutCurrentFrame() from the compositor thread. If so, the caller is
20 // responsible for making sure Client::DidReceiveFrame() and
21 // Client::DidUpdateMatrix() are only called from this same thread.
22 class CC_EXPORT VideoFrameProvider {
23 public:
24 virtual ~VideoFrameProvider() {}
26 class CC_EXPORT Client {
27 public:
28 // Provider will call this method to tell the client to stop using it.
29 // StopUsingProvider() may be called from any thread. The client should
30 // block until it has PutCurrentFrame() any outstanding frames.
31 virtual void StopUsingProvider() = 0;
33 // Notifies the provider's client that a call to GetCurrentFrame() will
34 // return new data.
35 virtual void DidReceiveFrame() = 0;
37 // Notifies the provider's client of a new UV transform matrix to be used.
38 virtual void DidUpdateMatrix(const float* matrix) = 0;
40 protected:
41 virtual ~Client() {}
44 // May be called from any thread, but there must be some external guarantee
45 // that the provider is not destroyed before this call returns.
46 virtual void SetVideoFrameProviderClient(Client* client) = 0;
48 // This function places a lock on the current frame and returns a pointer to
49 // it. Calls to this method should always be followed with a call to
50 // PutCurrentFrame().
51 // Only the current provider client should call this function.
52 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() = 0;
54 // This function releases the lock on the video frame. It should always be
55 // called after GetCurrentFrame(). Frames passed into this method
56 // should no longer be referenced after the call is made. Only the current
57 // provider client should call this function.
58 virtual void PutCurrentFrame(
59 const scoped_refptr<media::VideoFrame>& frame) = 0;
62 } // namespace cc
64 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_H_