summaryrefslogtreecommitdiffstats
path: root/cc/layers/video_frame_provider.h
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-18 09:05:52 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-18 09:05:52 +0000
commitcc3cfaa706818aee30e0a766f3d4ffe90301ae33 (patch)
tree88d184f795b3790c45c2806306fd5d22d91f6b04 /cc/layers/video_frame_provider.h
parent97ebdbacab06587dd1c8fbdd5cc52f58db5042ab (diff)
downloadchromium_src-cc3cfaa706818aee30e0a766f3d4ffe90301ae33.zip
chromium_src-cc3cfaa706818aee30e0a766f3d4ffe90301ae33.tar.gz
chromium_src-cc3cfaa706818aee30e0a766f3d4ffe90301ae33.tar.bz2
Part 10 of cc/ directory shuffles: layers
Continuation of https://src.chromium.org/viewvc/chrome?view=rev&revision=188681 BUG=190824 TBR=enne@chromium.org, piman@chromium.org, jschuh@chromium.org, joth@chromium.org Review URL: https://codereview.chromium.org/12916002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/video_frame_provider.h')
-rw-r--r--cc/layers/video_frame_provider.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/cc/layers/video_frame_provider.h b/cc/layers/video_frame_provider.h
new file mode 100644
index 0000000..ecf0024
--- /dev/null
+++ b/cc/layers/video_frame_provider.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_LAYERS_VIDEO_FRAME_PROVIDER_H_
+#define CC_LAYERS_VIDEO_FRAME_PROVIDER_H_
+
+#include "base/memory/ref_counted.h"
+
+namespace media {
+class VideoFrame;
+}
+
+namespace cc {
+
+// Threading notes: This class may be used in a multi threaded manner.
+// Specifically, the implementation may call getCurrentFrame() or
+// putCurrentFrame() from the compositor thread. If so, the caller is
+// responsible for making sure Client::didReceiveFrame and
+// Client::didUpdateMatrix are only called from this same thread.
+class VideoFrameProvider {
+ public:
+ virtual ~VideoFrameProvider() {}
+
+ class Client {
+ public:
+ // Provider will call this method to tell the client to stop using it.
+ // StopUsingProvider() may be called from any thread. The client should
+ // block until it has PutCurrentFrame() any outstanding frames.
+ virtual void StopUsingProvider() = 0;
+
+ // Notifies the provider's client that a call to GetCurrentFrame() will
+ // return new data.
+ virtual void DidReceiveFrame() = 0;
+
+ // Notifies the provider's client of a new UV transform matrix to be used.
+ virtual void DidUpdateMatrix(const float* matrix) = 0;
+ };
+
+ // May be called from any thread, but there must be some external guarantee
+ // that the provider is not destroyed before this call returns.
+ virtual void SetVideoFrameProviderClient(Client* client) = 0;
+
+ // This function places a lock on the current frame and returns a pointer to
+ // it. Calls to this method should always be followed with a call to
+ // PutCurrentFrame().
+ // Only the current provider client should call this function.
+ virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() = 0;
+
+ // This function releases the lock on the video frame. It should always be
+ // called after GetCurrentFrame(). Frames passed into this method
+ // should no longer be referenced after the call is made. Only the current
+ // provider client should call this function.
+ virtual void PutCurrentFrame(
+ const scoped_refptr<media::VideoFrame>& frame) = 0;
+};
+
+} // namespace cc
+
+#endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_H_