[FFmpeg-devel] [PATCH] improve error messages when strerror_r is not available (PR #20680)
PR #20680 opened by timblechmann
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20680
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20680.patch
* add more fallbacks with different error codes
* add strerror_s codepath for windows/msvc
>From 6ea5baadd63ae9ab37855fb3ede56415ff671663 Mon Sep 17 00:00:00 2001
From: Tim Blechmann
Date: Thu, 9 Oct 2025 14:44:21 +0800
Subject: [PATCH 1/2] avutil: add missing error codes
av_strerror does not implement fallbacks for many posix error codes when
strerror_r is not available. Adding the missing entries.
---
libavutil/error.c | 123 ++
1 file changed, 123 insertions(+)
diff --git a/libavutil/error.c b/libavutil/error.c
index 90bab7b9d3..e7867cad71 100644
--- a/libavutil/error.c
+++ b/libavutil/error.c
@@ -103,6 +103,129 @@ static const struct error_entry error_entries[] = {
{ EERROR_TAG(ESPIPE),"Illegal seek" },
{ EERROR_TAG(ESRCH), "No such process" },
{ EERROR_TAG(EXDEV), "Cross-device link" },
+#ifdef EADDRINUSE
+{ EERROR_TAG(EADDRINUSE),"Address in use" },
+#endif
+#ifdef EADDRNOTAVAIL
+{ EERROR_TAG(EADDRNOTAVAIL), "Address not available" },
+#endif
+#ifdef EAFNOSUPPORT
+{ EERROR_TAG(EAFNOSUPPORT), "Address family not supported" },
+#endif
+#ifdef EALREADY
+{ EERROR_TAG(EALREADY), "Connection already in progress" },
+#endif
+#ifdef EBADMSG
+{ EERROR_TAG(EBADMSG), "Bad message" },
+#endif
+#ifdef ECANCELED
+{ EERROR_TAG(ECANCELED), "Operation canceled" },
+#endif
+#ifdef ECONNABORTED
+{ EERROR_TAG(ECONNABORTED), "Connection aborted" },
+#endif
+#ifdef ECONNREFUSED
+{ EERROR_TAG(ECONNREFUSED), "Connection refused" },
+#endif
+#ifdef ECONNRESET
+{ EERROR_TAG(ECONNRESET),"Connection reset" },
+#endif
+#ifdef EDESTADDRREQ
+{ EERROR_TAG(EDESTADDRREQ), "Destination address required" },
+#endif
+#ifdef EHOSTUNREACH
+{ EERROR_TAG(EHOSTUNREACH), "Host unreachable" },
+#endif
+#ifdef EIDRM
+{ EERROR_TAG(EIDRM), "Identifier removed" },
+#endif
+#ifdef EINPROGRESS
+{ EERROR_TAG(EINPROGRESS), "Operation in progress" },
+#endif
+#ifdef EISCONN
+{ EERROR_TAG(EISCONN), "Already connected" },
+#endif
+#ifdef ELOOP
+{ EERROR_TAG(ELOOP), "Too many symbolic link levels" },
+#endif
+#ifdef EMSGSIZE
+{ EERROR_TAG(EMSGSIZE), "Message size" },
+#endif
+#ifdef ENETDOWN
+{ EERROR_TAG(ENETDOWN), "Network down" },
+#endif
+#ifdef ENETRESET
+{ EERROR_TAG(ENETRESET), "Network reset" },
+#endif
+#ifdef ENETUNREACH
+{ EERROR_TAG(ENETUNREACH), "Network unreachable" },
+#endif
+#ifdef ENOBUFS
+{ EERROR_TAG(ENOBUFS), "No buffer space" },
+#endif
+#ifdef ENODATA
+{ EERROR_TAG(ENODATA), "No message available" },
+#endif
+#ifdef ENOLINK
+{ EERROR_TAG(ENOLINK), "No link" },
+#endif
+#ifdef ENOMSG
+{ EERROR_TAG(ENOMSG),"No message" },
+#endif
+#ifdef ENOPROTOOPT
+{ EERROR_TAG(ENOPROTOOPT), "No protocol option" },
+#endif
+#ifdef ENOSR
+{ EERROR_TAG(ENOSR), "No stream resources" },
+#endif
+#ifdef ENOSTR
+{ EERROR_TAG(ENOSTR),"Not a stream" },
+#endif
+#ifdef ENOTCONN
+{ EERROR_TAG(ENOTCONN), "Not connected" },
+#endif
+#ifdef ENOTRECOVERABLE
+{ EERROR_TAG(ENOTRECOVERABLE), "State not recoverable" },
+#endif
+#ifdef ENOTSOCK
+{ EERROR_TAG(ENOTSOCK), "Not a socket" },
+#endif
+#ifdef ENOTSUP
+{ EERROR_TAG(ENOTSUP), "Not supported" },
+#endif
+#ifdef EOPNOTSUPP
+{ EERROR_TAG(EOPNOTSUPP),"Operation not supported" },
+#endif
+#ifdef EOTHER
+{ EERROR_TAG(EOTHER),"Other" },
+#endif
+#ifdef EOVERFLOW
+{ EERROR_TAG(EOVERFLOW), "Value too large" },
+#endif
+#ifdef EOWNERDEAD
+{ EERROR_TAG(EOWNERDEAD),"Owner dead" },
+#endif
+#ifdef EPROTO
+{ EERROR_TAG(EPROTO),"Protocol error" },
+#endif
+#ifdef EPROTONOSUPPORT
+{ EERROR_TAG(EPROTONOSUPPORT), "Protocol not supported" },
+#endif
+#ifdef EPROTOTYPE
+{ EERROR_TAG(EPROTOTYPE),"Wrong protocol type" },
+#endif
+#ifdef ETIME
+{ EERROR_TAG(ETIME), "Stream timeout" },
+#endif
+#ifdef ETIMEDOUT
+{ EERROR_TAG(ETIMEDOUT), "Timed out" },
+#endif
+#ifdef ETXTBSY
+{ EERROR_TAG(ETXTBSY), "Text file busy" },
+#endif
+#ifdef EWOULDBLOCK
+{ EERROR_TAG(EWOULDBLOCK), "Operation would block" },
+#endif
#endif
};
--
2.49.1
>From c09b672527fa32dd0950cfd998fe5aefaffb9550 Mon Sep 17 00:00:00 2001
From: Tim Blechmann
Date: Thu, 9 Oct 2025 14:53:22 +0800
Subject: [PATCH 2/2] avutil: av_strerror - add implementation via strerror_s
win32 does not have strerror_r, but strerror_s. adding a codepath to
av_strerror, that makes use of it.
---
libavutil/error.c | 10 --
1 file c
[FFmpeg-devel] [PATCH] libavutil: fix memory leak of drmVersion (PR #20678)
PR #20678 opened by timblechmann URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20678 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20678.patch i had submitted this patch before via email, but git-send-email workflow was rather cumbersome. very happy to see i can submit a PR now --- address sanitizer showed some leaks of drmVersion structs. `vaapi_device_create` did not call drmFreeVersion in all possible code paths. >From 6d9a92244faf365cf394cd7194cc3da5a0984276 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Wed, 25 Jun 2025 10:14:42 +0800 Subject: [PATCH] libavutil: fix memory leak of drmVersion address sanitizer showed some leaks of drmVersion structs. `vaapi_device_create` did not call drmFreeVersion in all possible code paths. --- libavutil/hwcontext_vaapi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 51af22a607..753dcf8905 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -1815,6 +1815,7 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, "Failed to get DRM device info for device %d.\n", n); close(priv->drm_fd); priv->drm_fd = -1; +drmFreeVersion(info); continue; } @@ -1826,6 +1827,7 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, drmFreeDevice(&device); close(priv->drm_fd); priv->drm_fd = -1; +drmFreeVersion(info); continue; } av_log(ctx, AV_LOG_VERBOSE, "Trying to use " @@ -1833,6 +1835,7 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, "with matching vendor id (%s).\n", n, vendor_id->value); drmFreeDevice(&device); +drmFreeVersion(info); break; } drmFreeVersion(info); -- 2.49.1 ___ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
[FFmpeg-devel] [PATCH] WIP: CoreVideo: add support for kCVPixelFormatType_422YpCbCr8_yuvs (PR #20679)
PR #20679 opened by timblechmann
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20679
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20679.patch
i'd appreciate a second pair of eyes on this patch: it tries to enable support
for kCVPixelFormatType_422YpCbCr8_yuvs mapped to AV_PIX_FMT_YUYV422. it is an
attempt to fix a bug in qtmultimedia when feeding video frames using
kCVPixelFormatType_422YpCbCr8_yuvs into ffmpeg.
context:
https://bugreports.qt.io/browse/QTBUG-137436
any thoughts if this goes into the correct direction?
>From 7c01c559d47210bcc231d95ee62d5246218a8b15 Mon Sep 17 00:00:00 2001
From: Tim Blechmann
Date: Tue, 24 Jun 2025 12:27:05 +0800
Subject: [PATCH] CoreVideo: add support for kCVPixelFormatType_422YpCbCr8_yuvs
---
configure | 1 +
libavutil/hwcontext_videotoolbox.c | 6 ++
2 files changed, 7 insertions(+)
diff --git a/configure b/configure
index 7828381b5d..a323492b9b 100755
--- a/configure
+++ b/configure
@@ -2531,6 +2531,7 @@ TYPES_LIST="
kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange
kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange
kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange
+kCVPixelFormatType_422YpCbCr8_yuvs
kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
kCVImageBufferTransferFunction_ITU_R_2100_HLG
kCVImageBufferTransferFunction_Linear
diff --git a/libavutil/hwcontext_videotoolbox.c
b/libavutil/hwcontext_videotoolbox.c
index 102fa485e5..2764097413 100644
--- a/libavutil/hwcontext_videotoolbox.c
+++ b/libavutil/hwcontext_videotoolbox.c
@@ -82,6 +82,9 @@ static const struct {
#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
{ kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange, false, AV_PIX_FMT_P416
},
#endif
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR8_YUVS
+{ kCVPixelFormatType_422YpCbCr8_yuvs, false,
AV_PIX_FMT_YUYV422 },
+#endif
};
static const enum AVPixelFormat supported_formats[] = {
@@ -112,6 +115,9 @@ static const enum AVPixelFormat supported_formats[] = {
#endif
#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
AV_PIX_FMT_P416,
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR8_YUVS
+AV_PIX_FMT_YUYV422,
#endif
AV_PIX_FMT_BGRA,
};
--
2.49.1
___
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
