Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Unified Diff: media/video/capture/linux/video_capture_device_linux.cc

Issue 83633008: Reland: Reorganize media::VideoCapture* types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/video/capture/linux/video_capture_device_linux.cc
diff --git a/media/video/capture/linux/video_capture_device_linux.cc b/media/video/capture/linux/video_capture_device_linux.cc
index 66aecff74351bf0f29e135e01be5212e833048e3..194696127242c0952c3ac81421e1cb9020ae7dbe 100644
--- a/media/video/capture/linux/video_capture_device_linux.cc
+++ b/media/video/capture/linux/video_capture_device_linux.cc
@@ -159,22 +159,25 @@ void VideoCaptureDevice::GetDeviceSupportedFormats(
formats->clear();
- VideoCaptureCapability capture_format;
+ VideoCaptureCapability capture_capability;
// Retrieve the caps one by one, first get colorspace, then sizes, then
// framerates. See http://linuxtv.org/downloads/v4l-dvb-apis for reference.
v4l2_fmtdesc pixel_format = {};
pixel_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
while (ioctl(fd, VIDIOC_ENUM_FMT, &pixel_format) == 0) {
- capture_format.color =
+ capture_capability.supported_format.pixel_format =
V4l2ColorToVideoCaptureColorFormat((int32)pixel_format.pixelformat);
- if (capture_format.color == PIXEL_FORMAT_UNKNOWN) continue;
+ if (capture_capability.supported_format.pixel_format ==
+ PIXEL_FORMAT_UNKNOWN) {
+ continue;
+ }
v4l2_frmsizeenum frame_size = {};
frame_size.pixel_format = pixel_format.pixelformat;
while (ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frame_size) == 0) {
if (frame_size.type == V4L2_FRMSIZE_TYPE_DISCRETE) {
- capture_format.width = frame_size.discrete.width;
- capture_format.height = frame_size.discrete.height;
+ capture_capability.supported_format.frame_size.SetSize(
+ frame_size.discrete.width, frame_size.discrete.height);
} else if (frame_size.type == V4L2_FRMSIZE_TYPE_STEPWISE) {
// TODO(mcasas): see http://crbug.com/249953, support these devices.
NOTIMPLEMENTED();
@@ -189,11 +192,11 @@ void VideoCaptureDevice::GetDeviceSupportedFormats(
while (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &frame_interval) == 0) {
if (frame_interval.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
if (frame_interval.discrete.numerator != 0) {
- capture_format.frame_rate =
+ capture_capability.supported_format.frame_rate =
static_cast<float>(frame_interval.discrete.denominator) /
static_cast<float>(frame_interval.discrete.numerator);
} else {
- capture_format.frame_rate = 0;
+ capture_capability.supported_format.frame_rate = 0;
}
} else if (frame_interval.type == V4L2_FRMIVAL_TYPE_CONTINUOUS) {
// TODO(mcasas): see http://crbug.com/249953, support these devices.
@@ -204,7 +207,7 @@ void VideoCaptureDevice::GetDeviceSupportedFormats(
NOTIMPLEMENTED();
break;
}
- formats->push_back(capture_format);
+ formats->push_back(capture_capability);
++frame_interval.index;
}
++frame_size.index;
@@ -291,7 +294,7 @@ VideoCaptureDeviceLinux::~VideoCaptureDeviceLinux() {
}
void VideoCaptureDeviceLinux::AllocateAndStart(
- const VideoCaptureCapability& capture_format,
+ const VideoCaptureParams& params,
scoped_ptr<VideoCaptureDevice::Client> client) {
if (v4l2_thread_.IsRunning()) {
return; // Wrong state.
@@ -301,9 +304,9 @@ void VideoCaptureDeviceLinux::AllocateAndStart(
FROM_HERE,
base::Bind(&VideoCaptureDeviceLinux::OnAllocateAndStart,
base::Unretained(this),
- capture_format.width,
- capture_format.height,
- capture_format.frame_rate,
+ params.requested_format.frame_size.width(),
+ params.requested_format.frame_size.height(),
+ params.requested_format.frame_rate,
base::Passed(&client)));
}
@@ -409,12 +412,11 @@ void VideoCaptureDeviceLinux::OnAllocateAndStart(int width,
// framerate configuration, or the actual one is different from the desired?
// Store our current width and height.
- frame_info_.color =
+ capture_format_.frame_size.SetSize(video_fmt.fmt.pix.width,
+ video_fmt.fmt.pix.height);
+ capture_format_.frame_rate = frame_rate;
+ capture_format_.pixel_format =
V4l2ColorToVideoCaptureColorFormat(video_fmt.fmt.pix.pixelformat);
- frame_info_.width = video_fmt.fmt.pix.width;
- frame_info_.height = video_fmt.fmt.pix.height;
- frame_info_.frame_rate = frame_rate;
- frame_info_.frame_size_type = VariableResolutionVideoCaptureDevice;
// Start capturing.
if (!AllocateVideoBuffers()) {
@@ -519,7 +521,7 @@ void VideoCaptureDeviceLinux::OnCaptureTask() {
0,
false,
false,
- frame_info_);
+ capture_format_);
// Enqueue the buffer again.
if (ioctl(device_fd_, VIDIOC_QBUF, &buffer) == -1) {
« no previous file with comments | « media/video/capture/linux/video_capture_device_linux.h ('k') | media/video/capture/mac/video_capture_device_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698