diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-01 22:09:41 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-01 22:09:41 +0000 |
commit | 2f0a766ff8b57f567b96b7dc56b02ca6e14159f1 (patch) | |
tree | a2e14af86818a334c8795ab663e061a697761d97 /media/base/video_frame.h | |
parent | e879a720fff106e1a29622544557a1a8496e929c (diff) | |
download | chromium_src-2f0a766ff8b57f567b96b7dc56b02ca6e14159f1.zip chromium_src-2f0a766ff8b57f567b96b7dc56b02ca6e14159f1.tar.gz chromium_src-2f0a766ff8b57f567b96b7dc56b02ca6e14159f1.tar.bz2 |
Support reading pixels from HW-decoded video textures into canvas/webgl.
BUG=153094
Review URL: https://chromiumcodereview.appspot.com/11016006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159571 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/video_frame.h')
-rw-r--r-- | media/base/video_frame.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/media/base/video_frame.h b/media/base/video_frame.h index c40cb23..9d16d2c 100644 --- a/media/base/video_frame.h +++ b/media/base/video_frame.h @@ -55,19 +55,31 @@ 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| as RGBA. |pixels| must point to a buffer at + // least as large as 4*data_size().width()*data_size().height(). + 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 +164,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_; |