diff options
author | emircan <emircan@chromium.org> | 2015-09-01 12:45:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-01 19:46:15 +0000 |
commit | 65af59bb1cc5578cd9fb4e4fe7fba0a834f34f35 (patch) | |
tree | dc0918bac922b87e14371700fc3d279c0fa508dc /media/base/video_frame.cc | |
parent | 4252ddfd1fe465add350d2c6cd2d2a15df241d35 (diff) | |
download | chromium_src-65af59bb1cc5578cd9fb4e4fe7fba0a834f34f35.zip chromium_src-65af59bb1cc5578cd9fb4e4fe7fba0a834f34f35.tar.gz chromium_src-65af59bb1cc5578cd9fb4e4fe7fba0a834f34f35.tar.bz2 |
Merge media::VideoCapturePixelFormat with media::VideoPixelFormat
This CL merges these 2 enums that overlap and represent pixel formats.
- Moved types that do not exist to media::VideoPixelFormat
- Updated histograms.xml for UMA values
- Updated media_types.mojom for matching mojo enums
- Added kWinSupportedCaptureFormats to capability_list_win.cc such that we are no longer dependant on the order of media::VideoCapturePixelFormat for choosing the preferred type.
BUG=521068, 504160
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1301133002
Cr-Commit-Position: refs/heads/master@{#346711}
Diffstat (limited to 'media/base/video_frame.cc')
-rw-r--r-- | media/base/video_frame.cc | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc index 662d6aa..2009664 100644 --- a/media/base/video_frame.cc +++ b/media/base/video_frame.cc @@ -87,12 +87,17 @@ static gfx::Size SampleSize(VideoPixelFormat format, size_t plane) { case PIXEL_FORMAT_I420: case PIXEL_FORMAT_YV12A: case PIXEL_FORMAT_NV12: + case PIXEL_FORMAT_NV21: return gfx::Size(2, 2); case PIXEL_FORMAT_UNKNOWN: + case PIXEL_FORMAT_UYVY: + case PIXEL_FORMAT_YUY2: case PIXEL_FORMAT_ARGB: case PIXEL_FORMAT_XRGB: - case PIXEL_FORMAT_UYVY: + case PIXEL_FORMAT_RGB24: + case PIXEL_FORMAT_RGB32: + case PIXEL_FORMAT_MJPEG: break; } } @@ -119,10 +124,15 @@ static int BytesPerElement(VideoPixelFormat format, size_t plane) { switch (format) { case PIXEL_FORMAT_ARGB: case PIXEL_FORMAT_XRGB: + case PIXEL_FORMAT_RGB32: return 4; + case PIXEL_FORMAT_RGB24: + return 3; case PIXEL_FORMAT_UYVY: + case PIXEL_FORMAT_YUY2: return 2; - case PIXEL_FORMAT_NV12: { + case PIXEL_FORMAT_NV12: + case PIXEL_FORMAT_NV21: { static const int bytes_per_element[] = {1, 2}; DCHECK_LT(plane, arraysize(bytes_per_element)); return bytes_per_element[plane]; @@ -133,6 +143,8 @@ static int BytesPerElement(VideoPixelFormat format, size_t plane) { case PIXEL_FORMAT_YV12A: case PIXEL_FORMAT_YV24: return 1; + case PIXEL_FORMAT_MJPEG: + return 0; case PIXEL_FORMAT_UNKNOWN: break; } @@ -164,7 +176,7 @@ bool VideoFrame::IsValidConfig(VideoPixelFormat format, return true; // Make sure new formats are properly accounted for in the method. - static_assert(PIXEL_FORMAT_MAX == 9, + static_assert(PIXEL_FORMAT_MAX == 14, "Added pixel format, please review IsValidConfig()"); if (format == PIXEL_FORMAT_UNKNOWN) { @@ -519,15 +531,20 @@ scoped_refptr<VideoFrame> VideoFrame::CreateHoleFrame( // static size_t VideoFrame::NumPlanes(VideoPixelFormat format) { switch (format) { + case PIXEL_FORMAT_UYVY: + case PIXEL_FORMAT_YUY2: case PIXEL_FORMAT_ARGB: case PIXEL_FORMAT_XRGB: - case PIXEL_FORMAT_UYVY: + case PIXEL_FORMAT_RGB24: + case PIXEL_FORMAT_RGB32: + case PIXEL_FORMAT_MJPEG: return 1; case PIXEL_FORMAT_NV12: + case PIXEL_FORMAT_NV21: return 2; + case PIXEL_FORMAT_I420: case PIXEL_FORMAT_YV12: case PIXEL_FORMAT_YV16: - case PIXEL_FORMAT_I420: case PIXEL_FORMAT_YV24: return 3; case PIXEL_FORMAT_YV12A: |