From 54370ef679aee533c10cf16d504184f4d2825f36 Mon Sep 17 00:00:00 2001 From: "scherkus@chromium.org" Date: Mon, 18 Jul 2011 22:53:05 +0000 Subject: Clean up VideoFrame::CreateXXX and VideoFrame::AllocXXX methods. No need to confuse people with potentially-NULL pointers due to out-of-memory conditions. Review URL: http://codereview.chromium.org/7396007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92917 0039d316-1c4b-4281-b951-d872f2087c98 --- media/base/video_frame.h | 53 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'media/base/video_frame.h') diff --git a/media/base/video_frame.h b/media/base/video_frame.h index ab552895..a694c5f 100644 --- a/media/base/video_frame.h +++ b/media/base/video_frame.h @@ -57,43 +57,42 @@ class VideoFrame : public StreamSample { // Creates a new frame in system memory with given parameters. Buffers for // the frame are allocated but not initialized. - static void CreateFrame(Format format, - size_t width, - size_t height, - base::TimeDelta timestamp, - base::TimeDelta duration, - scoped_refptr* frame_out); + static scoped_refptr CreateFrame( + Format format, + size_t width, + size_t height, + base::TimeDelta timestamp, + base::TimeDelta duration); // Creates a new frame with given parameters. Buffers for the frame are // provided externally. Reference to the buffers and strides are copied // from |data| and |strides| respectively. - static void CreateFrameExternal(SurfaceType type, - Format format, - size_t width, - size_t height, - size_t planes, - uint8* const data[kMaxPlanes], - const int32 strides[kMaxPlanes], - base::TimeDelta timestamp, - base::TimeDelta duration, - void* private_buffer, - scoped_refptr* frame_out); + static scoped_refptr CreateFrameExternal( + SurfaceType type, + Format format, + size_t width, + size_t height, + size_t planes, + uint8* const data[kMaxPlanes], + const int32 strides[kMaxPlanes], + base::TimeDelta timestamp, + base::TimeDelta duration, + void* private_buffer); // Creates a new frame with GL textures. - static void CreateFrameGlTexture(Format format, - size_t width, - size_t height, - GlTexture const textures[kMaxPlanes], - scoped_refptr* frame_out); + static scoped_refptr CreateFrameGlTexture( + Format format, + size_t width, + size_t height, + GlTexture const textures[kMaxPlanes]); // Creates a frame with format equals to VideoFrame::EMPTY, width, height // timestamp and duration are all 0. - static void CreateEmptyFrame(scoped_refptr* frame_out); + static scoped_refptr CreateEmptyFrame(); // Allocates YV12 frame based on |width| and |height|, and sets its data to // the YUV equivalent of RGB(0,0,0). - static void CreateBlackFrame(int width, int height, - scoped_refptr* frame_out); + static scoped_refptr CreateBlackFrame(int width, int height); SurfaceType type() const { return type_; } @@ -130,8 +129,8 @@ class VideoFrame : public StreamSample { virtual ~VideoFrame(); // Used internally by CreateFrame(). - bool AllocateRGB(size_t bytes_per_pixel); - bool AllocateYUV(); + void AllocateRGB(size_t bytes_per_pixel); + void AllocateYUV(); // Frame format. Format format_; -- cgit v1.1