The UUID library is even more ubiquitous than iconv, and it hasn't changed its API and ABI for maybe 20 years. MediaFoundation and dshow already depends on it silently, and vulkan can optionally use it to parse user-given UUIDs, which I think would be a popular way to specify devices on servers.
Patch attached.
>From b3f2e72e6f86db86b6cbb8bcc755caeee23bdfe9 Mon Sep 17 00:00:00 2001 From: Lynne <d...@lynne.ee> Date: Fri, 12 Nov 2021 06:38:27 +0100 Subject: [PATCH] configure: autodetect uuid and use it for dshow and vulkan The UUID library is even more ubiquitous than iconv, and it hasn't changed its API and ABI for maybe 20 years. dshow already depends on it silently, and vulkan can optionally use it to parse user-given UUIDs, which I think would be a popular way to specify devices on servers. --- configure | 13 ++++++++++--- doc/ffmpeg.texi | 6 ++++-- libavutil/hwcontext_vulkan.c | 10 +++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/configure b/configure index eb451d2782..11bdff1a40 100755 --- a/configure +++ b/configure @@ -321,6 +321,7 @@ External library support: --disable-sdl2 disable sdl2 [autodetect] --disable-securetransport disable Secure Transport, needed for TLS support on OSX if openssl and gnutls are not used [autodetect] + --disable-uuid disable uuid [autodetect] --enable-vapoursynth enable VapourSynth demuxer [no] --enable-vulkan enable Vulkan code [no] --disable-xlib disable xlib [autodetect] @@ -1747,6 +1748,7 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST=" sdl2 securetransport sndio + uuid xlib zlib " @@ -2964,6 +2966,7 @@ vaapi_x11_deps="xlib_x11" videotoolbox_hwaccel_deps="videotoolbox pthreads" videotoolbox_hwaccel_extralibs="-framework QuartzCore" vulkan_deps_any="libdl LoadLibrary" +vulkan_suggest="uuid" xvmc_deps="X11_extensions_XvMClib_h" av1_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_AV1" @@ -3454,8 +3457,8 @@ decklink_indev_extralibs="-lstdc++" decklink_outdev_deps="decklink threads" decklink_outdev_suggest="libklvanc" decklink_outdev_extralibs="-lstdc++" -dshow_indev_deps="IBaseFilter" -dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi" +dshow_indev_deps="IBaseFilter uuid" +dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -loleaut32 -lshlwapi" fbdev_indev_deps="linux_fb_h" fbdev_outdev_deps="linux_fb_h" gdigrab_indev_deps="CreateDIBSection" @@ -3743,7 +3746,7 @@ avfilter_deps="avutil" avfilter_suggest="libm" avformat_deps="avcodec avutil" avformat_suggest="libm network zlib" -avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt" +avutil_suggest="clock_gettime ffnvcodec libm libdrm libmfx uuid opencl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia bcrypt" postproc_deps="avutil gpl" postproc_suggest="libm" swresample_deps="avutil" @@ -6826,6 +6829,10 @@ enabled vdpau && enabled vdpau && check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11 +enabled uuid && + check_pkg_config uuid uuid "uuid/uuid.h" uuid_parse || + check_lib uuid "uuid/uuid.h" uuid_parse -luuid + enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd if enabled vulkan; then diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 62d9703b7a..ddee99b364 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1184,8 +1184,10 @@ extension. @item vulkan If @var{device} is an integer, it selects the device by its index in a -system-dependent list of devices. If @var{device} is any other string, it -selects the first device with a name containing that string as a substring. +system-dependent list of devices. If @var{device} is a UUID, the device +will be selected by checking for matching UUIDs. If @var{device} is any other +string, it selects the first device with a name containing that string as a +substring. The following options are recognized: @table @option diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 93a304ca95..29197a2100 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -38,6 +38,10 @@ #include <dlfcn.h> #endif +#if CONFIG_UUID +#include <uuid/uuid.h> +#endif + #if CONFIG_LIBDRM #include <xf86drm.h> #include <drm_fourcc.h> @@ -1367,7 +1371,11 @@ static int vulkan_device_create(AVHWDeviceContext *ctx, const char *device, dev_select.index = strtol(device, &end, 10); if (end == device) { dev_select.index = 0; - dev_select.name = device; +#if CONFIG_UUID + if (!uuid_parse(device, dev_select.uuid)) + dev_select.has_uuid = 1; +#endif + dev_select.name = device; } } -- 2.33.0.252.g9b09ab0cd71
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".