Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: media/base/video_frame.h

Issue 11016006: Support reading pixels from HW-decoded video textures into canvas/webgl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/base/video_frame.h
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index c40cb239ed4d331d3d1d2f2702c20cdd1b17502d..f34630fa1ff5f0e3cb6b4cdf3c3ab65bd970774e 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -55,19 +55,30 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
static bool IsValidConfig(Format format, const gfx::Size& data_size,
const gfx::Size& natural_size);
+ // CB to write pixels from the texture backing this frame into the
+ // |void*| parameter.
+ typedef base::Callback<void(void*)> ReadPixelsCB;
+
// Wraps a native texture of the given parameters with a VideoFrame. When the
// frame is destroyed |no_longer_needed.Run()| will be called.
// |data_size| is the width and height of the frame data in pixels.
// |natural_size| is the width and height of the frame when the frame's aspect
// ratio is applied to |size|.
+ // |read_pixels_cb| may be used to do (slow!) readbacks from the
+ // texture to main memory.
static scoped_refptr<VideoFrame> WrapNativeTexture(
uint32 texture_id,
uint32 texture_target,
const gfx::Size& data_size,
const gfx::Size& natural_size,
base::TimeDelta timestamp,
+ const ReadPixelsCB& read_pixels_cb,
const base::Closure& no_longer_needed);
+ // Read pixels from the native texture backing |*this| and write
+ // them to |*pixels|.
Ken Russell (switch to Gerrit) 2012/10/01 17:56:16 Document the format of the pixels (i.e., RGBA, in
scherkus (not reviewing) 2012/10/01 18:15:04 +1,000,000 I don't know if our hardware decode pa
Ami GONE FROM CHROMIUM 2012/10/01 18:16:12 Done.
Ami GONE FROM CHROMIUM 2012/10/01 18:40:26 It does not.
scherkus (not reviewing) 2012/10/01 18:52:06 Where "we" == SkCVR? So the best practice for usi
Ami GONE FROM CHROMIUM 2012/10/01 19:26:39 OIC; done.
+ void ReadPixelsFromNativeTexture(void* pixels);
+
// Creates a frame with format equals to VideoFrame::EMPTY, width, height,
// and timestamp are all 0.
static scoped_refptr<VideoFrame> CreateEmptyFrame();
@@ -152,6 +163,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// Native texture ID, if this is a NATIVE_TEXTURE frame.
uint32 texture_id_;
uint32 texture_target_;
+ ReadPixelsCB read_pixels_cb_;
base::Closure texture_no_longer_needed_;
base::TimeDelta timestamp_;

Powered by Google App Engine
This is Rietveld 408576698