qcap: Move v4l2 support to a new Unix library.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-11-26 22:34:31 -06:00 committed by Alexandre Julliard
parent 8bcb4466c9
commit d4ded92b02
4 changed files with 20 additions and 16 deletions

View file

@ -25,7 +25,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
static HINSTANCE qcap_instance;
HINSTANCE qcap_instance;
static LONG objects_ref = 0;

View file

@ -30,6 +30,8 @@
#include "wine/strmbase.h"
#include "wine/unicode.h"
extern HINSTANCE qcap_instance DECLSPEC_HIDDEN;
extern DWORD ObjectRefCount(BOOL increment) DECLSPEC_HIDDEN;
HRESULT audio_record_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
@ -59,6 +61,4 @@ struct video_capture_funcs
BOOL (*read_frame)(struct video_capture_device *device, BYTE *data);
};
extern const struct video_capture_funcs v4l_funcs;
#endif

View file

@ -19,6 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#if 0
#pragma makedep unix
#endif
#define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD /* work around ioctl breakage on Android */
#include "config.h"
@ -47,7 +51,11 @@
#include <unistd.h>
#endif
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "initguid.h"
#include "qcap_private.h"
#include "winternl.h"
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
@ -558,17 +566,12 @@ const struct video_capture_funcs v4l_funcs =
.read_frame = v4l_device_read_frame,
};
#else
static struct video_capture_device *v4l_device_create(USHORT index)
NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out)
{
ERR("v4l2 was not present at compilation time.\n");
return NULL;
if (reason != DLL_PROCESS_ATTACH) return STATUS_SUCCESS;
*(const struct video_capture_funcs **)ptr_out = &v4l_funcs;
return STATUS_SUCCESS;
}
const struct video_capture_funcs v4l_funcs =
{
.create = v4l_device_create,
};
#endif /* defined(VIDIOCMCAPTURE) */
#endif /* HAVE_LINUX_VIDEODEV2_H */

View file

@ -19,6 +19,7 @@
*/
#include "qcap_private.h"
#include "winternl.h"
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
@ -839,7 +840,7 @@ static const IAMVideoControlVtbl IAMVideoControl_VTable =
static BOOL WINAPI load_capture_funcs(INIT_ONCE *once, void *param, void **context)
{
capture_funcs = &v4l_funcs;
__wine_init_unix_lib(qcap_instance, DLL_PROCESS_ATTACH, NULL, &capture_funcs);
return TRUE;
}
@ -850,7 +851,7 @@ HRESULT vfw_capture_create(IUnknown *outer, IUnknown **out)
static const WCHAR source_name[] = {'O','u','t','p','u','t',0};
struct vfw_capture *object;
if (!InitOnceExecuteOnce(&init_once, load_capture_funcs, NULL, NULL))
if (!InitOnceExecuteOnce(&init_once, load_capture_funcs, NULL, NULL) || !capture_funcs)
return E_FAIL;
if (!(object = CoTaskMemAlloc(sizeof(*object))))