OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/video/capture/linux/video_capture_device_linux.h" | 5 #include "media/video/capture/linux/video_capture_device_linux.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #if defined(OS_OPENBSD) | 9 #if defined(OS_OPENBSD) |
10 #include <sys/videoio.h> | 10 #include <sys/videoio.h> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (favour_mjpeg) | 100 if (favour_mjpeg) |
101 fourccs->push_front(V4L2_PIX_FMT_MJPEG); | 101 fourccs->push_front(V4L2_PIX_FMT_MJPEG); |
102 else | 102 else |
103 fourccs->push_back(V4L2_PIX_FMT_MJPEG); | 103 fourccs->push_back(V4L2_PIX_FMT_MJPEG); |
104 | 104 |
105 // JPEG works as MJPEG on some gspca webcams from field reports. | 105 // JPEG works as MJPEG on some gspca webcams from field reports. |
106 // Put it as the least preferred format. | 106 // Put it as the least preferred format. |
107 fourccs->push_back(V4L2_PIX_FMT_JPEG); | 107 fourccs->push_back(V4L2_PIX_FMT_JPEG); |
108 } | 108 } |
109 | 109 |
110 // TODO(mcasas): Remove the following static methods when they are no longer | |
111 // referenced from VideoCaptureDeviceFactory, i.e. when all OS platforms have | |
112 // splitted the VideoCaptureDevice into VideoCaptureDevice and | |
113 // VideoCaptureDeviceFactory. | |
114 | |
115 // static | |
116 VideoCaptureDevice* VideoCaptureDevice::Create( | |
117 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | |
118 const Name& device_name) { | |
119 NOTREACHED(); | |
120 return NULL; | |
121 } | |
122 // static | |
123 void VideoCaptureDevice::GetDeviceNames(Names* device_names) { | |
124 NOTREACHED(); | |
125 } | |
126 | |
127 // static | |
128 void VideoCaptureDevice::GetDeviceSupportedFormats( | |
129 const Name& device, | |
130 VideoCaptureFormats* supported_formats) { | |
131 NOTREACHED(); | |
132 } | |
133 | |
134 const std::string VideoCaptureDevice::Name::GetModel() const { | 110 const std::string VideoCaptureDevice::Name::GetModel() const { |
135 // |unique_id| is of the form "/dev/video2". |file_name| is "video2". | 111 // |unique_id| is of the form "/dev/video2". |file_name| is "video2". |
136 const std::string dev_dir = "/dev/"; | 112 const std::string dev_dir = "/dev/"; |
137 DCHECK_EQ(0, unique_id_.compare(0, dev_dir.length(), dev_dir)); | 113 DCHECK_EQ(0, unique_id_.compare(0, dev_dir.length(), dev_dir)); |
138 const std::string file_name = | 114 const std::string file_name = |
139 unique_id_.substr(dev_dir.length(), unique_id_.length()); | 115 unique_id_.substr(dev_dir.length(), unique_id_.length()); |
140 | 116 |
141 const std::string vidPath = | 117 const std::string vidPath = |
142 base::StringPrintf(kVidPathTemplate, file_name.c_str()); | 118 base::StringPrintf(kVidPathTemplate, file_name.c_str()); |
143 const std::string pidPath = | 119 const std::string pidPath = |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 | 501 |
526 void VideoCaptureDeviceLinux::SetErrorState(const std::string& reason) { | 502 void VideoCaptureDeviceLinux::SetErrorState(const std::string& reason) { |
527 DCHECK(!v4l2_thread_.IsRunning() || | 503 DCHECK(!v4l2_thread_.IsRunning() || |
528 v4l2_thread_.message_loop() == base::MessageLoop::current()); | 504 v4l2_thread_.message_loop() == base::MessageLoop::current()); |
529 DVLOG(1) << reason; | 505 DVLOG(1) << reason; |
530 state_ = kError; | 506 state_ = kError; |
531 client_->OnError(reason); | 507 client_->OnError(reason); |
532 } | 508 } |
533 | 509 |
534 } // namespace media | 510 } // namespace media |
OLD | NEW |