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

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

Issue 270263008: Add a ChromeOS implementation of VideoCaptureDevice (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a nit Created 6 years, 7 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
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 6893743d5110db0f634b58820b69718cf55a5a1d..bd753de884d28bf2f10fc9ccd0453fa4314fd2d5 100644
--- a/media/video/capture/linux/video_capture_device_linux.cc
+++ b/media/video/capture/linux/video_capture_device_linux.cc
@@ -22,6 +22,9 @@
#include "base/files/scoped_file.h"
#include "base/posix/eintr_wrapper.h"
#include "base/strings/stringprintf.h"
+#if defined(OS_CHROMEOS)
+#include "media/video/capture/linux/video_capture_device_chromeos.h"
+#endif
namespace media {
@@ -249,7 +252,12 @@ const std::string VideoCaptureDevice::Name::GetModel() const {
}
VideoCaptureDevice* VideoCaptureDevice::Create(const Name& device_name) {
+#if defined(OS_CHROMEOS)
+ VideoCaptureDeviceChromeOS* self =
+ new VideoCaptureDeviceChromeOS(device_name);
+#else
VideoCaptureDeviceLinux* self = new VideoCaptureDeviceLinux(device_name);
+#endif
if (!self)
return NULL;
// Test opening the device driver. This is to make sure it is available.
@@ -271,7 +279,9 @@ VideoCaptureDeviceLinux::VideoCaptureDeviceLinux(const Name& device_name)
v4l2_thread_("V4L2Thread"),
buffer_pool_(NULL),
buffer_pool_size_(0),
- timeout_count_(0) {}
+ timeout_count_(0),
+ rotation_(0) {
+}
VideoCaptureDeviceLinux::~VideoCaptureDeviceLinux() {
state_ = kIdle;
@@ -313,6 +323,23 @@ void VideoCaptureDeviceLinux::StopAndDeAllocate() {
DeAllocateVideoBuffers();
}
+void VideoCaptureDeviceLinux::SetRotation(int rotation) {
+ if (v4l2_thread_.IsRunning()) {
+ v4l2_thread_.message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&VideoCaptureDeviceLinux::SetRotationOnV4L2Thread,
+ base::Unretained(this), rotation));
+ } else {
+ SetRotationOnV4L2Thread(rotation);
+ }
+}
+
+void VideoCaptureDeviceLinux::SetRotationOnV4L2Thread(int rotation) {
+ DCHECK(!v4l2_thread_.IsRunning() ||
+ v4l2_thread_.message_loop() == base::MessageLoop::current());
mcasas 2014/05/11 18:41:25 The method would not be executed in |v4l2_thread_|
Zachary Kuznia 2014/05/12 02:54:18 Done.
+ rotation_ = rotation;
+}
+
void VideoCaptureDeviceLinux::OnAllocateAndStart(int width,
int height,
int frame_rate,
@@ -521,7 +548,7 @@ void VideoCaptureDeviceLinux::OnCaptureTask() {
static_cast<uint8*>(buffer_pool_[buffer.index].start),
buffer.bytesused,
capture_format_,
- 0,
+ rotation_,
base::TimeTicks::Now());
// Enqueue the buffer again.

Powered by Google App Engine
This is Rietveld 408576698