summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlionel.g.landwerlin@intel.com <lionel.g.landwerlin@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-24 12:46:40 +0000
committerlionel.g.landwerlin@intel.com <lionel.g.landwerlin@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-24 12:46:40 +0000
commit21a73e99ae6db69d2204d16d9a1e03a54ab98584 (patch)
treeecd047f36ce09b9230725d4626a6de9e12414e78
parent32cbd91afcadca883f5bd70c012866462ea5f66a (diff)
downloadchromium_src-21a73e99ae6db69d2204d16d9a1e03a54ab98584.zip
chromium_src-21a73e99ae6db69d2204d16d9a1e03a54ab98584.tar.gz
chromium_src-21a73e99ae6db69d2204d16d9a1e03a54ab98584.tar.bz2
VideoCaptureFormat: add method to print out pixel format as string
BUG=none TEST=run desktopCapture example (verbose level 3) to see the pixel format Review URL: https://codereview.chromium.org/416553002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285215 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--AUTHORS1
-rw-r--r--content/renderer/media/media_stream_video_source.cc5
-rw-r--r--media/video/capture/video_capture_types.cc30
-rw-r--r--media/video/capture/video_capture_types.h2
4 files changed, 37 insertions, 1 deletions
diff --git a/AUTHORS b/AUTHORS
index c340643..82dc22d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -232,6 +232,7 @@ Lauren Yeun Kim <lauren.yeun.kim@gmail.com>
Lauri Oherd <lauri.oherd@gmail.com>
Leith Bade <leith@leithalweapon.geek.nz>
Li Yin <li.yin@intel.com>
+Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Lorenzo Stoakes <lstoakes@gmail.com>
Lu Guanqun <guanqun.lu@gmail.com>
Lucie Brozkova <lucinka.brozkova@gmail.com>
diff --git a/content/renderer/media/media_stream_video_source.cc b/content/renderer/media/media_stream_video_source.cc
index 7191c27..42c5b1b 100644
--- a/content/renderer/media/media_stream_video_source.cc
+++ b/content/renderer/media/media_stream_video_source.cc
@@ -470,7 +470,10 @@ void MediaStreamVideoSource::OnSupportedFormats(
DVLOG(3) << "Starting the capturer with"
<< " width = " << current_format_.frame_size.width()
<< " height = " << current_format_.frame_size.height()
- << " frame rate = " << current_format_.frame_rate;
+ << " frame rate = " << current_format_.frame_rate
+ << " pixel format = "
+ << media::VideoCaptureFormat::PixelFormatToString(
+ current_format_.pixel_format);
media::VideoCaptureParams params;
params.requested_format = current_format_;
diff --git a/media/video/capture/video_capture_types.cc b/media/video/capture/video_capture_types.cc
index fa78f42..17f2d65 100644
--- a/media/video/capture/video_capture_types.cc
+++ b/media/video/capture/video_capture_types.cc
@@ -4,6 +4,7 @@
#include "media/video/capture/video_capture_types.h"
+#include "base/logging.h"
#include "media/base/limits.h"
namespace media {
@@ -29,6 +30,35 @@ bool VideoCaptureFormat::IsValid() const {
(pixel_format < PIXEL_FORMAT_MAX);
}
+std::string VideoCaptureFormat::PixelFormatToString(VideoPixelFormat format) {
+ switch (format) {
+ case PIXEL_FORMAT_UNKNOWN:
+ return "UNKNOWN";
+ case PIXEL_FORMAT_I420:
+ return "I420";
+ case PIXEL_FORMAT_YUY2:
+ return "YUY2";
+ case PIXEL_FORMAT_UYVY:
+ return "UYUY";
+ case PIXEL_FORMAT_RGB24:
+ return "RGB24";
+ case PIXEL_FORMAT_ARGB:
+ return "ARGB";
+ case PIXEL_FORMAT_MJPEG:
+ return "MJPEG";
+ case PIXEL_FORMAT_NV21:
+ return "YV12";
+ case PIXEL_FORMAT_YV12:
+ return "YV12";
+ case PIXEL_FORMAT_TEXTURE:
+ return "TEXTURE";
+ case PIXEL_FORMAT_MAX:
+ break;
+ }
+ NOTREACHED() << "Invalid VideoPixelFormat provided: " << format;
+ return "";
+}
+
VideoCaptureParams::VideoCaptureParams() : allow_resolution_change(false) {}
} // namespace media
diff --git a/media/video/capture/video_capture_types.h b/media/video/capture/video_capture_types.h
index 5f23a1b..a6a13a8 100644
--- a/media/video/capture/video_capture_types.h
+++ b/media/video/capture/video_capture_types.h
@@ -46,6 +46,8 @@ class MEDIA_EXPORT VideoCaptureFormat {
float frame_rate,
VideoPixelFormat pixel_format);
+ static std::string PixelFormatToString(VideoPixelFormat format);
+
// Checks that all values are in the expected range. All limits are specified
// in media::Limits.
bool IsValid() const;