| Index: media/gpu/v4l2_image_processor.cc
|
| diff --git a/content/common/gpu/media/v4l2_image_processor.cc b/media/gpu/v4l2_image_processor.cc
|
| similarity index 95%
|
| rename from content/common/gpu/media/v4l2_image_processor.cc
|
| rename to media/gpu/v4l2_image_processor.cc
|
| index 60908090019bdc86fb1c8d17a650c2c4413a43f2..e6e30a2d2d67bbd5765d8ea049aa43683be5c244 100644
|
| --- a/content/common/gpu/media/v4l2_image_processor.cc
|
| +++ b/media/gpu/v4l2_image_processor.cc
|
| @@ -16,7 +16,7 @@
|
| #include "base/callback.h"
|
| #include "base/numerics/safe_conversions.h"
|
| #include "base/thread_task_runner_handle.h"
|
| -#include "content/common/gpu/media/v4l2_image_processor.h"
|
| +#include "media/gpu/v4l2_image_processor.h"
|
|
|
| #define IOCTL_OR_ERROR_RETURN_VALUE(type, arg, value, type_str) \
|
| do { \
|
| @@ -32,29 +32,25 @@
|
| #define IOCTL_OR_ERROR_RETURN_FALSE(type, arg) \
|
| IOCTL_OR_ERROR_RETURN_VALUE(type, arg, false, #type)
|
|
|
| -#define IOCTL_OR_LOG_ERROR(type, arg) \
|
| - do { \
|
| - if (device_->Ioctl(type, arg) != 0) \
|
| - PLOG(ERROR) << __func__ << "(): ioctl() failed: " << #type; \
|
| +#define IOCTL_OR_LOG_ERROR(type, arg) \
|
| + do { \
|
| + if (device_->Ioctl(type, arg) != 0) \
|
| + PLOG(ERROR) << __func__ << "(): ioctl() failed: " << #type; \
|
| } while (0)
|
|
|
| -namespace content {
|
| +namespace media {
|
|
|
| -V4L2ImageProcessor::InputRecord::InputRecord() : at_device(false) {
|
| -}
|
| +V4L2ImageProcessor::InputRecord::InputRecord() : at_device(false) {}
|
|
|
| -V4L2ImageProcessor::InputRecord::~InputRecord() {
|
| -}
|
| +V4L2ImageProcessor::InputRecord::~InputRecord() {}
|
|
|
| V4L2ImageProcessor::OutputRecord::OutputRecord() : at_device(false) {}
|
|
|
| -V4L2ImageProcessor::OutputRecord::~OutputRecord() {
|
| -}
|
| +V4L2ImageProcessor::OutputRecord::~OutputRecord() {}
|
|
|
| V4L2ImageProcessor::JobRecord::JobRecord() : output_buffer_index(-1) {}
|
|
|
| -V4L2ImageProcessor::JobRecord::~JobRecord() {
|
| -}
|
| +V4L2ImageProcessor::JobRecord::~JobRecord() {}
|
|
|
| V4L2ImageProcessor::V4L2ImageProcessor(const scoped_refptr<V4L2Device>& device)
|
| : input_format_(media::PIXEL_FORMAT_UNKNOWN),
|
| @@ -140,7 +136,8 @@ bool V4L2ImageProcessor::Initialize(media::VideoPixelFormat input_format,
|
| IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps);
|
| if ((caps.capabilities & kCapsRequired) != kCapsRequired) {
|
| LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: "
|
| - "caps check failed: 0x" << std::hex << caps.capabilities;
|
| + "caps check failed: 0x"
|
| + << std::hex << caps.capabilities;
|
| return false;
|
| }
|
|
|
| @@ -233,10 +230,8 @@ void V4L2ImageProcessor::Process(const scoped_refptr<media::VideoFrame>& frame,
|
| job_record->ready_cb = cb;
|
|
|
| device_thread_.message_loop()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&V4L2ImageProcessor::ProcessTask,
|
| - base::Unretained(this),
|
| - base::Passed(&job_record)));
|
| + FROM_HERE, base::Bind(&V4L2ImageProcessor::ProcessTask,
|
| + base::Unretained(this), base::Passed(&job_record)));
|
| }
|
|
|
| void V4L2ImageProcessor::ProcessTask(std::unique_ptr<JobRecord> job_record) {
|
| @@ -314,8 +309,8 @@ bool V4L2ImageProcessor::CreateInputBuffers() {
|
| input_planes_count_ = format.fmt.pix_mp.num_planes;
|
| DCHECK_LE(input_planes_count_, static_cast<size_t>(VIDEO_MAX_PLANES));
|
| input_allocated_size_ = V4L2Device::CodedSizeFromV4L2Format(format);
|
| - DCHECK(gfx::Rect(input_allocated_size_).Contains(
|
| - gfx::Rect(input_visible_size_)));
|
| + DCHECK(gfx::Rect(input_allocated_size_)
|
| + .Contains(gfx::Rect(input_visible_size_)));
|
|
|
| struct v4l2_crop crop;
|
| memset(&crop, 0, sizeof(crop));
|
| @@ -364,8 +359,8 @@ bool V4L2ImageProcessor::CreateOutputBuffers() {
|
| DCHECK_LE(output_planes_count_, static_cast<size_t>(VIDEO_MAX_PLANES));
|
| gfx::Size adjusted_allocated_size =
|
| V4L2Device::CodedSizeFromV4L2Format(format);
|
| - DCHECK(gfx::Rect(adjusted_allocated_size).Contains(
|
| - gfx::Rect(output_allocated_size_)));
|
| + DCHECK(gfx::Rect(adjusted_allocated_size)
|
| + .Contains(gfx::Rect(output_allocated_size_)));
|
| output_allocated_size_ = adjusted_allocated_size;
|
|
|
| struct v4l2_crop crop;
|
| @@ -436,9 +431,8 @@ void V4L2ImageProcessor::DevicePollTask(bool poll_device) {
|
| // All processing should happen on ServiceDeviceTask(), since we shouldn't
|
| // touch encoder state from this thread.
|
| device_thread_.message_loop()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&V4L2ImageProcessor::ServiceDeviceTask,
|
| - base::Unretained(this)));
|
| + FROM_HERE, base::Bind(&V4L2ImageProcessor::ServiceDeviceTask,
|
| + base::Unretained(this)));
|
| }
|
|
|
| void V4L2ImageProcessor::ServiceDeviceTask() {
|
| @@ -607,8 +601,10 @@ bool V4L2ImageProcessor::EnqueueInputRecord() {
|
| qbuf.m.planes = qbuf_planes;
|
| qbuf.length = input_planes_count_;
|
| for (size_t i = 0; i < input_planes_count_; ++i) {
|
| - qbuf.m.planes[i].bytesused = media::VideoFrame::PlaneSize(
|
| - input_record.frame->format(), i, input_allocated_size_).GetArea();
|
| + qbuf.m.planes[i].bytesused =
|
| + media::VideoFrame::PlaneSize(input_record.frame->format(), i,
|
| + input_allocated_size_)
|
| + .GetArea();
|
| qbuf.m.planes[i].length = qbuf.m.planes[i].bytesused;
|
| if (input_memory_type_ == V4L2_MEMORY_USERPTR) {
|
| qbuf.m.planes[i].m.userptr =
|
| @@ -664,9 +660,8 @@ bool V4L2ImageProcessor::StartDevicePoll() {
|
| // Enqueue a poll task with no devices to poll on - will wait only for the
|
| // poll interrupt
|
| device_poll_thread_.message_loop()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(
|
| - &V4L2ImageProcessor::DevicePollTask, base::Unretained(this), false));
|
| + FROM_HERE, base::Bind(&V4L2ImageProcessor::DevicePollTask,
|
| + base::Unretained(this), false));
|
|
|
| return true;
|
| }
|
| @@ -726,4 +721,4 @@ void V4L2ImageProcessor::FrameReady(const FrameReadyCB& cb,
|
| cb.Run(output_buffer_index);
|
| }
|
|
|
| -} // namespace content
|
| +} // namespace media
|
|
|