diff options
Diffstat (limited to 'www/qt6-webengine/files/patch-src_3rdparty_chromium_media_capture_video_linux_v4l2__capture__delegate.cc')
-rw-r--r-- | www/qt6-webengine/files/patch-src_3rdparty_chromium_media_capture_video_linux_v4l2__capture__delegate.cc | 123 |
1 files changed, 108 insertions, 15 deletions
diff --git a/www/qt6-webengine/files/patch-src_3rdparty_chromium_media_capture_video_linux_v4l2__capture__delegate.cc b/www/qt6-webengine/files/patch-src_3rdparty_chromium_media_capture_video_linux_v4l2__capture__delegate.cc index a67fe37b61e0..2bbd51b2e2c5 100644 --- a/www/qt6-webengine/files/patch-src_3rdparty_chromium_media_capture_video_linux_v4l2__capture__delegate.cc +++ b/www/qt6-webengine/files/patch-src_3rdparty_chromium_media_capture_video_linux_v4l2__capture__delegate.cc @@ -1,30 +1,80 @@ ---- src/3rdparty/chromium/media/capture/video/linux/v4l2_capture_delegate.cc.orig 2023-04-05 11:05:06 UTC +--- src/3rdparty/chromium/media/capture/video/linux/v4l2_capture_delegate.cc.orig 2023-10-11 18:22:24 UTC +++ src/3rdparty/chromium/media/capture/video/linux/v4l2_capture_delegate.cc @@ -4,8 +4,10 @@ #include "media/capture/video/linux/v4l2_capture_delegate.h" -+#if !defined(OS_BSD) ++#if !BUILDFLAG(IS_BSD) #include <linux/version.h> #include <linux/videodev2.h> +#endif #include <poll.h> #include <sys/fcntl.h> #include <sys/ioctl.h> -@@ -29,10 +31,10 @@ +@@ -26,17 +28,19 @@ + #include "media/capture/video/blob_utils.h" + #include "media/capture/video/linux/video_capture_device_linux.h" + +-#if BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + #include "media/capture/capture_switches.h" + #include "media/capture/video/linux/v4l2_capture_delegate_gpu_helper.h" + #endif // BUILDFLAG(IS_LINUX) using media::mojom::MeteringMode; --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) -+// #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) ++#if !BUILDFLAG(IS_BSD) + #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) // 16 bit depth, Realsense F200. #define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') --#endif -+// #endif + #endif ++#endif // TODO(aleksandar.stojiljkovic): Wrap this with kernel version check once the // format is introduced to kernel. -@@ -728,7 +730,7 @@ base::WeakPtr<V4L2CaptureDelegate> V4L2CaptureDelegate +@@ -46,6 +50,14 @@ using media::mojom::MeteringMode; + #define V4L2_PIX_FMT_INVZ v4l2_fourcc('I', 'N', 'V', 'Z') + #endif + ++#ifndef V4L2_COLORSPACE_OPRGB ++#define V4L2_COLORSPACE_OPRGB V4L2_COLORSPACE_ADOBERGB ++#endif ++ ++#ifndef V4L2_XFER_FUNC_OPRGB ++#define V4L2_XFER_FUNC_OPRGB V4L2_XFER_FUNC_ADOBERGB ++#endif ++ + namespace media { + + namespace { +@@ -260,7 +272,7 @@ bool V4L2CaptureDelegate::IsBlockedControl(int control + // static + bool V4L2CaptureDelegate::IsControllableControl( + int control_id, +- const base::RepeatingCallback<int(int, void*)>& do_ioctl) { ++ const base::RepeatingCallback<int(unsigned int, void*)>& do_ioctl) { + const int special_control_id = GetControllingSpecialControl(control_id); + if (!special_control_id) { + // The control is not controlled by a special control thus the control is +@@ -316,7 +328,7 @@ V4L2CaptureDelegate::V4L2CaptureDelegate( + is_capturing_(false), + timeout_count_(0), + rotation_(rotation) { +-#if BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + use_gpu_buffer_ = switches::IsVideoCaptureUseGpuMemoryBufferEnabled(); + #endif // BUILDFLAG(IS_LINUX) + } +@@ -443,7 +455,7 @@ void V4L2CaptureDelegate::AllocateAndStart( + + client_->OnStarted(); + +-#if BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + if (use_gpu_buffer_) { + v4l2_gpu_helper_ = std::make_unique<V4L2CaptureDelegateGpuHelper>( + std::move(gmb_support_test_)); +@@ -793,7 +805,7 @@ void V4L2CaptureDelegate::SetGPUEnvironmentForTesting( V4L2CaptureDelegate::~V4L2CaptureDelegate() = default; @@ -33,7 +83,7 @@ int num_retries = 0; for (; DoIoctl(request, argp) < 0 && num_retries < kMaxIOCtrlRetries; ++num_retries) { -@@ -738,7 +740,7 @@ bool V4L2CaptureDelegate::RunIoctl(int request, void* +@@ -803,7 +815,7 @@ bool V4L2CaptureDelegate::RunIoctl(int request, void* return num_retries != kMaxIOCtrlRetries; } @@ -42,18 +92,15 @@ return HANDLE_EINTR(v4l2_->ioctl(device_fd_.get(), request, argp)); } -@@ -778,6 +780,10 @@ bool V4L2CaptureDelegate::IsControllableControl(int co +@@ -814,6 +826,7 @@ bool V4L2CaptureDelegate::IsControllableControl(int co } void V4L2CaptureDelegate::ReplaceControlEventSubscriptions() { -+// these ioctls are not implemented on *BSDs -+#if BUILDFLAG(IS_BSD) -+ NOTIMPLEMENTED(); -+#else ++#if !BUILDFLAG(IS_BSD) constexpr uint32_t kControlIds[] = {V4L2_CID_AUTO_EXPOSURE_BIAS, V4L2_CID_AUTO_WHITE_BALANCE, V4L2_CID_BRIGHTNESS, -@@ -805,6 +811,7 @@ void V4L2CaptureDelegate::ReplaceControlEventSubscript +@@ -841,6 +854,7 @@ void V4L2CaptureDelegate::ReplaceControlEventSubscript << ", {type = V4L2_EVENT_CTRL, id = " << control_id << "}"; } } @@ -61,3 +108,49 @@ } mojom::RangePtr V4L2CaptureDelegate::RetrieveUserControlRange(int control_id) { +@@ -1021,7 +1035,11 @@ void V4L2CaptureDelegate::DoCapture() { + + pollfd device_pfd = {}; + device_pfd.fd = device_fd_.get(); ++#if !BUILDFLAG(IS_BSD) + device_pfd.events = POLLIN | POLLPRI; ++#else ++ device_pfd.events = POLLIN; ++#endif + + const int result = + HANDLE_EINTR(v4l2_->poll(&device_pfd, 1, kCaptureTimeoutMs)); +@@ -1059,6 +1077,7 @@ void V4L2CaptureDelegate::DoCapture() { + timeout_count_ = 0; + } + ++#if !BUILDFLAG(IS_BSD) + // Dequeue events if the driver has filled in some. + if (device_pfd.revents & POLLPRI) { + bool controls_changed = false; +@@ -1093,6 +1112,7 @@ void V4L2CaptureDelegate::DoCapture() { + client_->OnCaptureConfigurationChanged(); + } + } ++#endif + + // Deenqueue, send and reenqueue a buffer if the driver has filled one in. + if (device_pfd.revents & POLLIN) { +@@ -1146,7 +1166,7 @@ void V4L2CaptureDelegate::DoCapture() { + // workable on Linux. + + // See http://crbug.com/959919. +-#if BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + if (use_gpu_buffer_) { + v4l2_gpu_helper_->OnIncomingCapturedData( + client_.get(), buffer_tracker->start(), +@@ -1219,7 +1239,7 @@ void V4L2CaptureDelegate::SetErrorState(VideoCaptureEr + client_->OnError(error, from_here, reason); + } + +-#if BUILDFLAG(IS_LINUX) ++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) + gfx::ColorSpace V4L2CaptureDelegate::BuildColorSpaceFromv4l2() { + v4l2_colorspace v4l2_primary = (v4l2_colorspace)video_fmt_.fmt.pix.colorspace; + v4l2_quantization v4l2_range = |