Commit dfaa3ba5f3 for ffmpeg
commit dfaa3ba5f3b4750ca8456eee7e2047b1a35f5b25
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Fri Oct 16 02:52:43 2026 +0200
avformat/avio: add avio_open_dir2() with an interrupt callback
A directory listing that blocks in a protocol could not be
interrupted; avio_open_dir2() passes an interrupt callback to the
protocol like avio_open2() does.
Assisted-by: Claude
diff --git a/doc/APIchanges b/doc/APIchanges
index f7f9f5d9e1..da21e47e88 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2026-06-23.
API changes, most recent first:
+2026-10-xx - xxxxxxxxxx - lavf 63.11.100 - avio.h
+ Add avio_open_dir2().
+
2026-10-xx - xxxxxxxxxx - lavu 61.14.100 - gain_map.h
Add av_gain_map_params_from_iso21496() and av_gain_map_params_to_iso21496().
Add AV_GAIN_MAP_MAX_PAYLOAD_SIZE.
diff --git a/libavformat/avio.c b/libavformat/avio.c
index a2c94e4384..b0d2e067e4 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -797,7 +797,7 @@ struct AVIODirContext {
struct URLContext *url_context;
};
-int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options)
+int avio_open_dir2(AVIODirContext **s, const char *url, const AVIOInterruptCB *int_cb, AVDictionary **options)
{
URLContext *h = NULL;
AVIODirContext *ctx = NULL;
@@ -810,7 +810,7 @@ int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options)
goto fail;
}
- if ((ret = ffurl_alloc(&h, url, AVIO_FLAG_READ, NULL)) < 0)
+ if ((ret = ffurl_alloc(&h, url, AVIO_FLAG_READ, int_cb)) < 0)
goto fail;
if (h->prot->url_open_dir && h->prot->url_read_dir && h->prot->url_close_dir) {
@@ -835,6 +835,11 @@ int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options)
return ret;
}
+int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options)
+{
+ return avio_open_dir2(s, url, NULL, options);
+}
+
int avio_read_dir(AVIODirContext *s, AVIODirEntry **next)
{
URLContext *h;
diff --git a/libavformat/avio.h b/libavformat/avio.h
index fbcb7dbfc3..f790342805 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -341,6 +341,19 @@ int avio_check(const char *url, int flags);
*/
int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options);
+/**
+ * Open directory for reading, with an interrupt callback for the protocol.
+ *
+ * @param s directory read context. Pointer to a NULL pointer must be passed.
+ * @param url directory to be listed.
+ * @param int_cb an interrupt callback to be used at the protocols level, may be NULL.
+ * @param options A dictionary filled with protocol-private options. On return
+ * this parameter will be destroyed and replaced with a dictionary
+ * containing options that were not found. May be NULL.
+ * @return >=0 on success or negative on error.
+ */
+int avio_open_dir2(AVIODirContext **s, const char *url, const AVIOInterruptCB *int_cb, AVDictionary **options);
+
/**
* Get next directory entry.
*
diff --git a/libavformat/version.h b/libavformat/version.h
index 979952183c..1055753772 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#include "version_major.h"
-#define LIBAVFORMAT_VERSION_MINOR 10
+#define LIBAVFORMAT_VERSION_MINOR 11
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \