Index: media/base/video_capture_types.cc |
diff --git a/media/base/video_capture_types.cc b/media/base/video_capture_types.cc |
index 6b811c9211d3d717a7e914257e6c6ccd772e05e2..4649e4a697565e0bcf6a604bd3704f6586dfe399 100644 |
--- a/media/base/video_capture_types.cc |
+++ b/media/base/video_capture_types.cc |
@@ -11,27 +11,14 @@ |
namespace media { |
VideoCaptureFormat::VideoCaptureFormat() |
- : frame_rate(0.0f), |
- pixel_format(PIXEL_FORMAT_UNKNOWN), |
- pixel_storage(PIXEL_STORAGE_CPU) { |
-} |
+ : frame_rate(0.0f), pixel_format(PIXEL_FORMAT_UNKNOWN) {} |
VideoCaptureFormat::VideoCaptureFormat(const gfx::Size& frame_size, |
float frame_rate, |
VideoPixelFormat pixel_format) |
: frame_size(frame_size), |
frame_rate(frame_rate), |
- pixel_format(pixel_format), |
- pixel_storage(PIXEL_STORAGE_CPU) {} |
- |
-VideoCaptureFormat::VideoCaptureFormat(const gfx::Size& frame_size, |
- float frame_rate, |
- VideoPixelFormat pixel_format, |
- VideoPixelStorage pixel_storage) |
- : frame_size(frame_size), |
- frame_rate(frame_rate), |
- pixel_format(pixel_format), |
- pixel_storage(pixel_storage) {} |
+ pixel_format(pixel_format) {} |
bool VideoCaptureFormat::IsValid() const { |
return (frame_size.width() < media::limits::kMaxDimension) && |
@@ -40,9 +27,8 @@ |
(frame_size.GetArea() < media::limits::kMaxCanvas) && |
(frame_rate >= 0.0f) && |
(frame_rate < media::limits::kMaxFramesPerSecond) && |
- (pixel_format >= 0) && (pixel_format < PIXEL_FORMAT_MAX) && |
- (pixel_storage != PIXEL_STORAGE_TEXTURE || |
- pixel_format == PIXEL_FORMAT_ARGB); |
+ (pixel_format >= 0) && |
+ (pixel_format < PIXEL_FORMAT_MAX); |
} |
size_t VideoCaptureFormat::ImageAllocationSize() const { |
@@ -63,9 +49,13 @@ |
break; |
case PIXEL_FORMAT_RGB32: |
case PIXEL_FORMAT_ARGB: |
+ // GpuMemoryBuffer is an endianness-agnostic 32bpp pixel format until |
+ // http://crbug.com/439520 is closed. |
+ case PIXEL_FORMAT_GPUMEMORYBUFFER: |
result_frame_size *= 4; |
break; |
case PIXEL_FORMAT_MJPEG: |
+ case PIXEL_FORMAT_TEXTURE: |
result_frame_size = 0; |
break; |
default: // Sizes for the rest of the formats are unknown. |
@@ -76,11 +66,10 @@ |
} |
std::string VideoCaptureFormat::ToString() const { |
- return base::StringPrintf( |
- "(%s)@%.3ffps, pixel format: %s storage: %s.", |
- frame_size.ToString().c_str(), frame_rate, |
- PixelFormatToString(pixel_format).c_str(), |
- PixelStorageToString(pixel_storage).c_str()); |
+ return base::StringPrintf("resolution: %s, fps: %.3f, pixel format: %s", |
+ frame_size.ToString().c_str(), |
+ frame_rate, |
+ PixelFormatToString(pixel_format).c_str()); |
} |
std::string VideoCaptureFormat::PixelFormatToString(VideoPixelFormat format) { |
@@ -107,24 +96,14 @@ |
return "NV21"; |
case PIXEL_FORMAT_YV12: |
return "YV12"; |
+ case PIXEL_FORMAT_TEXTURE: |
+ return "TEXTURE"; |
+ case PIXEL_FORMAT_GPUMEMORYBUFFER: |
+ return "GPUMEMORYBUFFER"; |
case PIXEL_FORMAT_MAX: |
break; |
} |
NOTREACHED() << "Invalid VideoPixelFormat provided: " << format; |
- return ""; |
-} |
- |
-std::string VideoCaptureFormat::PixelStorageToString( |
- VideoPixelStorage storage) { |
- switch (storage) { |
- case PIXEL_STORAGE_CPU: |
- return "CPU"; |
- case PIXEL_STORAGE_TEXTURE: |
- return "TEXTURE"; |
- case PIXEL_STORAGE_GPUMEMORYBUFFER: |
- return "GPUMEMORYBUFFER"; |
- } |
- NOTREACHED() << "Invalid VideoPixelStorage provided: " << storage; |
return ""; |
} |