aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-03-09 18:35:56 +0100
committerAnton Khirnov <anton@khirnov.net>2021-03-16 10:38:41 +0100
commit7d09579190def3ef7562399489e628f3b65714ce (patch)
treed51d4586c7b44eaabc6d077bcc7af29e17d51d48
parent8a129077cc37202a00dd666bd5365c3f61ea2e80 (diff)
downloadffmpeg-7d09579190def3ef7562399489e628f3b65714ce.tar.gz
lavc: rename AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADS
This cap is currently used to mark multithreading-capable codecs that wrap external libraries with their own multithreading code. The name is highly confusing for our API users, since libavcodec ALWAYS handles thread_count=0 (see commit message in previous commit). Therefore rename the cap and update its documentation to make its meaning clear. The old name is kept deprecated until next+1 major bump.
-rw-r--r--doc/APIchanges5
-rw-r--r--fftools/cmdutils.c6
-rw-r--r--libavcodec/codec.h9
-rw-r--r--libavcodec/libaomdec.c2
-rw-r--r--libavcodec/libaomenc.c2
-rw-r--r--libavcodec/libdav1d.c2
-rw-r--r--libavcodec/libdavs2.c2
-rw-r--r--libavcodec/libkvazaar.c2
-rw-r--r--libavcodec/libopenh264enc.c2
-rw-r--r--libavcodec/librav1e.c2
-rw-r--r--libavcodec/libsvtav1.c2
-rw-r--r--libavcodec/libuavs3d.c2
-rw-r--r--libavcodec/libvpxdec.c4
-rw-r--r--libavcodec/libvpxenc.c4
-rw-r--r--libavcodec/libx264.c6
-rw-r--r--libavcodec/libx265.c2
-rw-r--r--libavcodec/libxavs.c2
-rw-r--r--libavcodec/libxavs2.c2
-rw-r--r--libavcodec/version.h5
19 files changed, 38 insertions, 25 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index c0d955b1fa..bed34df861 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,11 @@ libavutil: 2017-10-21
API changes, most recent first:
+2021-03-xx - xxxxxxxxxx - lavc 58.132.100 - codec.h
+ Add AV_CODEC_CAP_OTHER_THREADS as a new name for
+ AV_CODEC_CAP_AUTO_THREADS. AV_CODEC_CAP_AUTO_THREADS
+ is now deprecated.
+
2021-03-12 - xxxxxxxxxx - lavc 58.131.100 - avcodec.h codec.h
Add a get_encode_buffer callback to AVCodecContext, similar to
get_buffer2 but for encoders.
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 8cfca22564..5e2d3c174b 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -1415,7 +1415,7 @@ static void print_codec(const AVCodec *c)
printf("variable ");
if (c->capabilities & (AV_CODEC_CAP_FRAME_THREADS |
AV_CODEC_CAP_SLICE_THREADS |
- AV_CODEC_CAP_AUTO_THREADS))
+ AV_CODEC_CAP_OTHER_THREADS))
printf("threads ");
if (c->capabilities & AV_CODEC_CAP_AVOID_PROBING)
printf("avoidprobe ");
@@ -1432,12 +1432,12 @@ static void print_codec(const AVCodec *c)
printf(" Threading capabilities: ");
switch (c->capabilities & (AV_CODEC_CAP_FRAME_THREADS |
AV_CODEC_CAP_SLICE_THREADS |
- AV_CODEC_CAP_AUTO_THREADS)) {
+ AV_CODEC_CAP_OTHER_THREADS)) {
case AV_CODEC_CAP_FRAME_THREADS |
AV_CODEC_CAP_SLICE_THREADS: printf("frame and slice"); break;
case AV_CODEC_CAP_FRAME_THREADS: printf("frame"); break;
case AV_CODEC_CAP_SLICE_THREADS: printf("slice"); break;
- case AV_CODEC_CAP_AUTO_THREADS : printf("auto"); break;
+ case AV_CODEC_CAP_OTHER_THREADS: printf("other"); break;
default: printf("none"); break;
}
printf("\n");
diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index 1bb70260ac..50a22f6e3c 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -115,9 +115,14 @@
*/
#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14)
/**
- * Codec supports avctx->thread_count == 0 (auto).
+ * Codec supports multithreading through a method other than slice- or
+ * frame-level multithreading. Typically this marks wrappers around
+ * multithreading-capable external libraries.
*/
-#define AV_CODEC_CAP_AUTO_THREADS (1 << 15)
+#define AV_CODEC_CAP_OTHER_THREADS (1 << 15)
+#if FF_API_AUTO_THREADS
+#define AV_CODEC_CAP_AUTO_THREADS AV_CODEC_CAP_OTHER_THREADS
+#endif
/**
* Audio encoder supports receiving a different number of samples in each call.
*/
diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index 327a5e18fb..1fc0a0001d 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -236,7 +236,7 @@ AVCodec ff_libaom_av1_decoder = {
.init = av1_init,
.close = aom_free,
.decode = aom_decode,
- .capabilities = AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_OTHER_THREADS | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
.wrapper_name = "libaom",
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index f99fdc0b73..2c3c3eb185 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -1345,7 +1345,7 @@ AVCodec ff_libaom_av1_encoder = {
.init = av1_init,
.encode2 = aom_encode,
.close = aom_free,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
.priv_class = &class_aom,
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 93aeab4cb1..3c2a68b7e0 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -484,7 +484,7 @@ AVCodec ff_libdav1d_decoder = {
.close = libdav1d_close,
.flush = libdav1d_flush,
.receive_frame = libdav1d_receive_frame,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SETS_PKT_DTS |
FF_CODEC_CAP_AUTO_THREADS,
.priv_class = &libdav1d_class,
diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index f6a03df373..383b54039a 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -221,7 +221,7 @@ AVCodec ff_libdavs2_decoder = {
.close = davs2_end,
.decode = davs2_decode_frame,
.flush = davs2_flush,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index f75aa4eda3..4432649853 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -330,7 +330,7 @@ AVCodec ff_libkvazaar_encoder = {
.long_name = NULL_IF_CONFIG_SMALL("libkvazaar H.265 / HEVC"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_HEVC,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.pix_fmts = pix_fmts,
.priv_class = &class,
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index cb5deb8b50..0eade73498 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -447,7 +447,7 @@ AVCodec ff_libopenh264_encoder = {
.init = svc_encode_init,
.encode2 = svc_encode_frame,
.close = svc_encode_close,
- .capabilities = AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP |
FF_CODEC_CAP_AUTO_THREADS,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index bd93073664..34158bc75a 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -624,7 +624,7 @@ AVCodec ff_librav1e_encoder = {
.priv_class = &class,
.defaults = librav1e_defaults,
.pix_fmts = librav1e_pix_fmts,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS,
.wrapper_name = "librav1e",
};
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 4244ae1daa..cfd93a2484 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -560,7 +560,7 @@ AVCodec ff_libsvtav1_encoder = {
.init = eb_enc_init,
.receive_packet = eb_receive_packet,
.close = eb_enc_close,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV420P10,
diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c
index 6bc0ba09f0..be03da39e2 100644
--- a/libavcodec/libuavs3d.c
+++ b/libavcodec/libuavs3d.c
@@ -253,7 +253,7 @@ AVCodec ff_libuavs3d_decoder = {
.init = libuavs3d_init,
.close = libuavs3d_end,
.decode = libuavs3d_decode_frame,
- .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.flush = libuavs3d_flush,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 8a4e4fd149..9b5728fba4 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -361,7 +361,7 @@ AVCodec ff_libvpx_vp8_decoder = {
.init = vp8_init,
.close = vpx_free,
.decode = vpx_decode,
- .capabilities = AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_OTHER_THREADS | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.wrapper_name = "libvpx",
};
@@ -383,7 +383,7 @@ AVCodec ff_libvpx_vp9_decoder = {
.init = vp9_init,
.close = vpx_free,
.decode = vpx_decode,
- .capabilities = AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.init_static_data = ff_vp9_init_static,
.profiles = NULL_IF_CONFIG_SMALL(ff_vp9_profiles),
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index df79839df5..3f36943c12 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1870,7 +1870,7 @@ AVCodec ff_libvpx_vp8_encoder = {
.init = vp8_init,
.encode2 = vpx_encode,
.close = vpx_free,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE },
.priv_class = &class_vp8,
@@ -1901,7 +1901,7 @@ AVCodec ff_libvpx_vp9_encoder = {
.init = vp9_init,
.encode2 = vpx_encode,
.close = vpx_free,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.profiles = NULL_IF_CONFIG_SMALL(ff_vp9_profiles),
.priv_class = &class_vp9,
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index f152e453ce..4ddc4973a4 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -1202,7 +1202,7 @@ AVCodec ff_libx264_encoder = {
.init = X264_init,
.encode2 = X264_frame,
.close = X264_close,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS |
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.priv_class = &x264_class,
@@ -1238,7 +1238,7 @@ AVCodec ff_libx264rgb_encoder = {
.init = X264_init,
.encode2 = X264_frame,
.close = X264_close,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS |
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.priv_class = &rgbclass,
.defaults = x264_defaults,
@@ -1269,7 +1269,7 @@ AVCodec ff_libx262_encoder = {
.init = X264_init,
.encode2 = X264_frame,
.close = X264_close,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS |
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.priv_class = &X262_class,
.defaults = x264_defaults,
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index d502f47662..b2008e96f1 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -700,7 +700,7 @@ AVCodec ff_libx265_encoder = {
.priv_data_size = sizeof(libx265Context),
.priv_class = &class,
.defaults = x265_defaults,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS |
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.wrapper_name = "libx265",
diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c
index 12d5a5eb9e..a83b93b836 100644
--- a/libavcodec/libxavs.c
+++ b/libavcodec/libxavs.c
@@ -475,7 +475,7 @@ AVCodec ff_libxavs_encoder = {
.init = XAVS_init,
.encode2 = XAVS_frame,
.close = XAVS_close,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.priv_class = &xavs_class,
diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c
index cd29d2b938..2a4a3e36bd 100644
--- a/libavcodec/libxavs2.c
+++ b/libavcodec/libxavs2.c
@@ -294,7 +294,7 @@ AVCodec ff_libxavs2_encoder = {
.init = xavs2_init,
.encode2 = xavs2_encode_frame,
.close = xavs2_close,
- .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 4299ad4239..4e5a630862 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 58
-#define LIBAVCODEC_VERSION_MINOR 131
+#define LIBAVCODEC_VERSION_MINOR 132
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -162,5 +162,8 @@
#ifndef FF_API_GET_FRAME_CLASS
#define FF_API_GET_FRAME_CLASS (LIBAVCODEC_VERSION_MAJOR < 60)
#endif
+#ifndef FF_API_AUTO_THREADS
+#define FF_API_AUTO_THREADS (LIBAVCODEC_VERSION_MAJOR < 60)
+#endif
#endif /* AVCODEC_VERSION_H */