Commit e19f20f7 authored by magjed's avatar magjed Committed by Commit bot

Add ToString function for media::VideoCaptureFormat

BUG=409636

Review URL: https://codereview.chromium.org/532533002

Cr-Commit-Position: refs/heads/master@{#293332}
parent 6eae0395
...@@ -480,13 +480,7 @@ void MediaStreamVideoSource::OnSupportedFormats( ...@@ -480,13 +480,7 @@ void MediaStreamVideoSource::OnSupportedFormats(
} }
state_ = STARTING; state_ = STARTING;
DVLOG(3) << "Starting the capturer with" DVLOG(3) << "Starting the capturer with " << current_format_.ToString();
<< " width = " << current_format_.frame_size.width()
<< " height = " << current_format_.frame_size.height()
<< " frame rate = " << current_format_.frame_rate
<< " pixel format = "
<< media::VideoCaptureFormat::PixelFormatToString(
current_format_.pixel_format);
media::VideoCaptureParams params; media::VideoCaptureParams params;
params.requested_format = current_format_; params.requested_format = current_format_;
......
...@@ -120,10 +120,7 @@ void VideoCaptureDeviceFactoryAndroid::GetDeviceSupportedFormats( ...@@ -120,10 +120,7 @@ void VideoCaptureDeviceFactoryAndroid::GetDeviceSupportedFormats(
format.obj()), format.obj()),
pixel_format); pixel_format);
capture_formats->push_back(capture_format); capture_formats->push_back(capture_format);
DVLOG(1) << device.name() << " resolution: " DVLOG(1) << device.name() << " " << capture_format.ToString();
<< capture_format.frame_size.ToString() << ", fps: "
<< capture_format.frame_rate << ", pixel format: "
<< capture_format.pixel_format;
} }
} }
......
...@@ -175,10 +175,7 @@ void VideoCaptureDeviceFactoryLinux::GetDeviceSupportedFormats( ...@@ -175,10 +175,7 @@ void VideoCaptureDeviceFactoryLinux::GetDeviceSupportedFormats(
break; break;
} }
supported_formats->push_back(supported_format); supported_formats->push_back(supported_format);
DVLOG(1) << device.name() DVLOG(1) << device.name() << " " << supported_format.ToString();
<< " resolution: " << supported_format.frame_size.ToString()
<< ", fps: " << supported_format.frame_rate
<< ", pixel format: " << supported_format.pixel_format;
++frame_interval.index; ++frame_interval.index;
} }
++frame_size.index; ++frame_size.index;
......
...@@ -81,10 +81,7 @@ ...@@ -81,10 +81,7 @@
frameRate.maxFrameRate, frameRate.maxFrameRate,
pixelFormat); pixelFormat);
formats->push_back(format); formats->push_back(format);
DVLOG(2) << name.name() << " resolution: " DVLOG(2) << name.name() << " " << format.ToString();
<< format.frame_size.ToString() << ", fps: "
<< format.frame_rate << ", pixel format: "
<< format.pixel_format;
} }
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "media/video/capture/video_capture_types.h" #include "media/video/capture/video_capture_types.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "media/base/limits.h" #include "media/base/limits.h"
namespace media { namespace media {
...@@ -30,6 +31,15 @@ bool VideoCaptureFormat::IsValid() const { ...@@ -30,6 +31,15 @@ bool VideoCaptureFormat::IsValid() const {
(pixel_format < PIXEL_FORMAT_MAX); (pixel_format < PIXEL_FORMAT_MAX);
} }
#if !defined(NDEBUG)
std::string VideoCaptureFormat::ToString() const {
return base::StringPrintf("resolution: %s, fps: %f, pixel format: %s",
frame_size.ToString().c_str(),
frame_rate,
PixelFormatToString(pixel_format).c_str());
}
#endif
std::string VideoCaptureFormat::PixelFormatToString(VideoPixelFormat format) { std::string VideoCaptureFormat::PixelFormatToString(VideoPixelFormat format) {
switch (format) { switch (format) {
case PIXEL_FORMAT_UNKNOWN: case PIXEL_FORMAT_UNKNOWN:
......
...@@ -46,6 +46,7 @@ class MEDIA_EXPORT VideoCaptureFormat { ...@@ -46,6 +46,7 @@ class MEDIA_EXPORT VideoCaptureFormat {
float frame_rate, float frame_rate,
VideoPixelFormat pixel_format); VideoPixelFormat pixel_format);
std::string ToString() const;
static std::string PixelFormatToString(VideoPixelFormat format); static std::string PixelFormatToString(VideoPixelFormat format);
// Checks that all values are in the expected range. All limits are specified // Checks that all values are in the expected range. All limits are specified
......
...@@ -273,9 +273,7 @@ static void GetDeviceSupportedFormatsDirectShow(const Name& device, ...@@ -273,9 +273,7 @@ static void GetDeviceSupportedFormatsDirectShow(const Name& device,
kSecondsToReferenceTime / static_cast<float>(h->AvgTimePerFrame) : kSecondsToReferenceTime / static_cast<float>(h->AvgTimePerFrame) :
0.0f; 0.0f;
formats->push_back(format); formats->push_back(format);
DVLOG(1) << device.name() << " resolution: " DVLOG(1) << device.name() << " " << format.ToString();
<< format.frame_size.ToString() << ", fps: " << format.frame_rate
<< ", pixel format: " << format.pixel_format;
} }
} }
} }
...@@ -336,10 +334,7 @@ static void GetDeviceSupportedFormatsMediaFoundation( ...@@ -336,10 +334,7 @@ static void GetDeviceSupportedFormatsMediaFoundation(
formats->push_back(capture_format); formats->push_back(capture_format);
++stream_index; ++stream_index;
DVLOG(1) << device.name() << " resolution: " DVLOG(1) << device.name() << " " << capture_format.ToString();
<< capture_format.frame_size.ToString() << ", fps: "
<< capture_format.frame_rate << ", pixel format: "
<< capture_format.pixel_format;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment