1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec: Add FF_CODEC_CAP_NOT_INIT_THREADSAFE

This is in preparation of switching the default init-thread-safety
to a codec being init-thread-safe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-07-09 22:25:41 +02:00
parent c597510434
commit 6aad1204cc
62 changed files with 117 additions and 37 deletions

View File

@ -391,7 +391,8 @@ const FFCodec ff_h264_amf_encoder = {
.defaults = defaults,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = ff_amf_pix_fmts,
.p.wrapper_name = "amf",
.hw_configs = ff_amfenc_hw_configs,

View File

@ -323,7 +323,8 @@ const FFCodec ff_hevc_amf_encoder = {
.defaults = defaults,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = ff_amf_pix_fmts,
.p.wrapper_name = "amf",
.hw_configs = ff_amfenc_hw_configs,

View File

@ -29,6 +29,13 @@
* allowing to call the init function without locking any global mutexes.
*/
#define FF_CODEC_CAP_INIT_THREADSAFE (1 << 0)
/**
* The codec is not known to be init-threadsafe (i.e. it might be unsafe
* to initialize this codec and another codec concurrently, typically because
* the codec calls external APIs that are not known to be thread-safe).
* Therefore calling the codec's init function needs to be guarded with a lock.
*/
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE (1 << 9)
/**
* The codec allows calling the close function for deallocation even if
* the init function returned a failure. Without this capability flag, a

View File

@ -787,7 +787,8 @@ static int crystalhd_receive_frame(AVCodecContext *avctx, AVFrame *frame)
.flush = flush, \
.bsfs = bsf_name, \
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, \
.caps_internal = FF_CODEC_CAP_SETS_FRAME_PROPS, \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_SETS_FRAME_PROPS, \
.p.pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, \
.p.wrapper_name = "crystalhd", \
};

View File

@ -1129,7 +1129,8 @@ static const AVCodecHWConfigInternal *const cuvid_hw_configs[] = {
.flush = cuvid_flush, \
.bsfs = bsf_name, \
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, \
.caps_internal = FF_CODEC_CAP_SETS_FRAME_PROPS, \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_SETS_FRAME_PROPS, \
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_CUDA, \
AV_PIX_FMT_NV12, \
AV_PIX_FMT_P010, \

View File

@ -258,7 +258,8 @@ const FFCodec ff_libaom_av1_decoder = {
.close = aom_free,
FF_CODEC_DECODE_CB(aom_decode),
.p.capabilities = AV_CODEC_CAP_OTHER_THREADS | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.p.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
.p.wrapper_name = "libaom",
};

View File

@ -1442,7 +1442,8 @@ FFCodec ff_libaom_av1_encoder = {
.init = av1_init,
FF_CODEC_ENCODE_CB(aom_encode),
.close = aom_free,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.defaults = defaults,
.init_static_data = av1_init_static,
};

View File

@ -388,6 +388,7 @@ const FFCodec ff_libaribb24_decoder = {
.p.id = AV_CODEC_ID_ARIB_CAPTION,
.p.priv_class = &aribb24_class,
.p.wrapper_name = "libaribb24",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(Libaribb24Context),
.init = libaribb24_init,
.close = libaribb24_close,

View File

@ -134,6 +134,7 @@ const FFCodec ff_libcelt_decoder = {
.p.id = AV_CODEC_ID_CELT,
.p.capabilities = AV_CODEC_CAP_DR1,
.p.wrapper_name = "libcelt",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(struct libcelt_context),
.init = libcelt_dec_init,
.close = libcelt_dec_close,

View File

@ -185,6 +185,7 @@ const FFCodec ff_libcodec2_decoder = {
.p.supported_samplerates = (const int[]){ 8000, 0 },
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO, { 0 } },
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibCodec2Context),
.init = libcodec2_init_decoder,
.close = libcodec2_close,
@ -204,6 +205,7 @@ const FFCodec ff_libcodec2_encoder = {
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO, { 0 } },
.p.priv_class = &libcodec2_enc_class,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibCodec2Context),
.init = libcodec2_init_encoder,
.close = libcodec2_close,

View File

@ -232,7 +232,8 @@ const FFCodec ff_libdavs2_decoder = {
FF_CODEC_DECODE_CB(davs2_decode_frame),
.flush = davs2_flush,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
.p.wrapper_name = "libdavs2",

View File

@ -480,6 +480,7 @@ const FFCodec ff_libfdk_aac_encoder = {
.p.long_name = NULL_IF_CONFIG_SMALL("Fraunhofer FDK AAC"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AAC,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(AACContext),
.init = aac_encode_init,
FF_CODEC_ENCODE_CB(aac_encode_frame),

View File

@ -132,6 +132,7 @@ const FFCodec ff_libgsm_decoder = {
.p.id = AV_CODEC_ID_GSM,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
.p.wrapper_name = "libgsm",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibGSMDecodeContext),
.init = libgsm_decode_init,
.close = libgsm_decode_close,
@ -147,6 +148,7 @@ const FFCodec ff_libgsm_ms_decoder = {
.p.id = AV_CODEC_ID_GSM_MS,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
.p.wrapper_name = "libgsm",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibGSMDecodeContext),
.init = libgsm_decode_init,
.close = libgsm_decode_close,

View File

@ -134,6 +134,7 @@ const FFCodec ff_libgsm_encoder = {
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
.p.wrapper_name = "libgsm",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
};
#endif
#if CONFIG_LIBGSM_MS_ENCODER
@ -154,5 +155,6 @@ const FFCodec ff_libgsm_ms_encoder = {
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
.p.wrapper_name = "libgsm",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
};
#endif

View File

@ -122,6 +122,7 @@ const FFCodec ff_libilbc_decoder = {
.p.long_name = NULL_IF_CONFIG_SMALL("iLBC (Internet Low Bitrate Codec)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_ILBC,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(ILBCDecContext),
.init = ilbc_decode_init,
FF_CODEC_DECODE_CB(ilbc_decode_frame),
@ -204,6 +205,7 @@ const FFCodec ff_libilbc_encoder = {
.p.long_name = NULL_IF_CONFIG_SMALL("iLBC (Internet Low Bitrate Codec)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_ILBC,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(ILBCEncContext),
.init = ilbc_encode_init,
FF_CODEC_ENCODE_CB(ilbc_encode_frame),

View File

@ -455,6 +455,7 @@ const FFCodec ff_libjxl_decoder = {
FF_CODEC_DECODE_CB(libjxl_decode_frame),
.close = libjxl_decode_close,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP,
.p.wrapper_name = "libjxl",
};

View File

@ -468,7 +468,8 @@ const FFCodec ff_libjxl_encoder = {
FF_CODEC_ENCODE_CB(libjxl_encode_frame),
.close = libjxl_encode_close,
.p.capabilities = AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA,
AV_PIX_FMT_RGB48, AV_PIX_FMT_RGBA64,

View File

@ -335,6 +335,7 @@ const FFCodec ff_libmp3lame_encoder = {
.p.id = AV_CODEC_ID_MP3,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_SMALL_LAST_FRAME,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LAMEContext),
.init = mp3lame_encode_init,
FF_CODEC_ENCODE_CB(mp3lame_encode_frame),

View File

@ -138,6 +138,7 @@ const FFCodec ff_libopencore_amrnb_decoder = {
.p.long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AMR_NB,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(AMRContext),
.init = amr_nb_decode_init,
.close = amr_nb_decode_close,
@ -293,6 +294,7 @@ const FFCodec ff_libopencore_amrnb_encoder = {
.p.long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AMR_NB,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(AMRContext),
.init = amr_nb_encode_init,
FF_CODEC_ENCODE_CB(amr_nb_encode_frame),
@ -379,6 +381,7 @@ const FFCodec ff_libopencore_amrwb_decoder = {
.p.id = AV_CODEC_ID_AMR_WB,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
.p.wrapper_name = "libopencore_amrwb",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(AMRWBContext),
.init = amr_wb_decode_init,
.close = amr_wb_decode_close,

View File

@ -509,6 +509,7 @@ const FFCodec ff_libopenjpeg_decoder = {
.p.max_lowres = 31,
.p.priv_class = &openjpeg_class,
.p.wrapper_name = "libopenjpeg",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibOpenJPEGContext),
.init = libopenjpeg_decode_init,
FF_CODEC_DECODE_CB(libopenjpeg_decode_frame),

View File

@ -759,6 +759,7 @@ const FFCodec ff_libopenjpeg_encoder = {
.p.long_name = NULL_IF_CONFIG_SMALL("OpenJPEG JPEG 2000"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_JPEG2000,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibOpenJPEGContext),
.init = libopenjpeg_encode_init,
FF_CODEC_ENCODE_CB(libopenjpeg_encode_frame),

View File

@ -241,7 +241,8 @@ const FFCodec ff_libopus_decoder = {
FF_CODEC_DECODE_CB(libopus_decode),
.flush = libopus_flush,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },

View File

@ -588,6 +588,7 @@ const FFCodec ff_libopus_encoder = {
.p.long_name = NULL_IF_CONFIG_SMALL("libopus Opus"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_OPUS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibopusEncContext),
.init = libopus_encode_init,
FF_CODEC_ENCODE_CB(libopus_encode),

View File

@ -628,6 +628,7 @@ const FFCodec ff_librav1e_encoder = {
.p.pix_fmts = librav1e_pix_fmts,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS |
AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS,
.p.wrapper_name = "librav1e",
};

View File

@ -137,6 +137,7 @@ const FFCodec ff_libshine_encoder = {
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_MP3,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(SHINEContext),
.init = libshine_encode_init,
FF_CODEC_ENCODE_CB(libshine_encode_frame),

View File

@ -197,6 +197,7 @@ const FFCodec ff_libspeex_decoder = {
.p.id = AV_CODEC_ID_SPEEX,
.p.capabilities = AV_CODEC_CAP_SUBFRAMES | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
.p.wrapper_name = "libspeex",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibSpeexContext),
.init = libspeex_decode_init,
.close = libspeex_decode_close,

View File

@ -353,6 +353,7 @@ const FFCodec ff_libspeex_encoder = {
.p.long_name = NULL_IF_CONFIG_SMALL("libspeex Speex"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_SPEEX,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibSpeexEncContext),
.init = encode_init,
FF_CODEC_ENCODE_CB(encode_frame),

View File

@ -666,7 +666,8 @@ const FFCodec ff_libsvtav1_encoder = {
FF_CODEC_RECEIVE_PACKET_CB(eb_receive_packet),
.close = eb_enc_close,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS | FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV420P10,
AV_PIX_FMT_NONE },

View File

@ -374,6 +374,7 @@ const FFCodec ff_libtheora_encoder = {
.p.id = AV_CODEC_ID_THEORA,
.p.capabilities = AV_CODEC_CAP_DR1 |
AV_CODEC_CAP_DELAY /* for statsfile summary */,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(TheoraContext),
.init = encode_init,
.close = encode_close,

View File

@ -214,6 +214,7 @@ const FFCodec ff_libtwolame_encoder = {
.p.long_name = NULL_IF_CONFIG_SMALL("libtwolame MP2 (MPEG audio layer 2)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_MP2,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(TWOLAMEContext),
.init = twolame_encode_init,
FF_CODEC_ENCODE_CB(twolame_encode_frame),

View File

@ -256,7 +256,8 @@ const FFCodec ff_libuavs3d_decoder = {
.close = libuavs3d_end,
FF_CODEC_DECODE_CB(libuavs3d_decode_frame),
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.flush = libuavs3d_flush,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV420P10LE,

View File

@ -148,6 +148,7 @@ const FFCodec ff_libvo_amrwbenc_encoder = {
.p.id = AV_CODEC_ID_AMR_WB,
.p.priv_class = &amrwb_class,
.p.wrapper_name = "libvo_amrwbenc",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(AMRWBContext),
.init = amr_wb_encode_init,
FF_CODEC_ENCODE_CB(amr_wb_encode_frame),

View File

@ -216,6 +216,7 @@ const FFCodec ff_libvorbis_decoder = {
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_VORBIS,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_CHANNEL_CONF,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(OggVorbisDecContext),
.init = oggvorbis_decode_init,
FF_CODEC_DECODE_CB(oggvorbis_decode_frame),

View File

@ -382,6 +382,7 @@ const FFCodec ff_libvorbis_encoder = {
.p.id = AV_CODEC_ID_VORBIS,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_SMALL_LAST_FRAME,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibvorbisEncContext),
.init = libvorbis_encode_init,
FF_CODEC_ENCODE_CB(libvorbis_encode_frame),

View File

@ -366,7 +366,8 @@ const FFCodec ff_libvpx_vp8_decoder = {
.init = vp8_init,
.close = vpx_free,
FF_CODEC_DECODE_CB(vpx_decode),
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
};
#endif /* CONFIG_LIBVPX_VP8_DECODER */
@ -389,7 +390,8 @@ FFCodec ff_libvpx_vp9_decoder = {
.init = vp9_init,
.close = vpx_free,
FF_CODEC_DECODE_CB(vpx_decode),
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.init_static_data = ff_vp9_init_static,
};
#endif /* CONFIG_LIBVPX_VP9_DECODER */

View File

@ -1951,7 +1951,8 @@ const FFCodec ff_libvpx_vp8_encoder = {
.init = vp8_init,
FF_CODEC_ENCODE_CB(vpx_encode),
.close = vpx_free,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE },
.p.priv_class = &class_vp8,
.defaults = defaults,
@ -1986,7 +1987,8 @@ FFCodec ff_libvpx_vp9_encoder = {
.init = vp9_init,
FF_CODEC_ENCODE_CB(vpx_encode),
.close = vpx_free,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.defaults = defaults,
.init_static_data = ff_vp9_init_static,
};

View File

@ -96,6 +96,7 @@ const FFCodec ff_libwebp_encoder = {
.p.pix_fmts = ff_libwebpenc_pix_fmts,
.p.priv_class = &ff_libwebpenc_class,
.p.wrapper_name = "libwebp",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibWebPContext),
.defaults = ff_libwebp_defaults,
.init = libwebp_encode_init,

View File

@ -138,6 +138,7 @@ const FFCodec ff_libwebp_anim_encoder = {
.p.pix_fmts = ff_libwebpenc_pix_fmts,
.p.priv_class = &ff_libwebpenc_class,
.p.wrapper_name = "libwebp",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(LibWebPAnimContext),
.defaults = ff_libwebp_defaults,
.init = libwebp_anim_encode_init,

View File

@ -1239,6 +1239,8 @@ FFCodec ff_libx264_encoder = {
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS
#if X264_BUILD >= 158
| FF_CODEC_CAP_INIT_THREADSAFE
#else
| FF_CODEC_CAP_NOT_INIT_THREADSAFE
#endif
,
};
@ -1271,6 +1273,8 @@ const FFCodec ff_libx264rgb_encoder = {
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS
#if X264_BUILD >= 158
| FF_CODEC_CAP_INIT_THREADSAFE
#else
| FF_CODEC_CAP_NOT_INIT_THREADSAFE
#endif
,
};
@ -1300,6 +1304,7 @@ const FFCodec ff_libx262_encoder = {
FF_CODEC_ENCODE_CB(X264_frame),
.close = X264_close,
.defaults = x264_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS,
};
#endif

View File

@ -757,5 +757,6 @@ FFCodec ff_libx265_encoder = {
.close = libx265_encode_close,
.priv_data_size = sizeof(libx265Context),
.defaults = x265_defaults,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
};

View File

@ -432,7 +432,8 @@ const FFCodec ff_libxavs_encoder = {
.init = XAVS_init,
FF_CODEC_ENCODE_CB(XAVS_frame),
.close = XAVS_close,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.p.priv_class = &xavs_class,
.defaults = xavs_defaults,

View File

@ -297,7 +297,8 @@ const FFCodec ff_libxavs2_encoder = {
.init = xavs2_init,
FF_CODEC_ENCODE_CB(xavs2_encode_frame),
.close = xavs2_close,
.caps_internal = FF_CODEC_CAP_AUTO_THREADS,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_AUTO_THREADS,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
.p.priv_class = &libxavs2,

View File

@ -819,6 +819,7 @@ const FFCodec ff_libzvbi_teletext_decoder = {
.p.capabilities = AV_CODEC_CAP_DELAY,
.p.priv_class = &teletext_class,
.p.wrapper_name = "libzvbi",
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
.priv_data_size = sizeof(TeletextContext),
.init = teletext_init_decoder,
.close = teletext_close_decoder,

View File

@ -544,7 +544,8 @@ const FFCodec ff_ ## short_name ## _mediacodec_decoder = {
.flush = mediacodec_decode_flush, \
.close = mediacodec_decode_close, \
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, \
.caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_SETS_PKT_DTS, \
.bsfs = bsf, \
.hw_configs = mediacodec_hw_configs, \
.p.wrapper_name = "mediacodec", \

View File

@ -841,7 +841,8 @@ static const AVClass ffmmal_dec_class = {
.flush = ffmmal_flush, \
.p.priv_class = &ffmmal_dec_class, \
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, \
.caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_SETS_PKT_DTS, \
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_MMAL, \
AV_PIX_FMT_YUV420P, \
AV_PIX_FMT_NONE}, \

View File

@ -233,7 +233,8 @@ const FFCodec ff_h264_nvenc_encoder = {
.defaults = defaults,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_ENCODER_FLUSH | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = ff_nvenc_pix_fmts,
.p.wrapper_name = "nvenc",
.hw_configs = ff_nvenc_hw_configs,

View File

@ -215,7 +215,8 @@ const FFCodec ff_hevc_nvenc_encoder = {
.p.pix_fmts = ff_nvenc_pix_fmts,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_ENCODER_FLUSH | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.wrapper_name = "nvenc",
.hw_configs = ff_nvenc_hw_configs,
};

View File

@ -1025,6 +1025,7 @@ const FFCodec ff_##x##_qsv_decoder = { \
AV_PIX_FMT_NONE }, \
.hw_configs = qsv_hw_configs, \
.p.wrapper_name = "qsv", \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE, \
}; \
#define DEFINE_QSV_DECODER(x, X, bsf_name) DEFINE_QSV_DECODER_WITH_OPTION(x, X, bsf_name, options)

View File

@ -200,7 +200,8 @@ const FFCodec ff_h264_qsv_encoder = {
AV_PIX_FMT_NONE },
.p.priv_class = &class,
.defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.wrapper_name = "qsv",
.hw_configs = ff_qsv_enc_hw_configs,
};

View File

@ -315,7 +315,8 @@ const FFCodec ff_hevc_qsv_encoder = {
AV_PIX_FMT_NONE },
.p.priv_class = &class,
.defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.wrapper_name = "qsv",
.hw_configs = ff_qsv_enc_hw_configs,
};

View File

@ -96,4 +96,5 @@ const FFCodec ff_mjpeg_qsv_encoder = {
.defaults = qsv_enc_defaults,
.p.wrapper_name = "qsv",
.hw_configs = ff_qsv_enc_hw_configs,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE,
};

View File

@ -108,7 +108,8 @@ const FFCodec ff_mpeg2_qsv_encoder = {
AV_PIX_FMT_NONE },
.p.priv_class = &class,
.defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.wrapper_name = "qsv",
.hw_configs = ff_qsv_enc_hw_configs,
};

View File

@ -118,7 +118,8 @@ const FFCodec ff_vp9_qsv_encoder = {
AV_PIX_FMT_NONE },
.p.priv_class = &class,
.defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.p.wrapper_name = "qsv",
.hw_configs = ff_qsv_enc_hw_configs,
};

View File

@ -578,6 +578,7 @@ static const AVCodecHWConfigInternal *const rkmpp_hw_configs[] = {
.hw_configs = rkmpp_hw_configs, \
.bsfs = BSFS, \
.p.wrapper_name = "rkmpp", \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE, \
};
RKMPP_DEC(h264, AV_CODEC_ID_H264, "h264_mp4toannexb")

View File

@ -252,7 +252,8 @@ static const AVOption options[] = {
.close = v4l2_decode_close, \
.bsfs = bsf_name, \
.p.capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \
.caps_internal = FF_CODEC_CAP_SETS_PKT_DTS | FF_CODEC_CAP_INIT_CLEANUP, \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_SETS_PKT_DTS | FF_CODEC_CAP_INIT_CLEANUP, \
.p.wrapper_name = "v4l2m2m", \
}

View File

@ -433,7 +433,8 @@ static const FFCodecDefault v4l2_m2m_defaults[] = {
.close = v4l2_encode_close, \
.defaults = v4l2_m2m_defaults, \
.p.capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, \
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_INIT_CLEANUP, \
.p.wrapper_name = "v4l2m2m", \
}

View File

@ -1337,7 +1337,8 @@ const FFCodec ff_h264_vaapi_encoder = {
.p.priv_class = &vaapi_encode_h264_class,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.defaults = vaapi_encode_h264_defaults,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_VAAPI,

View File

@ -1456,7 +1456,8 @@ const FFCodec ff_hevc_vaapi_encoder = {
.p.priv_class = &vaapi_encode_h265_class,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.defaults = vaapi_encode_h265_defaults,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_VAAPI,

View File

@ -575,7 +575,8 @@ const FFCodec ff_mjpeg_vaapi_encoder = {
.close = &vaapi_encode_mjpeg_close,
.p.priv_class = &vaapi_encode_mjpeg_class,
.p.capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.defaults = vaapi_encode_mjpeg_defaults,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_VAAPI,

View File

@ -699,7 +699,8 @@ const FFCodec ff_mpeg2_vaapi_encoder = {
.p.priv_class = &vaapi_encode_mpeg2_class,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.defaults = vaapi_encode_mpeg2_defaults,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_VAAPI,

View File

@ -254,7 +254,8 @@ const FFCodec ff_vp8_vaapi_encoder = {
.p.priv_class = &vaapi_encode_vp8_class,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.defaults = vaapi_encode_vp8_defaults,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_VAAPI,

View File

@ -307,7 +307,8 @@ const FFCodec ff_vp9_vaapi_encoder = {
.p.priv_class = &vaapi_encode_vp9_class,
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE |
AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE |
FF_CODEC_CAP_INIT_CLEANUP,
.defaults = vaapi_encode_vp9_defaults,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_VAAPI,