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

Unified Diff: content/common/gpu/media/exynos_v4l2_video_device.cc

Issue 700383004: Add use_v4lplugin flag to enable v4l2 library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add CQ-DEPEND and chromeos==1 condition in gyp Created 6 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
« no previous file with comments | « content/common/gpu/media/exynos_v4l2_video_device.h ('k') | content/common/gpu/media/v4l2.sig » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/exynos_v4l2_video_device.cc
diff --git a/content/common/gpu/media/exynos_v4l2_video_device.cc b/content/common/gpu/media/exynos_v4l2_video_device.cc
index 214a4311ab39466d8a7b37b9940fa119a8dabadb..1b1ebec7a0d7454c728872869e37f1f670a9166e 100644
--- a/content/common/gpu/media/exynos_v4l2_video_device.cc
+++ b/content/common/gpu/media/exynos_v4l2_video_device.cc
@@ -17,6 +17,21 @@
#include "content/common/gpu/media/exynos_v4l2_video_device.h"
#include "ui/gl/gl_bindings.h"
+#ifdef USE_LIBV4L2
+#include <libv4l2.h>
Pawel Osciak 2014/11/19 11:05:22 Please instead "third_party/v4l-utils/lib/include/
henryhsu 2014/11/20 05:11:58 Done.
+#include "content/common/gpu/media/v4l2_stubs.h"
+
+using content_common_gpu_media::kModuleV4l2;
+using content_common_gpu_media::InitializeStubs;
+using content_common_gpu_media::StubPathMap;
+
+static const base::FilePath::CharType kV4l2Lib[] =
+ FILE_PATH_LITERAL("libv4l2.so");
+#else
+#define v4l2_close close
+#define v4l2_ioctl ioctl
+#endif
+
namespace content {
namespace {
@@ -28,7 +43,8 @@ const char kImageProcessorDevice[] = "/dev/gsc1";
ExynosV4L2Device::ExynosV4L2Device(Type type)
: type_(type),
device_fd_(-1),
- device_poll_interrupt_fd_(-1) {}
+ device_poll_interrupt_fd_(-1) {
+}
ExynosV4L2Device::~ExynosV4L2Device() {
if (device_poll_interrupt_fd_ != -1) {
@@ -36,13 +52,13 @@ ExynosV4L2Device::~ExynosV4L2Device() {
device_poll_interrupt_fd_ = -1;
}
if (device_fd_ != -1) {
- close(device_fd_);
+ v4l2_close(device_fd_);
device_fd_ = -1;
}
}
int ExynosV4L2Device::Ioctl(int request, void* arg) {
- return HANDLE_EINTR(ioctl(device_fd_, request, arg));
+ return HANDLE_EINTR(v4l2_ioctl(device_fd_, request, arg));
}
bool ExynosV4L2Device::Poll(bool poll_device, bool* event_pending) {
@@ -111,6 +127,12 @@ bool ExynosV4L2Device::ClearDevicePollInterrupt() {
bool ExynosV4L2Device::Initialize() {
const char* device_path = NULL;
+ static bool v4l2_functions_initialized = PostSandboxInitialization();
+ if (!v4l2_functions_initialized) {
+ LOG(ERROR) << "Failed to initialize LIBV4L2 libs";
+ return false;
+ }
+
switch (type_) {
case kDecoder:
device_path = kDecoderDevice;
@@ -129,6 +151,12 @@ bool ExynosV4L2Device::Initialize() {
if (device_fd_ == -1) {
return false;
}
+#ifdef USE_LIBV4L2
+ if (HANDLE_EINTR(v4l2_fd_open(device_fd_, V4L2_DISABLE_CONVERSION)) == -1) {
+ v4l2_close(device_fd_);
+ return false;
+ }
+#endif
device_poll_interrupt_fd_ = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
if (device_poll_interrupt_fd_ == -1) {
@@ -208,4 +236,16 @@ uint32 ExynosV4L2Device::PreferredOutputFormat() {
return V4L2_PIX_FMT_NV12M;
}
+// static
+bool ExynosV4L2Device::PostSandboxInitialization() {
+#ifdef USE_LIBV4L2
+ StubPathMap paths;
+ paths[kModuleV4l2].push_back(kV4l2Lib);
+
+ return InitializeStubs(paths);
+#else
+ return true;
+#endif
+}
+
} // namespace content
« no previous file with comments | « content/common/gpu/media/exynos_v4l2_video_device.h ('k') | content/common/gpu/media/v4l2.sig » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698