2005-06-04 11:49:02 +02:00
|
|
|
/*
|
2019-04-10 16:46:25 +02:00
|
|
|
* v4l2 backend to the VFW Capture filter
|
2005-06-04 11:49:02 +02:00
|
|
|
*
|
|
|
|
* Copyright 2005 Maarten Lankhorst
|
2019-04-10 16:46:25 +02:00
|
|
|
* Copyright 2019 Zebediah Figura
|
2005-06-04 11:49:02 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-06-04 11:49:02 +02:00
|
|
|
*/
|
|
|
|
|
2020-11-27 05:34:31 +01:00
|
|
|
#if 0
|
|
|
|
#pragma makedep unix
|
|
|
|
#endif
|
|
|
|
|
2019-04-10 16:46:25 +02:00
|
|
|
#define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD /* work around ioctl breakage on Android */
|
|
|
|
|
2005-06-04 11:49:02 +02:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
2021-11-02 18:38:11 +01:00
|
|
|
#include <stdlib.h>
|
2005-06-04 11:49:02 +02:00
|
|
|
#include <fcntl.h>
|
2021-11-02 18:38:11 +01:00
|
|
|
#include <dlfcn.h>
|
2005-06-04 11:49:02 +02:00
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/mman.h>
|
2011-12-15 11:16:27 +01:00
|
|
|
#include <errno.h>
|
2005-06-04 11:49:02 +02:00
|
|
|
#include <sys/time.h>
|
|
|
|
#ifdef HAVE_ASM_TYPES_H
|
|
|
|
#include <asm/types.h>
|
|
|
|
#endif
|
2019-04-10 16:46:25 +02:00
|
|
|
#ifdef HAVE_LINUX_VIDEODEV2_H
|
|
|
|
#include <linux/videodev2.h>
|
2005-06-04 11:49:02 +02:00
|
|
|
#endif
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2020-11-27 05:34:31 +01:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include "initguid.h"
|
2020-06-29 17:26:15 +02:00
|
|
|
#include "qcap_private.h"
|
2020-11-27 05:34:31 +01:00
|
|
|
#include "winternl.h"
|
2011-09-06 12:12:05 +02:00
|
|
|
|
2019-04-10 16:46:25 +02:00
|
|
|
#ifdef HAVE_LINUX_VIDEODEV2_H
|
|
|
|
|
2021-07-10 05:14:39 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
2019-04-10 16:46:25 +02:00
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(winediag);
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2010-01-28 23:27:12 +01:00
|
|
|
static typeof(open) *video_open = open;
|
|
|
|
static typeof(close) *video_close = close;
|
|
|
|
static typeof(ioctl) *video_ioctl = ioctl;
|
|
|
|
static typeof(read) *video_read = read;
|
|
|
|
|
2019-04-10 16:46:25 +02:00
|
|
|
static BOOL video_init(void)
|
2010-01-28 23:27:12 +01:00
|
|
|
{
|
2019-04-10 16:46:25 +02:00
|
|
|
#ifdef SONAME_LIBV4L2
|
2010-01-28 23:27:12 +01:00
|
|
|
static void *video_lib;
|
|
|
|
|
|
|
|
if (video_lib)
|
2019-04-10 16:46:25 +02:00
|
|
|
return TRUE;
|
2020-04-06 22:38:50 +02:00
|
|
|
if (!(video_lib = dlopen(SONAME_LIBV4L2, RTLD_NOW)))
|
2019-04-10 16:46:25 +02:00
|
|
|
return FALSE;
|
2020-04-06 22:38:50 +02:00
|
|
|
video_open = dlsym(video_lib, "v4l2_open");
|
|
|
|
video_close = dlsym(video_lib, "v4l2_close");
|
|
|
|
video_ioctl = dlsym(video_lib, "v4l2_ioctl");
|
|
|
|
video_read = dlsym(video_lib, "v4l2_read");
|
2019-04-10 16:46:25 +02:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
#else
|
|
|
|
return FALSE;
|
2010-01-28 23:27:12 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-04-28 18:55:16 +02:00
|
|
|
struct caps
|
|
|
|
{
|
|
|
|
__u32 pixelformat;
|
|
|
|
AM_MEDIA_TYPE media_type;
|
|
|
|
VIDEOINFOHEADER video_info;
|
|
|
|
VIDEO_STREAM_CONFIG_CAPS config;
|
|
|
|
};
|
|
|
|
|
2020-11-25 03:11:15 +01:00
|
|
|
struct video_capture_device
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2020-04-28 18:55:17 +02:00
|
|
|
const struct caps *current_caps;
|
2020-04-28 18:55:16 +02:00
|
|
|
struct caps *caps;
|
|
|
|
LONG caps_count;
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2020-09-08 18:15:09 +02:00
|
|
|
int image_size, image_pitch;
|
2020-11-25 03:11:14 +01:00
|
|
|
BYTE *image_data;
|
2020-09-08 18:15:09 +02:00
|
|
|
|
2005-06-04 11:49:02 +02:00
|
|
|
int fd, mmap;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int xioctl(int fd, int request, void * arg)
|
|
|
|
{
|
|
|
|
int r;
|
|
|
|
|
|
|
|
do {
|
2010-01-28 23:27:12 +01:00
|
|
|
r = video_ioctl (fd, request, arg);
|
2005-06-04 11:49:02 +02:00
|
|
|
} while (-1 == r && EINTR == errno);
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2021-11-09 11:43:55 +01:00
|
|
|
static struct video_capture_device *get_device( video_capture_device_t dev )
|
|
|
|
{
|
|
|
|
return (struct video_capture_device *)(ULONG_PTR)dev;
|
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static void device_destroy(struct video_capture_device *device)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2020-04-28 18:55:16 +02:00
|
|
|
if (device->fd != -1)
|
|
|
|
video_close(device->fd);
|
|
|
|
if (device->caps_count)
|
2020-11-27 05:34:30 +01:00
|
|
|
free(device->caps);
|
|
|
|
free(device->image_data);
|
|
|
|
free(device);
|
2005-06-04 11:49:02 +02:00
|
|
|
}
|
|
|
|
|
2020-11-25 03:11:15 +01:00
|
|
|
static const struct caps *find_caps(struct video_capture_device *device, const AM_MEDIA_TYPE *mt)
|
2020-04-28 18:55:17 +02:00
|
|
|
{
|
|
|
|
const VIDEOINFOHEADER *video_info = (VIDEOINFOHEADER *)mt->pbFormat;
|
|
|
|
LONG index;
|
|
|
|
|
|
|
|
if (mt->cbFormat < sizeof(VIDEOINFOHEADER) || !video_info)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (index = 0; index < device->caps_count; index++)
|
|
|
|
{
|
|
|
|
struct caps *caps = &device->caps[index];
|
|
|
|
|
|
|
|
if (IsEqualGUID(&mt->formattype, &caps->media_type.formattype)
|
|
|
|
&& video_info->bmiHeader.biWidth == caps->video_info.bmiHeader.biWidth
|
|
|
|
&& video_info->bmiHeader.biHeight == caps->video_info.bmiHeader.biHeight)
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_check_format( void *args )
|
2019-05-01 06:09:13 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct check_format_params *params = args;
|
|
|
|
struct video_capture_device *device = get_device(params->device);
|
2019-05-01 06:09:13 +02:00
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
TRACE("device %p, mt %p.\n", device, params->mt);
|
|
|
|
|
|
|
|
if (!IsEqualGUID(¶ms->mt->majortype, &MEDIATYPE_Video))
|
2020-04-28 18:55:17 +02:00
|
|
|
return E_FAIL;
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
if (find_caps(device, params->mt))
|
2020-04-28 18:55:17 +02:00
|
|
|
return S_OK;
|
2019-05-01 06:09:13 +02:00
|
|
|
|
2020-04-28 18:55:17 +02:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2020-11-25 03:11:15 +01:00
|
|
|
static HRESULT set_caps(struct video_capture_device *device, const struct caps *caps)
|
2020-04-28 18:55:17 +02:00
|
|
|
{
|
|
|
|
struct v4l2_format format = {0};
|
2020-11-25 03:11:14 +01:00
|
|
|
LONG width, height, image_size;
|
|
|
|
BYTE *image_data;
|
2020-04-28 18:55:17 +02:00
|
|
|
|
|
|
|
width = caps->video_info.bmiHeader.biWidth;
|
|
|
|
height = caps->video_info.bmiHeader.biHeight;
|
2020-11-25 03:11:14 +01:00
|
|
|
image_size = width * height * caps->video_info.bmiHeader.biBitCount / 8;
|
|
|
|
|
2020-11-27 05:34:30 +01:00
|
|
|
if (!(image_data = malloc(image_size)))
|
2020-11-25 03:11:14 +01:00
|
|
|
{
|
|
|
|
ERR("Failed to allocate memory.\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
2020-04-28 18:55:17 +02:00
|
|
|
|
|
|
|
format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
|
|
|
format.fmt.pix.pixelformat = caps->pixelformat;
|
|
|
|
format.fmt.pix.width = width;
|
|
|
|
format.fmt.pix.height = height;
|
|
|
|
if (xioctl(device->fd, VIDIOC_S_FMT, &format) == -1
|
|
|
|
|| format.fmt.pix.pixelformat != caps->pixelformat
|
|
|
|
|| format.fmt.pix.width != width
|
|
|
|
|| format.fmt.pix.height != height)
|
2019-05-01 06:09:13 +02:00
|
|
|
{
|
2020-04-28 18:55:17 +02:00
|
|
|
ERR("Failed to set pixel format: %s.\n", strerror(errno));
|
2020-11-27 05:34:30 +01:00
|
|
|
free(image_data);
|
2020-11-25 03:11:14 +01:00
|
|
|
return VFW_E_TYPE_NOT_ACCEPTED;
|
2019-05-01 06:09:13 +02:00
|
|
|
}
|
|
|
|
|
2020-04-28 18:55:17 +02:00
|
|
|
device->current_caps = caps;
|
2020-11-25 03:11:14 +01:00
|
|
|
device->image_size = image_size;
|
2020-09-08 18:15:09 +02:00
|
|
|
device->image_pitch = width * caps->video_info.bmiHeader.biBitCount / 8;
|
2020-11-27 05:34:30 +01:00
|
|
|
free(device->image_data);
|
2020-11-25 03:11:14 +01:00
|
|
|
device->image_data = image_data;
|
|
|
|
return S_OK;
|
2019-05-01 06:09:13 +02:00
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_set_format( void *args )
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct set_format_params *params = args;
|
|
|
|
struct video_capture_device *device = get_device(params->device);
|
2020-04-28 18:55:17 +02:00
|
|
|
const struct caps *caps;
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
caps = find_caps(device, params->mt);
|
2020-04-28 18:55:17 +02:00
|
|
|
if (!caps)
|
|
|
|
return E_FAIL;
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2020-04-28 18:55:17 +02:00
|
|
|
if (device->current_caps == caps)
|
2005-06-04 11:49:02 +02:00
|
|
|
return S_OK;
|
|
|
|
|
2020-11-25 03:11:14 +01:00
|
|
|
return set_caps(device, caps);
|
2005-06-04 11:49:02 +02:00
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_get_format( void *args )
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct get_format_params *params = args;
|
|
|
|
struct video_capture_device *device = get_device(params->device);
|
2021-11-02 18:38:11 +01:00
|
|
|
|
|
|
|
*params->mt = device->current_caps->media_type;
|
|
|
|
*params->format = device->current_caps->video_info;
|
|
|
|
return S_OK;
|
2005-06-04 11:49:02 +02:00
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_get_media_type( void *args )
|
2020-09-08 18:15:10 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct get_media_type_params *params = args;
|
|
|
|
struct video_capture_device *device = get_device(params->device);
|
2020-09-08 18:15:10 +02:00
|
|
|
unsigned int caps_count = (device->current_caps) ? 1 : device->caps_count;
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
if (params->index >= caps_count)
|
2020-09-08 18:15:10 +02:00
|
|
|
return VFW_S_NO_MORE_ITEMS;
|
|
|
|
|
|
|
|
if (device->current_caps)
|
2020-11-26 00:43:39 +01:00
|
|
|
{
|
2021-11-02 18:38:11 +01:00
|
|
|
*params->mt = device->current_caps->media_type;
|
|
|
|
*params->format = device->current_caps->video_info;
|
2020-11-26 00:43:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-02 18:38:11 +01:00
|
|
|
*params->mt = device->caps[params->index].media_type;
|
|
|
|
*params->format = device->caps[params->index].video_info;
|
2020-11-26 00:43:39 +01:00
|
|
|
}
|
|
|
|
return S_OK;
|
2020-09-08 18:15:10 +02:00
|
|
|
}
|
|
|
|
|
2019-04-10 16:46:25 +02:00
|
|
|
static __u32 v4l2_cid_from_qcap_property(VideoProcAmpProperty property)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2019-04-10 16:46:25 +02:00
|
|
|
switch (property)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
|
|
|
case VideoProcAmp_Brightness:
|
2019-04-10 16:46:25 +02:00
|
|
|
return V4L2_CID_BRIGHTNESS;
|
2005-06-04 11:49:02 +02:00
|
|
|
case VideoProcAmp_Contrast:
|
2019-04-10 16:46:25 +02:00
|
|
|
return V4L2_CID_CONTRAST;
|
2005-06-04 11:49:02 +02:00
|
|
|
case VideoProcAmp_Hue:
|
2019-04-10 16:46:25 +02:00
|
|
|
return V4L2_CID_HUE;
|
2005-06-04 11:49:02 +02:00
|
|
|
case VideoProcAmp_Saturation:
|
2019-04-10 16:46:25 +02:00
|
|
|
return V4L2_CID_SATURATION;
|
2005-06-04 11:49:02 +02:00
|
|
|
default:
|
2019-04-10 16:46:25 +02:00
|
|
|
FIXME("Unhandled property %d.\n", property);
|
|
|
|
return 0;
|
2005-06-04 11:49:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_get_prop_range( void *args )
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct get_prop_range_params *params = args;
|
|
|
|
struct video_capture_device *device = get_device(params->device);
|
2019-04-10 16:46:25 +02:00
|
|
|
struct v4l2_queryctrl ctrl;
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
ctrl.id = v4l2_cid_from_qcap_property(params->property);
|
2019-04-10 16:46:25 +02:00
|
|
|
|
|
|
|
if (xioctl(device->fd, VIDIOC_QUERYCTRL, &ctrl) == -1)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2019-04-10 16:46:25 +02:00
|
|
|
WARN("Failed to query control: %s\n", strerror(errno));
|
|
|
|
return E_PROP_ID_UNSUPPORTED;
|
2005-06-04 11:49:02 +02:00
|
|
|
}
|
2019-04-10 16:46:25 +02:00
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
*params->min = ctrl.minimum;
|
|
|
|
*params->max = ctrl.maximum;
|
|
|
|
*params->step = ctrl.step;
|
|
|
|
*params->default_value = ctrl.default_value;
|
|
|
|
*params->flags = VideoProcAmp_Flags_Manual;
|
2005-06-04 11:49:02 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_get_prop( void *args )
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct get_prop_params *params = args;
|
|
|
|
struct video_capture_device *device = get_device(params->device);
|
2019-04-10 16:46:25 +02:00
|
|
|
struct v4l2_control ctrl;
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
ctrl.id = v4l2_cid_from_qcap_property(params->property);
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2019-04-10 16:46:25 +02:00
|
|
|
if (xioctl(device->fd, VIDIOC_G_CTRL, &ctrl) == -1)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2019-04-10 16:46:25 +02:00
|
|
|
WARN("Failed to get property: %s\n", strerror(errno));
|
|
|
|
return E_FAIL;
|
2005-06-04 11:49:02 +02:00
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
*params->value = ctrl.value;
|
|
|
|
*params->flags = VideoProcAmp_Flags_Manual;
|
2019-04-10 16:46:25 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_set_prop( void *args )
|
2019-04-10 16:46:25 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct set_prop_params *params = args;
|
|
|
|
struct video_capture_device *device = get_device(params->device);
|
2019-04-10 16:46:25 +02:00
|
|
|
struct v4l2_control ctrl;
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
ctrl.id = v4l2_cid_from_qcap_property(params->property);
|
|
|
|
ctrl.value = params->value;
|
2019-04-10 16:46:25 +02:00
|
|
|
|
|
|
|
if (xioctl(device->fd, VIDIOC_S_CTRL, &ctrl) == -1)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2019-04-10 16:46:25 +02:00
|
|
|
WARN("Failed to set property: %s\n", strerror(errno));
|
2005-06-04 11:49:02 +02:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
2019-04-10 16:46:25 +02:00
|
|
|
|
2005-06-04 11:49:02 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-11-25 03:11:15 +01:00
|
|
|
static void reverse_image(struct video_capture_device *device, LPBYTE output, const BYTE *input)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2020-04-28 18:55:18 +02:00
|
|
|
int inoffset, outoffset, pitch;
|
2020-04-28 18:55:17 +02:00
|
|
|
|
2005-06-04 11:49:02 +02:00
|
|
|
/* the whole image needs to be reversed,
|
|
|
|
because the dibs are messed up in windows */
|
2020-09-08 18:15:09 +02:00
|
|
|
outoffset = device->image_size;
|
|
|
|
pitch = device->image_pitch;
|
2020-04-28 18:55:18 +02:00
|
|
|
inoffset = 0;
|
|
|
|
while (outoffset > 0)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2020-04-28 18:55:18 +02:00
|
|
|
int x;
|
|
|
|
outoffset -= pitch;
|
|
|
|
for (x = 0; x < pitch; x++)
|
|
|
|
output[outoffset + x] = input[inoffset + x];
|
|
|
|
inoffset += pitch;
|
2005-06-04 11:49:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_read_frame( void *args )
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct read_frame_params *params = args;
|
|
|
|
struct video_capture_device *device = get_device(params->device);
|
2021-11-02 18:38:11 +01:00
|
|
|
|
2020-11-25 03:11:16 +01:00
|
|
|
while (video_read(device->fd, device->image_data, device->image_size) < 0)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2020-11-25 03:11:16 +01:00
|
|
|
if (errno != EAGAIN)
|
2020-06-29 17:26:18 +02:00
|
|
|
{
|
2020-11-25 03:11:16 +01:00
|
|
|
ERR("Failed to read frame: %s\n", strerror(errno));
|
|
|
|
return FALSE;
|
2005-06-04 11:49:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
reverse_image(device, params->data, device->image_data);
|
2020-11-25 03:11:16 +01:00
|
|
|
return TRUE;
|
2005-06-04 11:49:02 +02:00
|
|
|
}
|
|
|
|
|
2020-04-28 18:55:16 +02:00
|
|
|
static void fill_caps(__u32 pixelformat, __u32 width, __u32 height,
|
|
|
|
__u32 max_fps, __u32 min_fps, struct caps *caps)
|
|
|
|
{
|
|
|
|
LONG depth = 24;
|
|
|
|
|
2020-05-12 15:36:10 +02:00
|
|
|
memset(caps, 0, sizeof(*caps));
|
2020-04-28 18:55:16 +02:00
|
|
|
caps->video_info.dwBitRate = width * height * depth * max_fps;
|
|
|
|
caps->video_info.bmiHeader.biSize = sizeof(caps->video_info.bmiHeader);
|
|
|
|
caps->video_info.bmiHeader.biWidth = width;
|
|
|
|
caps->video_info.bmiHeader.biHeight = height;
|
|
|
|
caps->video_info.bmiHeader.biPlanes = 1;
|
|
|
|
caps->video_info.bmiHeader.biBitCount = depth;
|
|
|
|
caps->video_info.bmiHeader.biCompression = BI_RGB;
|
|
|
|
caps->video_info.bmiHeader.biSizeImage = width * height * depth / 8;
|
|
|
|
caps->media_type.majortype = MEDIATYPE_Video;
|
|
|
|
caps->media_type.subtype = MEDIASUBTYPE_RGB24;
|
|
|
|
caps->media_type.bFixedSizeSamples = TRUE;
|
|
|
|
caps->media_type.bTemporalCompression = FALSE;
|
|
|
|
caps->media_type.lSampleSize = width * height * depth / 8;
|
|
|
|
caps->media_type.formattype = FORMAT_VideoInfo;
|
|
|
|
caps->media_type.pUnk = NULL;
|
|
|
|
caps->media_type.cbFormat = sizeof(VIDEOINFOHEADER);
|
|
|
|
/* We reallocate the caps array, so pbFormat has to be set after all caps
|
|
|
|
* have been enumerated. */
|
|
|
|
caps->config.MaxFrameInterval = 10000000 * max_fps;
|
|
|
|
caps->config.MinFrameInterval = 10000000 * min_fps;
|
|
|
|
caps->config.MaxOutputSize.cx = width;
|
|
|
|
caps->config.MaxOutputSize.cy = height;
|
|
|
|
caps->config.MinOutputSize.cx = width;
|
|
|
|
caps->config.MinOutputSize.cy = height;
|
|
|
|
caps->config.guid = FORMAT_VideoInfo;
|
|
|
|
caps->config.MinBitsPerSecond = width * height * depth * min_fps;
|
|
|
|
caps->config.MaxBitsPerSecond = width * height * depth * max_fps;
|
|
|
|
caps->pixelformat = pixelformat;
|
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_get_caps( void *args )
|
2020-06-29 17:26:16 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct get_caps_params *params = args;
|
|
|
|
struct video_capture_device *device = get_device(params->device);
|
2021-11-02 18:38:11 +01:00
|
|
|
|
|
|
|
*params->caps = device->caps[params->index].config;
|
|
|
|
*params->mt = device->caps[params->index].media_type;
|
|
|
|
*params->format = device->caps[params->index].video_info;
|
|
|
|
return S_OK;
|
2020-06-29 17:26:16 +02:00
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_get_caps_count( void *args )
|
2020-06-29 17:26:16 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct get_caps_count_params *params = args;
|
|
|
|
struct video_capture_device *device = get_device(params->device);
|
2021-11-02 18:38:11 +01:00
|
|
|
|
|
|
|
*params->count = device->caps_count;
|
|
|
|
return S_OK;
|
2020-06-29 17:26:16 +02:00
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_create( void *args )
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct create_params *params = args;
|
2020-04-28 18:55:16 +02:00
|
|
|
struct v4l2_frmsizeenum frmsize = {0};
|
2020-11-25 03:11:15 +01:00
|
|
|
struct video_capture_device *device;
|
2019-04-10 16:46:25 +02:00
|
|
|
struct v4l2_capability caps = {{0}};
|
2019-04-10 16:46:27 +02:00
|
|
|
struct v4l2_format format = {0};
|
2019-04-10 16:46:25 +02:00
|
|
|
BOOL have_libv4l2;
|
|
|
|
char path[20];
|
2020-11-25 03:11:14 +01:00
|
|
|
HRESULT hr;
|
2020-04-28 18:55:16 +02:00
|
|
|
int fd, i;
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2019-04-10 16:46:25 +02:00
|
|
|
have_libv4l2 = video_init();
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2020-11-27 05:34:30 +01:00
|
|
|
if (!(device = calloc(1, sizeof(*device))))
|
2021-11-02 18:38:11 +01:00
|
|
|
return E_OUTOFMEMORY;
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
sprintf(path, "/dev/video%i", params->index);
|
2019-04-10 16:46:25 +02:00
|
|
|
TRACE("Opening device %s.\n", path);
|
2017-05-10 20:08:57 +02:00
|
|
|
#ifdef O_CLOEXEC
|
2019-04-10 16:46:25 +02:00
|
|
|
if ((fd = video_open(path, O_RDWR | O_NONBLOCK | O_CLOEXEC)) == -1 && errno == EINVAL)
|
2017-05-10 20:08:57 +02:00
|
|
|
#endif
|
2019-04-10 16:46:25 +02:00
|
|
|
fd = video_open(path, O_RDWR | O_NONBLOCK);
|
|
|
|
if (fd == -1)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2019-04-10 16:46:25 +02:00
|
|
|
WARN("Failed to open video device: %s\n", strerror(errno));
|
2005-06-04 11:49:02 +02:00
|
|
|
goto error;
|
|
|
|
}
|
2019-04-10 16:46:25 +02:00
|
|
|
fcntl(fd, F_SETFD, FD_CLOEXEC); /* in case O_CLOEXEC isn't supported */
|
|
|
|
device->fd = fd;
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2019-04-10 16:46:25 +02:00
|
|
|
if (xioctl(fd, VIDIOC_QUERYCAP, &caps) == -1)
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2019-04-10 16:46:25 +02:00
|
|
|
WARN("Failed to query device capabilities: %s\n", strerror(errno));
|
2005-06-04 11:49:02 +02:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2019-04-27 21:07:00 +02:00
|
|
|
#ifdef V4L2_CAP_DEVICE_CAPS
|
2019-04-20 19:06:56 +02:00
|
|
|
if (caps.capabilities & V4L2_CAP_DEVICE_CAPS)
|
|
|
|
caps.capabilities = caps.device_caps;
|
2019-04-27 21:07:00 +02:00
|
|
|
#endif
|
2019-04-20 19:06:56 +02:00
|
|
|
|
2019-04-10 16:46:25 +02:00
|
|
|
if (!(caps.capabilities & V4L2_CAP_VIDEO_CAPTURE))
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2019-04-10 16:46:25 +02:00
|
|
|
WARN("Device does not support single-planar video capture.\n");
|
2005-06-04 11:49:02 +02:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2019-04-10 16:46:25 +02:00
|
|
|
if (!(caps.capabilities & V4L2_CAP_READWRITE))
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2019-04-10 16:46:25 +02:00
|
|
|
WARN("Device does not support read().\n");
|
|
|
|
if (!have_libv4l2)
|
|
|
|
#ifdef SONAME_LIBV4L2
|
|
|
|
ERR_(winediag)("Reading from %s requires libv4l2, but it could not be loaded.\n", path);
|
|
|
|
#else
|
|
|
|
ERR_(winediag)("Reading from %s requires libv4l2, but Wine was compiled without libv4l2 support.\n", path);
|
|
|
|
#endif
|
2005-06-04 11:49:02 +02:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2019-04-10 16:46:27 +02:00
|
|
|
format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
|
|
|
if (xioctl(fd, VIDIOC_G_FMT, &format) == -1)
|
|
|
|
{
|
|
|
|
ERR("Failed to get device format: %s\n", strerror(errno));
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2020-04-28 18:55:16 +02:00
|
|
|
format.fmt.pix.pixelformat = V4L2_PIX_FMT_BGR24;
|
|
|
|
if (xioctl(fd, VIDIOC_TRY_FMT, &format) == -1
|
|
|
|
|| format.fmt.pix.pixelformat != V4L2_PIX_FMT_BGR24)
|
|
|
|
{
|
|
|
|
ERR("This device doesn't support V4L2_PIX_FMT_BGR24 format.\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
frmsize.pixel_format = V4L2_PIX_FMT_BGR24;
|
|
|
|
while (xioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frmsize) != -1)
|
|
|
|
{
|
|
|
|
struct v4l2_frmivalenum frmival = {0};
|
|
|
|
__u32 max_fps = 30, min_fps = 30;
|
|
|
|
struct caps *new_caps;
|
|
|
|
|
|
|
|
frmival.pixel_format = format.fmt.pix.pixelformat;
|
|
|
|
if (frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE)
|
|
|
|
{
|
|
|
|
frmival.width = frmsize.discrete.width;
|
|
|
|
frmival.height = frmsize.discrete.height;
|
|
|
|
}
|
|
|
|
else if (frmsize.type == V4L2_FRMSIZE_TYPE_STEPWISE)
|
|
|
|
{
|
|
|
|
frmival.width = frmsize.stepwise.max_width;
|
|
|
|
frmival.height = frmsize.stepwise.min_height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("Unhandled frame size type: %d.\n", frmsize.type);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &frmival) != -1)
|
|
|
|
{
|
|
|
|
if (frmival.type == V4L2_FRMIVAL_TYPE_DISCRETE)
|
|
|
|
{
|
|
|
|
max_fps = frmival.discrete.denominator / frmival.discrete.numerator;
|
|
|
|
min_fps = max_fps;
|
|
|
|
}
|
|
|
|
else if (frmival.type == V4L2_FRMIVAL_TYPE_STEPWISE
|
|
|
|
|| frmival.type == V4L2_FRMIVAL_TYPE_CONTINUOUS)
|
|
|
|
{
|
|
|
|
max_fps = frmival.stepwise.max.denominator / frmival.stepwise.max.numerator;
|
|
|
|
min_fps = frmival.stepwise.min.denominator / frmival.stepwise.min.numerator;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ERR("Failed to get fps: %s.\n", strerror(errno));
|
|
|
|
|
2020-11-27 05:34:30 +01:00
|
|
|
new_caps = realloc(device->caps, (device->caps_count + 1) * sizeof(*device->caps));
|
2020-04-28 18:55:16 +02:00
|
|
|
if (!new_caps)
|
|
|
|
goto error;
|
|
|
|
device->caps = new_caps;
|
|
|
|
fill_caps(format.fmt.pix.pixelformat, frmsize.discrete.width, frmsize.discrete.height,
|
|
|
|
max_fps, min_fps, &device->caps[device->caps_count]);
|
|
|
|
device->caps_count++;
|
|
|
|
|
|
|
|
frmsize.index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We reallocate the caps array, so we have to delay setting pbFormat. */
|
|
|
|
for (i = 0; i < device->caps_count; ++i)
|
|
|
|
device->caps[i].media_type.pbFormat = (BYTE *)&device->caps[i].video_info;
|
|
|
|
|
2020-11-25 03:11:14 +01:00
|
|
|
if (FAILED(hr = set_caps(device, &device->caps[0])))
|
2019-04-10 16:46:27 +02:00
|
|
|
{
|
2020-11-25 03:11:14 +01:00
|
|
|
if (hr == VFW_E_TYPE_NOT_ACCEPTED && !have_libv4l2)
|
2019-04-10 16:46:27 +02:00
|
|
|
ERR_(winediag)("You may need libv4l2 to use this device.\n");
|
2005-06-04 11:49:02 +02:00
|
|
|
goto error;
|
2019-04-10 16:46:27 +02:00
|
|
|
}
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2020-04-28 18:55:17 +02:00
|
|
|
TRACE("Format: %d bpp - %dx%d.\n", device->current_caps->video_info.bmiHeader.biBitCount,
|
2022-02-09 03:04:42 +01:00
|
|
|
(int)device->current_caps->video_info.bmiHeader.biWidth,
|
|
|
|
(int)device->current_caps->video_info.bmiHeader.biHeight);
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2021-11-09 11:43:55 +01:00
|
|
|
*params->device = (ULONG_PTR)device;
|
2021-11-02 18:38:11 +01:00
|
|
|
return S_OK;
|
2005-06-04 11:49:02 +02:00
|
|
|
|
|
|
|
error:
|
2021-11-02 18:38:11 +01:00
|
|
|
device_destroy(device);
|
|
|
|
return E_FAIL;
|
2005-06-04 11:49:02 +02:00
|
|
|
}
|
|
|
|
|
2021-11-02 18:38:11 +01:00
|
|
|
static NTSTATUS v4l_device_destroy( void *args )
|
2005-06-04 11:49:02 +02:00
|
|
|
{
|
2021-11-09 11:43:55 +01:00
|
|
|
const struct destroy_params *params = args;
|
2005-06-04 11:49:02 +02:00
|
|
|
|
2021-11-09 11:43:55 +01:00
|
|
|
device_destroy( get_device(params->device) );
|
2021-11-02 18:38:11 +01:00
|
|
|
return S_OK;
|
2020-11-27 05:34:31 +01:00
|
|
|
}
|
2020-11-25 03:11:15 +01:00
|
|
|
|
2021-11-09 11:43:55 +01:00
|
|
|
const unixlib_entry_t __wine_unix_call_funcs[] =
|
2021-11-02 18:38:11 +01:00
|
|
|
{
|
|
|
|
v4l_device_create,
|
|
|
|
v4l_device_destroy,
|
|
|
|
v4l_device_check_format,
|
|
|
|
v4l_device_set_format,
|
|
|
|
v4l_device_get_format,
|
|
|
|
v4l_device_get_media_type,
|
|
|
|
v4l_device_get_caps,
|
|
|
|
v4l_device_get_caps_count,
|
|
|
|
v4l_device_get_prop_range,
|
|
|
|
v4l_device_get_prop,
|
|
|
|
v4l_device_set_prop,
|
|
|
|
v4l_device_read_frame,
|
|
|
|
};
|
|
|
|
|
2021-11-09 11:43:55 +01:00
|
|
|
#ifdef _WIN64
|
|
|
|
|
|
|
|
typedef ULONG PTR32;
|
|
|
|
|
|
|
|
struct am_media_type32
|
|
|
|
{
|
|
|
|
GUID majortype;
|
|
|
|
GUID subtype;
|
|
|
|
BOOL bFixedSizeSamples;
|
|
|
|
BOOL bTemporalCompression;
|
|
|
|
ULONG lSampleSize;
|
|
|
|
GUID formattype;
|
|
|
|
PTR32 pUnk;
|
|
|
|
ULONG cbFormat;
|
|
|
|
PTR32 pbFormat;
|
|
|
|
};
|
|
|
|
|
|
|
|
static AM_MEDIA_TYPE *get_media_type( const struct am_media_type32 *mt32, AM_MEDIA_TYPE *mt )
|
|
|
|
{
|
|
|
|
mt->majortype = mt32->majortype;
|
|
|
|
mt->subtype = mt32->subtype;
|
|
|
|
mt->bFixedSizeSamples = mt32->bFixedSizeSamples;
|
|
|
|
mt->bTemporalCompression = mt32->bTemporalCompression;
|
|
|
|
mt->lSampleSize = mt32->lSampleSize;
|
|
|
|
mt->formattype = mt32->formattype;
|
|
|
|
mt->pUnk = NULL;
|
|
|
|
mt->cbFormat = mt32->cbFormat;
|
|
|
|
mt->pbFormat = ULongToPtr(mt32->pbFormat);
|
|
|
|
return mt;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void put_media_type( const AM_MEDIA_TYPE *mt, struct am_media_type32 *mt32 )
|
|
|
|
{
|
|
|
|
mt32->majortype = mt->majortype;
|
|
|
|
mt32->subtype = mt->subtype;
|
|
|
|
mt32->bFixedSizeSamples = mt->bFixedSizeSamples;
|
|
|
|
mt32->bTemporalCompression = mt->bTemporalCompression;
|
|
|
|
mt32->lSampleSize = mt->lSampleSize;
|
|
|
|
mt32->formattype = mt->formattype;
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS wow64_v4l_device_create( void *args )
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned int index;
|
|
|
|
PTR32 device;
|
|
|
|
} const *params32 = args;
|
|
|
|
|
|
|
|
struct create_params params =
|
|
|
|
{
|
|
|
|
params32->index,
|
|
|
|
ULongToPtr(params32->device)
|
|
|
|
};
|
|
|
|
|
|
|
|
return v4l_device_create( ¶ms );
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS wow64_v4l_device_check_format( void *args )
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
video_capture_device_t device;
|
|
|
|
PTR32 mt;
|
|
|
|
} const *params32 = args;
|
|
|
|
|
|
|
|
AM_MEDIA_TYPE mt;
|
|
|
|
struct check_format_params params =
|
|
|
|
{
|
|
|
|
params32->device,
|
|
|
|
get_media_type( ULongToPtr(params32->mt), &mt )
|
|
|
|
};
|
|
|
|
|
|
|
|
return v4l_device_check_format( ¶ms );
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS wow64_v4l_device_set_format( void *args )
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
video_capture_device_t device;
|
|
|
|
PTR32 mt;
|
|
|
|
} const *params32 = args;
|
|
|
|
|
|
|
|
AM_MEDIA_TYPE mt;
|
|
|
|
struct set_format_params params =
|
|
|
|
{
|
|
|
|
params32->device,
|
|
|
|
get_media_type( ULongToPtr(params32->mt), &mt )
|
|
|
|
};
|
|
|
|
|
|
|
|
return v4l_device_set_format( ¶ms );
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS wow64_v4l_device_get_format( void *args )
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
video_capture_device_t device;
|
|
|
|
PTR32 mt;
|
|
|
|
PTR32 format;
|
|
|
|
} const *params32 = args;
|
|
|
|
|
|
|
|
AM_MEDIA_TYPE mt;
|
|
|
|
struct get_format_params params =
|
|
|
|
{
|
|
|
|
params32->device,
|
|
|
|
&mt,
|
|
|
|
ULongToPtr(params32->format)
|
|
|
|
};
|
|
|
|
|
|
|
|
NTSTATUS status = v4l_device_get_format( ¶ms );
|
|
|
|
if (!status) put_media_type( &mt, ULongToPtr(params32->mt) );
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS wow64_v4l_device_get_media_type( void *args )
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
video_capture_device_t device;
|
|
|
|
unsigned int index;
|
|
|
|
PTR32 mt;
|
|
|
|
PTR32 format;
|
|
|
|
} const *params32 = args;
|
|
|
|
|
|
|
|
AM_MEDIA_TYPE mt;
|
|
|
|
struct get_media_type_params params =
|
|
|
|
{
|
|
|
|
params32->device,
|
|
|
|
params32->index,
|
|
|
|
&mt,
|
|
|
|
ULongToPtr(params32->format)
|
|
|
|
};
|
|
|
|
|
|
|
|
NTSTATUS status = v4l_device_get_media_type( ¶ms );
|
|
|
|
if (!status) put_media_type( &mt, ULongToPtr(params32->mt) );
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS wow64_v4l_device_get_caps( void *args )
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
video_capture_device_t device;
|
|
|
|
unsigned int index;
|
|
|
|
PTR32 mt;
|
|
|
|
PTR32 format;
|
|
|
|
PTR32 caps;
|
|
|
|
} const *params32 = args;
|
|
|
|
|
|
|
|
AM_MEDIA_TYPE mt;
|
|
|
|
struct get_caps_params params =
|
|
|
|
{
|
|
|
|
params32->device,
|
|
|
|
params32->index,
|
|
|
|
&mt,
|
|
|
|
ULongToPtr(params32->format),
|
|
|
|
ULongToPtr(params32->caps)
|
|
|
|
};
|
|
|
|
|
|
|
|
NTSTATUS status = v4l_device_get_caps( ¶ms );
|
|
|
|
if (!status) put_media_type( &mt, ULongToPtr(params32->mt) );
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS wow64_v4l_device_get_caps_count( void *args )
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
video_capture_device_t device;
|
|
|
|
PTR32 count;
|
|
|
|
} const *params32 = args;
|
|
|
|
|
|
|
|
struct get_caps_count_params params =
|
|
|
|
{
|
|
|
|
params32->device,
|
|
|
|
ULongToPtr(params32->count)
|
|
|
|
};
|
|
|
|
|
|
|
|
return v4l_device_get_caps_count( ¶ms );
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS wow64_v4l_device_get_prop_range( void *args )
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
video_capture_device_t device;
|
|
|
|
VideoProcAmpProperty property;
|
|
|
|
PTR32 min;
|
|
|
|
PTR32 max;
|
|
|
|
PTR32 step;
|
|
|
|
PTR32 default_value;
|
|
|
|
PTR32 flags;
|
|
|
|
} const *params32 = args;
|
|
|
|
|
|
|
|
struct get_prop_range_params params =
|
|
|
|
{
|
|
|
|
params32->device,
|
|
|
|
params32->property,
|
|
|
|
ULongToPtr(params32->min),
|
|
|
|
ULongToPtr(params32->max),
|
|
|
|
ULongToPtr(params32->step),
|
|
|
|
ULongToPtr(params32->default_value),
|
|
|
|
ULongToPtr(params32->flags)
|
|
|
|
};
|
|
|
|
|
|
|
|
return v4l_device_get_prop_range( ¶ms );
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS wow64_v4l_device_get_prop( void *args )
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
video_capture_device_t device;
|
|
|
|
VideoProcAmpProperty property;
|
|
|
|
PTR32 value;
|
|
|
|
PTR32 flags;
|
|
|
|
} const *params32 = args;
|
|
|
|
|
|
|
|
struct get_prop_params params =
|
|
|
|
{
|
|
|
|
params32->device,
|
|
|
|
params32->property,
|
|
|
|
ULongToPtr(params32->value),
|
|
|
|
ULongToPtr(params32->flags)
|
|
|
|
};
|
|
|
|
|
|
|
|
return v4l_device_get_prop( ¶ms );
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS wow64_v4l_device_read_frame( void *args )
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
video_capture_device_t device;
|
|
|
|
PTR32 data;
|
|
|
|
} const *params32 = args;
|
|
|
|
|
|
|
|
struct read_frame_params params =
|
|
|
|
{
|
|
|
|
params32->device,
|
|
|
|
ULongToPtr(params32->data)
|
|
|
|
};
|
|
|
|
|
|
|
|
return v4l_device_read_frame( ¶ms );
|
|
|
|
}
|
|
|
|
|
|
|
|
const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
|
|
|
|
{
|
|
|
|
wow64_v4l_device_create,
|
|
|
|
v4l_device_destroy,
|
|
|
|
wow64_v4l_device_check_format,
|
|
|
|
wow64_v4l_device_set_format,
|
|
|
|
wow64_v4l_device_get_format,
|
|
|
|
wow64_v4l_device_get_media_type,
|
|
|
|
wow64_v4l_device_get_caps,
|
|
|
|
wow64_v4l_device_get_caps_count,
|
|
|
|
wow64_v4l_device_get_prop_range,
|
|
|
|
wow64_v4l_device_get_prop,
|
|
|
|
v4l_device_set_prop,
|
|
|
|
wow64_v4l_device_read_frame,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _WIN64 */
|
|
|
|
|
2020-11-27 05:34:31 +01:00
|
|
|
#endif /* HAVE_LINUX_VIDEODEV2_H */
|