diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-18 22:53:05 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-18 22:53:05 +0000 |
commit | 54370ef679aee533c10cf16d504184f4d2825f36 (patch) | |
tree | eba544281e4c2e381152c57e9608c2288dff2d9e /media/base/video_frame.h | |
parent | 43823995b45f01bbf8549cbf195a7aea7cb1227d (diff) | |
download | chromium_src-54370ef679aee533c10cf16d504184f4d2825f36.zip chromium_src-54370ef679aee533c10cf16d504184f4d2825f36.tar.gz chromium_src-54370ef679aee533c10cf16d504184f4d2825f36.tar.bz2 |
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
Diffstat (limited to 'media/base/video_frame.h')
-rw-r--r-- | media/base/video_frame.h | 53 |
1 files changed, 26 insertions, 27 deletions
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<VideoFrame>* frame_out); + static scoped_refptr<VideoFrame> 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<VideoFrame>* frame_out); + static scoped_refptr<VideoFrame> 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<VideoFrame>* frame_out); + static scoped_refptr<VideoFrame> 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<VideoFrame>* frame_out); + static scoped_refptr<VideoFrame> 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<VideoFrame>* frame_out); + static scoped_refptr<VideoFrame> 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_; |