[FFmpeg-devel] [PATCH 19/20] fftools/ffmpeg: mark -vsync for future removal

Anton Khirnov anton at khirnov.net
Mon Dec 18 11:57:21 EET 2023


It has already been deprecated over a year ago.
---
 fftools/ffmpeg.h          |  1 +
 fftools/ffmpeg_mux_init.c |  4 ++++
 fftools/ffmpeg_opt.c      | 15 ++++++++++++---
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 1a8254d422..7d55e384d3 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -61,6 +61,7 @@
 #define FFMPEG_OPT_TOP 1
 #define FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP 1
 #define FFMPEG_OPT_VSYNC_DROP 1
+#define FFMPEG_OPT_VSYNC 1
 
 #define FFMPEG_ERROR_RATE_EXCEEDED FFERRTAG('E', 'R', 'E', 'D')
 
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 5ab3f14a01..f5e92de8a9 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -755,7 +755,11 @@ static int new_stream_video(Muxer *mux, const OptionsContext *o,
             av_log(ost, AV_LOG_WARNING, "-top is deprecated, use the setfield filter instead\n");
 #endif
 
+#if FFMPEG_OPT_VSYNC
         ost->vsync_method = video_sync_method;
+#else
+        ost->vsync_method = VSYNC_AUTO;
+#endif
         MATCH_PER_STREAM_OPT(fps_mode, str, fps_mode, oc, st);
         if (fps_mode) {
             ret = parse_and_set_vsync(fps_mode, &ost->vsync_method, ost->file->index, ost->index, 0);
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index d6de997af8..2984c494cd 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -62,7 +62,9 @@ float audio_drift_threshold = 0.1;
 float dts_delta_threshold   = 10;
 float dts_error_threshold   = 3600*30;
 
+#if FFMPEG_OPT_VSYNC
 enum VideoSyncMethod video_sync_method = VSYNC_AUTO;
+#endif
 float frame_drop_threshold = 0;
 int do_benchmark      = 0;
 int do_benchmark_all  = 0;
@@ -205,6 +207,7 @@ int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_id
         return AVERROR(EINVAL);
     }
 
+#if FFMPEG_OPT_VSYNC
     if (is_global && *vsync_var == VSYNC_AUTO) {
         int ret;
         double num;
@@ -217,6 +220,8 @@ int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_id
         av_log(NULL, AV_LOG_WARNING, "Passing a number to -vsync is deprecated,"
                " use a string argument as described in the manual.\n");
     }
+#endif
+
     return 0;
 }
 
@@ -1136,11 +1141,13 @@ static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
     return parse_option(o, "filter:a", arg, options);
 }
 
+#if FFMPEG_OPT_VSYNC
 static int opt_vsync(void *optctx, const char *opt, const char *arg)
 {
     av_log(NULL, AV_LOG_WARNING, "-vsync is deprecated. Use -fps_mode\n");
     return parse_and_set_vsync(arg, &video_sync_method, -1, -1, 1);
 }
+#endif
 
 static int opt_timecode(void *optctx, const char *opt, const char *arg)
 {
@@ -1563,9 +1570,6 @@ const OptionDef options[] = {
         { .func_arg = opt_target },
         "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\" or \"dv50\" "
         "with optional prefixes \"pal-\", \"ntsc-\" or \"film-\")", "type" },
-    { "vsync",                  OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
-        { .func_arg = opt_vsync },
-        "set video sync method globally; deprecated, use -fps_mode", "" },
     { "frame_drop_threshold",   OPT_TYPE_FLOAT, OPT_EXPERT,
         { &frame_drop_threshold },
         "frame drop threshold", "" },
@@ -2003,6 +2007,11 @@ const OptionDef options[] = {
         { .func_arg = opt_qphist },
         "deprecated, does nothing" },
 #endif
+#if FFMPEG_OPT_VSYNC
+    { "vsync",                  OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
+        { .func_arg = opt_vsync },
+        "set video sync method globally; deprecated, use -fps_mode", "" },
+#endif
 
     { NULL, },
 };
-- 
2.42.0



More information about the ffmpeg-devel mailing list