Module: wine Branch: master Commit: d4ded92b024441e98b0ec80db6a11c074c2ed494 URL: https://source.winehq.org/git/wine.git/?a=commit;h=d4ded92b024441e98b0ec80db...
Author: Zebediah Figura z.figura12@gmail.com Date: Thu Nov 26 22:34:31 2020 -0600
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
---
dlls/qcap/qcap_main.c | 2 +- dlls/qcap/qcap_private.h | 4 ++-- dlls/qcap/v4l.c | 25 ++++++++++++++----------- dlls/qcap/vfwcapture.c | 5 +++-- 4 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/dlls/qcap/qcap_main.c b/dlls/qcap/qcap_main.c index 411ef41ea20..e211b74dada 100644 --- a/dlls/qcap/qcap_main.c +++ b/dlls/qcap/qcap_main.c @@ -25,7 +25,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
-static HINSTANCE qcap_instance; +HINSTANCE qcap_instance;
static LONG objects_ref = 0;
diff --git a/dlls/qcap/qcap_private.h b/dlls/qcap/qcap_private.h index 379d9908637..046821142d2 100644 --- a/dlls/qcap/qcap_private.h +++ b/dlls/qcap/qcap_private.h @@ -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 diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c index 2ba423ea0e5..fd2c087640f 100644 --- a/dlls/qcap/v4l.c +++ b/dlls/qcap/v4l.c @@ -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 v4l_funcs = -{ - .create = v4l_device_create, -}; + *(const struct video_capture_funcs **)ptr_out = &v4l_funcs; + return STATUS_SUCCESS; +}
-#endif /* defined(VIDIOCMCAPTURE) */ +#endif /* HAVE_LINUX_VIDEODEV2_H */ diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 8123dc4f6f7..7b8787ef99f 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -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))))