Index: media/base/video_capture_types.cc |
diff --git a/media/base/video_capture_types.cc b/media/base/video_capture_types.cc |
index 4649e4a697565e0bcf6a604bd3704f6586dfe399..71ecf76a10226d439aaa54bef0273b29157b895b 100644 |
--- a/media/base/video_capture_types.cc |
+++ b/media/base/video_capture_types.cc |
@@ -11,14 +11,27 @@ |
namespace media { |
VideoCaptureFormat::VideoCaptureFormat() |
- : frame_rate(0.0f), pixel_format(PIXEL_FORMAT_UNKNOWN) {} |
+ : frame_rate(0.0f), |
+ pixel_format(PIXEL_FORMAT_UNKNOWN), |
+ pixel_storage(PIXEL_STORAGE_CPU) { |
+} |
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_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) {} |
hubbe
2015/06/18 19:23:11
Maybe DCHECK that TEXTURE is only used with ARGB h
mcasas
2015/06/19 02:58:36
Well right now constructor does not check anything
|
bool VideoCaptureFormat::IsValid() const { |
return (frame_size.width() < media::limits::kMaxDimension) && |
@@ -49,13 +62,9 @@ size_t VideoCaptureFormat::ImageAllocationSize() const { |
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. |
@@ -66,10 +75,11 @@ size_t VideoCaptureFormat::ImageAllocationSize() const { |
} |
std::string VideoCaptureFormat::ToString() const { |
- return base::StringPrintf("resolution: %s, fps: %.3f, pixel format: %s", |
- frame_size.ToString().c_str(), |
- frame_rate, |
- PixelFormatToString(pixel_format).c_str()); |
+ 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()); |
} |
std::string VideoCaptureFormat::PixelFormatToString(VideoPixelFormat format) { |
@@ -96,10 +106,6 @@ std::string VideoCaptureFormat::PixelFormatToString(VideoPixelFormat format) { |
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; |
} |
@@ -107,6 +113,20 @@ std::string VideoCaptureFormat::PixelFormatToString(VideoPixelFormat 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 ""; |
+} |
+ |
VideoCaptureParams::VideoCaptureParams() |
: resolution_change_policy(RESOLUTION_POLICY_FIXED_RESOLUTION) |
#if defined(OS_LINUX) |