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.
This commit is contained in:
Anton Khirnov 2021-03-09 18:35:56 +01:00
parent 8a129077cc
commit 7d09579190
19 changed files with 38 additions and 25 deletions

View File

@ -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.

View File

@ -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");

View File

@ -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.
*/

View File

@ -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",

View File

@ -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,

View File

@ -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,

View File

@ -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 },

View File

@ -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,

View File

@ -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,

View File

@ -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",
};

View File

@ -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,

View File

@ -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,

View File

@ -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),

View File

@ -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,

View File

@ -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,

View File

@ -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",

View File

@ -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,

View File

@ -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 },

View File

@ -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 */