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

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

Issue 2214533002: move //media/capture to //device/capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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
« no previous file with comments | « media/capture/video/linux/video_capture_device_linux.h ('k') | media/capture/video/mac/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/video/linux/video_capture_device_linux.cc
diff --git a/media/capture/video/linux/video_capture_device_linux.cc b/media/capture/video/linux/video_capture_device_linux.cc
deleted file mode 100644
index a52963e856b700a308db0f3f7abe5ee6766378af..0000000000000000000000000000000000000000
--- a/media/capture/video/linux/video_capture_device_linux.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/capture/video/linux/video_capture_device_linux.h"
-
-#include <stddef.h>
-
-#include <list>
-
-#include "base/bind.h"
-#include "build/build_config.h"
-#include "media/capture/video/linux/v4l2_capture_delegate.h"
-
-#if defined(OS_OPENBSD)
-#include <sys/videoio.h>
-#else
-#include <linux/videodev2.h>
-#endif
-
-namespace media {
-
-// Translates Video4Linux pixel formats to Chromium pixel formats.
-// static
-VideoPixelFormat VideoCaptureDeviceLinux::V4l2FourCcToChromiumPixelFormat(
- uint32_t v4l2_fourcc) {
- return V4L2CaptureDelegate::V4l2FourCcToChromiumPixelFormat(v4l2_fourcc);
-}
-
-// Gets a list of usable Four CC formats prioritized.
-// static
-std::list<uint32_t> VideoCaptureDeviceLinux::GetListOfUsableFourCCs(
- bool favour_mjpeg) {
- return V4L2CaptureDelegate::GetListOfUsableFourCcs(favour_mjpeg);
-}
-
-VideoCaptureDeviceLinux::VideoCaptureDeviceLinux(
- const VideoCaptureDeviceDescriptor& device_descriptor)
- : v4l2_thread_("V4L2CaptureThread"),
- device_descriptor_(device_descriptor) {}
-
-VideoCaptureDeviceLinux::~VideoCaptureDeviceLinux() {
- // Check if the thread is running.
- // This means that the device has not been StopAndDeAllocate()d properly.
- DCHECK(!v4l2_thread_.IsRunning());
- v4l2_thread_.Stop();
-}
-
-void VideoCaptureDeviceLinux::AllocateAndStart(
- const VideoCaptureParams& params,
- std::unique_ptr<VideoCaptureDevice::Client> client) {
- DCHECK(!capture_impl_);
- if (v4l2_thread_.IsRunning())
- return; // Wrong state.
- v4l2_thread_.Start();
-
- const int line_frequency =
- TranslatePowerLineFrequencyToV4L2(GetPowerLineFrequency(params));
- capture_impl_ = new V4L2CaptureDelegate(
- device_descriptor_, v4l2_thread_.task_runner(), line_frequency);
- if (!capture_impl_) {
- client->OnError(FROM_HERE, "Failed to create VideoCaptureDelegate");
- return;
- }
- v4l2_thread_.message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&V4L2CaptureDelegate::AllocateAndStart, capture_impl_,
- params.requested_format.frame_size.width(),
- params.requested_format.frame_size.height(),
- params.requested_format.frame_rate, base::Passed(&client)));
-}
-
-void VideoCaptureDeviceLinux::StopAndDeAllocate() {
- if (!v4l2_thread_.IsRunning())
- return; // Wrong state.
- v4l2_thread_.message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&V4L2CaptureDelegate::StopAndDeAllocate, capture_impl_));
- v4l2_thread_.Stop();
-
- capture_impl_ = NULL;
-}
-
-void VideoCaptureDeviceLinux::SetRotation(int rotation) {
- if (v4l2_thread_.IsRunning()) {
- v4l2_thread_.message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&V4L2CaptureDelegate::SetRotation, capture_impl_, rotation));
- }
-}
-
-// static
-int VideoCaptureDeviceLinux::TranslatePowerLineFrequencyToV4L2(
- PowerLineFrequency frequency) {
- switch (frequency) {
- case media::PowerLineFrequency::FREQUENCY_50HZ:
- return V4L2_CID_POWER_LINE_FREQUENCY_50HZ;
- case media::PowerLineFrequency::FREQUENCY_60HZ:
- return V4L2_CID_POWER_LINE_FREQUENCY_60HZ;
- default:
- // If we have no idea of the frequency, at least try and set it to AUTO.
- return V4L2_CID_POWER_LINE_FREQUENCY_AUTO;
- }
-}
-
-} // namespace media
« no previous file with comments | « media/capture/video/linux/video_capture_device_linux.h ('k') | media/capture/video/mac/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698