diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 74a60ae89a0cbca619ea7d23d8c13f2340ce82c5..702e775d9db17ef8f9a26c66590772d8c0500870 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3482,21 +3482,22 @@ const char *avcodec_configuration(void); */ const char *avcodec_license(void); +#if FF_API_AVCODEC_INIT /** - * Initialize libavcodec. - * If called more than once, does nothing. - * - * @warning This function must be called before any other libavcodec - * function. - * - * @warning This function is not thread-safe. + * @deprecated this function is called automatically from avcodec_register() + * and avcodec_register_all(), there is no need to call it manually */ +attribute_deprecated void avcodec_init(void); +#endif /** * Register the codec codec and initialize libavcodec. * - * @see avcodec_init(), avcodec_register_all() + * @warning either this function or avcodec_register_all() must be called + * before any other libavcodec functions. + * + * @see avcodec_register_all() */ void avcodec_register(AVCodec *codec); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 32e52514e52729ba13407ef6f14b3bf1e0dad08b..64f623c161460f48fae58a136cca79dcab545639 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1065,6 +1065,9 @@ const char *avcodec_license(void) return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1; } +#if !FF_API_AVCODEC_INIT +static +#endif void avcodec_init(void) { static int initialized = 0; diff --git a/libavcodec/version.h b/libavcodec/version.h index 24d2488249f56b60fc0d1283406e5151db0ae491..7eb5ce0424b70d6dadb72971e4f121496e36cddd 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -80,5 +80,8 @@ #ifndef FF_API_VERY_AGGRESSIVE #define FF_API_VERY_AGGRESSIVE (LIBAVCODEC_VERSION_MAJOR < 54) #endif +#ifndef FF_API_AVCODEC_INIT +#define FF_API_AVCODEC_INIT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif #endif /* AVCODEC_VERSION_H */