[Bf-blender-cvs] [f522e8db228] blender-v2.93-release: Cleanup: Remove deprecated variables and functions calls from our ffmpeg code

Sebastian Parborg noreply at git.blender.org
Wed Jun 30 09:47:14 CEST 2021


Commit: f522e8db22883ede1469aaef45e917e817748369
Author: Sebastian Parborg
Date:   Fri May 7 17:10:03 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rBf522e8db22883ede1469aaef45e917e817748369

Cleanup: Remove deprecated variables and functions calls from our ffmpeg code

There need to be more cleanup for ffmpeg 4.5 (ffmpeg master branch).

However this now compiles on ffmpeg 4.4 without and deprication
warnings.

Reviewed By: Sergey, Richard Antalik

Differential Revision: http://developer.blender.org/D10338

===================================================================

M	intern/ffmpeg/ffmpeg_compat.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/writeffmpeg.c
M	source/blender/imbuf/CMakeLists.txt
M	source/blender/imbuf/intern/IMB_anim.h
M	source/blender/imbuf/intern/anim_movie.c
M	source/blender/imbuf/intern/indexer.c
M	source/blender/imbuf/intern/util.c

===================================================================

diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index 727fd4b9601..1b1e2fad594 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -22,10 +22,17 @@
 
 #include <libavformat/avformat.h>
 
-/* check our ffmpeg is new enough, avoids user complaints */
-#if (LIBAVFORMAT_VERSION_MAJOR < 52) || \
-    ((LIBAVFORMAT_VERSION_MAJOR == 52) && (LIBAVFORMAT_VERSION_MINOR <= 64))
-#  error "FFmpeg 0.7 or newer is needed, Upgrade your FFmpeg or disable it"
+/* Check if our ffmpeg is new enough, avoids user complaints.
+ * Minimum supported version is currently 3.2.0 which mean the following library versions:
+ * libavutil   > 55.30
+ * libavcodec  > 57.60
+ * libavformat > 57.50
+ *
+ * We only check for one of these as they are usually updated in tandem.
+ */
+#if (LIBAVFORMAT_VERSION_MAJOR < 57) || \
+    ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR <= 50))
+#  error "FFmpeg 3.2.0 or newer is needed, Upgrade your FFmpeg or disable it"
 #endif
 /* end sanity check */
 
@@ -36,274 +43,6 @@
 #  define FFMPEG_INLINE static inline
 #endif
 
-#include <libavcodec/avcodec.h>
-#include <libavutil/mathematics.h>
-#include <libavutil/opt.h>
-#include <libavutil/rational.h>
-
-#if (LIBAVFORMAT_VERSION_MAJOR > 52) || \
-    ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101))
-#  define FFMPEG_HAVE_PARSE_UTILS 1
-#  include <libavutil/parseutils.h>
-#endif
-
-#include <libswscale/swscale.h>
-
-#if (LIBAVFORMAT_VERSION_MAJOR > 52) || \
-    ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 105))
-#  define FFMPEG_HAVE_AVIO 1
-#endif
-
-#if (LIBAVCODEC_VERSION_MAJOR > 53) || \
-    ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR > 1)) || \
-    ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR == 1) && \
-     (LIBAVCODEC_VERSION_MICRO >= 1)) || \
-    ((LIBAVCODEC_VERSION_MAJOR == 52) && (LIBAVCODEC_VERSION_MINOR >= 121))
-#  define FFMPEG_HAVE_DEFAULT_VAL_UNION 1
-#endif
-
-#if (LIBAVFORMAT_VERSION_MAJOR > 52) || \
-    ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101))
-#  define FFMPEG_HAVE_AV_DUMP_FORMAT 1
-#endif
-
-#if (LIBAVFORMAT_VERSION_MAJOR > 52) || \
-    ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 45))
-#  define FFMPEG_HAVE_AV_GUESS_FORMAT 1
-#endif
-
-#if (LIBAVCODEC_VERSION_MAJOR > 52) || \
-    ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 23))
-#  define FFMPEG_HAVE_DECODE_AUDIO3 1
-#  define FFMPEG_HAVE_DECODE_VIDEO2 1
-#endif
-
-#if (LIBAVCODEC_VERSION_MAJOR > 52) || \
-    ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 64))
-#  define FFMPEG_HAVE_AVMEDIA_TYPES 1
-#endif
-
-#if ((LIBAVCODEC_VERSION_MAJOR > 52) || \
-     (LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 29)) && \
-    ((LIBSWSCALE_VERSION_MAJOR > 0) || \
-     (LIBSWSCALE_VERSION_MAJOR >= 0) && (LIBSWSCALE_VERSION_MINOR >= 10))
-#  define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
-#endif
-
-#if ((LIBAVCODEC_VERSION_MAJOR > 54) || \
-     (LIBAVCODEC_VERSION_MAJOR >= 54) && (LIBAVCODEC_VERSION_MINOR > 14))
-#  define FFMPEG_HAVE_CANON_H264_RESOLUTION_FIX
-#endif
-
-#if ((LIBAVCODEC_VERSION_MAJOR > 53) || \
-     (LIBAVCODEC_VERSION_MAJOR >= 53) && (LIBAVCODEC_VERSION_MINOR >= 60))
-#  define FFMPEG_HAVE_ENCODE_AUDIO2
-#endif
-
-#if ((LIBAVCODEC_VERSION_MAJOR > 53) || \
-     (LIBAVCODEC_VERSION_MAJOR >= 53) && (LIBAVCODEC_VERSION_MINOR >= 42))
-#  define FFMPEG_HAVE_DECODE_AUDIO4
-#endif
-
-#if ((LIBAVCODEC_VERSION_MAJOR > 54) || \
-     (LIBAVCODEC_VERSION_MAJOR >= 54) && (LIBAVCODEC_VERSION_MINOR >= 13))
-#  define FFMPEG_HAVE_AVFRAME_SAMPLE_RATE
-#endif
-
-#if ((LIBAVUTIL_VERSION_MAJOR > 51) || \
-     (LIBAVUTIL_VERSION_MAJOR == 51) && (LIBAVUTIL_VERSION_MINOR >= 21))
-#  define FFMPEG_FFV1_ALPHA_SUPPORTED
-#  define FFMPEG_SAMPLE_FMT_S16P_SUPPORTED
-#else
-
-FFMPEG_INLINE
-int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
-{
-  /* no planar formats in FFmpeg < 0.9 */
-  (void)sample_fmt;
-  return 0;
-}
-
-#endif
-
-/* XXX TODO Probably fix to correct modern flags in code? Not sure how old FFMPEG we want to
- * support though, so for now this will do. */
-
-#ifndef FF_MIN_BUFFER_SIZE
-#  ifdef AV_INPUT_BUFFER_MIN_SIZE
-#    define FF_MIN_BUFFER_SIZE AV_INPUT_BUFFER_MIN_SIZE
-#  endif
-#endif
-
-#ifndef FF_INPUT_BUFFER_PADDING_SIZE
-#  ifdef AV_INPUT_BUFFER_PADDING_SIZE
-#    define FF_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE
-#  endif
-#endif
-
-#ifndef CODEC_FLAG_GLOBAL_HEADER
-#  ifdef AV_CODEC_FLAG_GLOBAL_HEADER
-#    define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
-#  endif
-#endif
-
-#ifndef CODEC_FLAG_GLOBAL_HEADER
-#  ifdef AV_CODEC_FLAG_GLOBAL_HEADER
-#    define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
-#  endif
-#endif
-
-#ifndef CODEC_FLAG_INTERLACED_DCT
-#  ifdef AV_CODEC_FLAG_INTERLACED_DCT
-#    define CODEC_FLAG_INTERLACED_DCT AV_CODEC_FLAG_INTERLACED_DCT
-#  endif
-#endif
-
-#ifndef CODEC_FLAG_INTERLACED_ME
-#  ifdef AV_CODEC_FLAG_INTERLACED_ME
-#    define CODEC_FLAG_INTERLACED_ME AV_CODEC_FLAG_INTERLACED_ME
-#  endif
-#endif
-
-/* FFmpeg upstream 1.0 is the first who added AV_ prefix. */
-#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 59, 100)
-#  define AV_CODEC_ID_NONE CODEC_ID_NONE
-#  define AV_CODEC_ID_MPEG4 CODEC_ID_MPEG4
-#  define AV_CODEC_ID_MJPEG CODEC_ID_MJPEG
-#  define AV_CODEC_ID_DNXHD CODEC_ID_DNXHD
-#  define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO
-#  define AV_CODEC_ID_MPEG1VIDEO CODEC_ID_MPEG1VIDEO
-#  define AV_CODEC_ID_DVVIDEO CODEC_ID_DVVIDEO
-#  define AV_CODEC_ID_THEORA CODEC_ID_THEORA
-#  define AV_CODEC_ID_PNG CODEC_ID_PNG
-#  define AV_CODEC_ID_QTRLE CODEC_ID_QTRLE
-#  define AV_CODEC_ID_FFV1 CODEC_ID_FFV1
-#  define AV_CODEC_ID_HUFFYUV CODEC_ID_HUFFYUV
-#  define AV_CODEC_ID_H264 CODEC_ID_H264
-#  define AV_CODEC_ID_FLV1 CODEC_ID_FLV1
-
-#  define AV_CODEC_ID_AAC CODEC_ID_AAC
-#  define AV_CODEC_ID_AC3 CODEC_ID_AC3
-#  define AV_CODEC_ID_MP3 CODEC_ID_MP3
-#  define AV_CODEC_ID_MP2 CODEC_ID_MP2
-#  define AV_CODEC_ID_FLAC CODEC_ID_FLAC
-#  define AV_CODEC_ID_PCM_U8 CODEC_ID_PCM_U8
-#  define AV_CODEC_ID_PCM_S16LE CODEC_ID_PCM_S16LE
-#  define AV_CODEC_ID_PCM_S24LE CODEC_ID_PCM_S24LE
-#  define AV_CODEC_ID_PCM_S32LE CODEC_ID_PCM_S32LE
-#  define AV_CODEC_ID_PCM_F32LE CODEC_ID_PCM_F32LE
-#  define AV_CODEC_ID_PCM_F64LE CODEC_ID_PCM_F64LE
-#  define AV_CODEC_ID_VORBIS CODEC_ID_VORBIS
-#endif
-
-FFMPEG_INLINE
-int av_get_cropped_height_from_codec(AVCodecContext *pCodecCtx)
-{
-  int y = pCodecCtx->height;
-
-#ifndef FFMPEG_HAVE_CANON_H264_RESOLUTION_FIX
-  /* really bad hack to remove this dreadfull black bar at the bottom
-   with Canon footage and old ffmpeg versions.
-   (to fix this properly in older ffmpeg versions one has to write a new
-   demuxer...)
-
-   see the actual fix here for reference:
-
-   http://git.libav.org/?p=libav.git;a=commit;h=30f515091c323da59c0f1b533703dedca2f4b95d
-
-   We do our best to apply this only to matching footage.
-*/
-  if (pCodecCtx->width == 1920 && pCodecCtx->height == 1088 &&
-      pCodecCtx->pix_fmt == PIX_FMT_YUVJ420P && pCodecCtx->codec_id == AV_CODEC_ID_H264) {
-    y = 1080;
-  }
-#endif
-
-  return y;
-}
-
-#if ((LIBAVUTIL_VERSION_MAJOR < 51) || \
-     (LIBAVUTIL_VERSION_MAJOR == 51) && (LIBAVUTIL_VERSION_MINOR < 22))
-FFMPEG_INLINE
-int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
-{
-  const AVOption *rv = NULL;
-  (void)search_flags;
-  av_set_string3(obj, name, val, 1, &rv);
-  return rv != NULL;
-}
-
-FFMPEG_INLINE
-int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
-{
-  const AVOption *rv = NULL;
-  (void)search_flags;
-  rv = av_set_int(obj, name, val);
-  return rv != NULL;
-}
-
-FFMPEG_INLINE
-int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
-{
-  const AVOption *rv = NULL;
-  (void)search_flags;
-  rv = av_set_double(obj, name, val);
-  return rv != NULL;
-}
-
-#  define AV_OPT_TYPE_INT FF_OPT_TYPE_INT
-#  define AV_OPT_TYPE_INT64 FF_OPT_TYPE_INT64
-#  define AV_OPT_TYPE_STRING FF_OPT_TYPE_STRING
-#  define AV_OPT_TYPE_CONST FF_OPT_TYPE_CONST
-#  define AV_OPT_TYPE_DOUBLE FF_OPT_TYPE_DOUBLE
-#  define AV_OPT_TYPE_FLOAT FF_OPT_TYPE_FLOAT
-#endif
-
-#if ((LIBAVUTIL_VERSION_MAJOR < 51) || \
-     (LIBAVUTIL_VERSION_MAJOR == 51) && (LIBAVUTIL_VERSION_MINOR < 54))
-FFMPEG_INLINE
-enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
-{
-  if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
-    return AV_SAMPLE_FMT_NONE;
-  return sample_fmt;
-}
-#endif
-
-#if ((LIBAVCODEC_VERSION_MAJOR < 53) || \
-     (LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR < 35))
-FFMPEG_INLINE
-int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
-{
-  /* TODO: no options are taking into account */
-  (void)options;
-  return avcodec_open(avctx, codec);
-}
-#endif
-
-#if ((LIBAVFORMAT_VERSION_MAJOR < 53) || \
-     (LIBAVFORMAT_VERSION_MAJOR == 53 && LIBAVFORMAT_VERSION_MINOR < 21))
-FFMPEG_INLINE
-AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
-{
-  /* TODO: no codec is taking into account */
-  (void)c;
-  return av_new_stream(s, 0);
-}
-
-FFMPEG_INLINE
-int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
-{
-  /* TODO: no options are taking into account */
-  (void)options;
-  return av_find_stream_info(ic);
-}
-#endif
-
-#if ((LIBAVFORMAT_VERSION_MAJOR > 53) || \
-     ((LIBAVFORMAT_VERSION_MAJOR == 53) && (LIBAVFORMAT_VERSION_MINOR > 32)) || \
-     ((LIBAVFORMAT_VERSION_MAJOR == 53) && (LIBAVFORMAT_VERSION_MINOR == 24) && \
-      (LIBAVFORMAT_VERSION_MICRO >= 100)))
 FFMPEG_INLINE
 void my_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
 {
@@ -323,103 +62,12 @@ void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
 {
   my_update_cur_dts(s, ref_st, timestamp);
 }
-#endif
-
-#if ((LIBAVCODEC_VERSION_MAJOR < 54) || \
-     (LIBAVCODEC_VERSION_MAJOR == 54 && LIBAVCODEC_VERSION_MINOR < 28))
-FFMPEG_INLINE
-void avcodec_free_frame(AVFrame **frame)
-{
-  /* don't need to do anyth

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list