diff options
author | sheu@chromium.org <sheu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-07 05:33:54 +0000 |
---|---|---|
committer | sheu@chromium.org <sheu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-07 05:33:54 +0000 |
commit | 2fcdbff277ebd2c81ac25a4e0512728f0e77b4b9 (patch) | |
tree | ce80394cbf2f85411f19911805a54cc3c9e430b6 /media | |
parent | 8a19b5acd2bcc8e1e11643786d8ac830867ef3f5 (diff) | |
download | chromium_src-2fcdbff277ebd2c81ac25a4e0512728f0e77b4b9.zip chromium_src-2fcdbff277ebd2c81ac25a4e0512728f0e77b4b9.tar.gz chromium_src-2fcdbff277ebd2c81ac25a4e0512728f0e77b4b9.tar.bz2 |
Make NumPlanes() a member of media::VideoFrame
Since plane count is a property of media::VideoFrame::Format, it should
live where the format is defined.
BUG=chromium:167417
BUG=chromium-os:38376
TEST=local build and run on CrOS, desktop linux
Change-Id: I7cddc73ee84f6746568ce71a7f9f252489634d3a
Review URL: https://chromiumcodereview.appspot.com/12517002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186628 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/base/video_frame.cc | 49 | ||||
-rw-r--r-- | media/base/video_frame.h | 2 |
2 files changed, 32 insertions, 19 deletions
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc index b5330bd..70b77fb 100644 --- a/media/base/video_frame.cc +++ b/media/base/video_frame.cc @@ -136,6 +136,13 @@ scoped_refptr<VideoFrame> VideoFrame::CreateBlackFrame(const gfx::Size& size) { } #if defined(GOOGLE_TV) +// This block and other blocks wrapped around #if defined(GOOGLE_TV) is not +// maintained by the general compositor team. Please contact the following +// people instead: +// +// wonsik@chromium.org +// ycheo@chromium.org + // static scoped_refptr<VideoFrame> VideoFrame::CreateHoleFrame( const gfx::Size& size) { @@ -146,6 +153,28 @@ scoped_refptr<VideoFrame> VideoFrame::CreateHoleFrame( } #endif +// static +size_t VideoFrame::NumPlanes(Format format) { + switch (format) { + case VideoFrame::NATIVE_TEXTURE: +#if defined(GOOGLE_TV) + case VideoFrame::HOLE: +#endif + return 0; + case VideoFrame::RGB32: + return 1; + case VideoFrame::YV12: + case VideoFrame::YV16: + return 3; + case VideoFrame::EMPTY: + case VideoFrame::I420: + case VideoFrame::INVALID: + break; + } + NOTREACHED() << "Unsupported video frame format: " << format; + return 0; +} + static inline size_t RoundUp(size_t value, size_t alignment) { // Check that |alignment| is a power of 2. DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); @@ -236,25 +265,7 @@ VideoFrame::~VideoFrame() { } bool VideoFrame::IsValidPlane(size_t plane) const { - switch (format_) { - case RGB32: - return plane == kRGBPlane; - - case YV12: - case YV16: - return plane == kYPlane || plane == kUPlane || plane == kVPlane; - - case NATIVE_TEXTURE: - NOTREACHED() << "NATIVE_TEXTUREs don't use plane-related methods!"; - return false; - - default: - break; - } - - // Intentionally leave out non-production formats. - NOTREACHED() << "Unsupported video frame format: " << format_; - return false; + return (plane < NumPlanes(format_)); } int VideoFrame::stride(size_t plane) const { diff --git a/media/base/video_frame.h b/media/base/video_frame.h index 07697c2..9a259b4 100644 --- a/media/base/video_frame.h +++ b/media/base/video_frame.h @@ -133,6 +133,8 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { static scoped_refptr<VideoFrame> CreateHoleFrame(const gfx::Size& size); #endif + static size_t NumPlanes(Format format); + Format format() const { return format_; } const gfx::Size& coded_size() const { return coded_size_; } |