diff mbox series

[FFmpeg-devel,4/6] ffmpeg: deprecate passing numbers to -vsync

Message ID 20211204174118.19085-4-anton@khirnov.net
State Accepted
Commit 6ce954642878d792ee1f628e0f871763f07efe72
Headers show
Series [FFmpeg-devel,1/6] ffmpeg: drop useless framerate assignments
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Anton Khirnov Dec. 4, 2021, 5:41 p.m. UTC
There is never a reason to do this, using symbolic names is always
preferred.
---
 doc/ffmpeg.texi      | 16 +++++++++-------
 fftools/ffmpeg_opt.c |  7 +++++--
 2 files changed, 14 insertions(+), 9 deletions(-)

Comments

Paul B Mahol Dec. 5, 2021, 10:56 a.m. UTC | #1
LGTM
diff mbox series

Patch

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 20a547381c..164419cad3 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1620,23 +1620,25 @@  It is useful for when flow speed of output packets is important, such as live st
 Read input at native frame rate. This is equivalent to setting @code{-readrate 1}.
 @item -vsync @var{parameter}
 Video sync method.
-For compatibility reasons old values can be specified as numbers.
-Newly added values will have to be specified as strings always.
+
+For compatibility reasons some of the values can be specified as numbers (shown
+in parentheses in the following table). This is deprecated and will stop working
+in the future.
 
 @table @option
-@item 0, passthrough
+@item passthrough (0)
 Each frame is passed with its timestamp from the demuxer to the muxer.
-@item 1, cfr
+@item cfr (1)
 Frames will be duplicated and dropped to achieve exactly the requested
 constant frame rate.
-@item 2, vfr
+@item vfr (2)
 Frames are passed through with their timestamp or dropped so as to
 prevent 2 frames from having the same timestamp.
 @item drop
 As passthrough but destroys all timestamps, making the muxer generate
 fresh timestamps based on frame-rate.
-@item -1, auto
-Chooses between 1 and 2 depending on muxer capabilities. This is the
+@item auto (-1)
+Chooses between cfr and vfr depending on muxer capabilities. This is the
 default method.
 @end table
 
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 585e1018a3..a2a880e8e3 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1741,7 +1741,7 @@  static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
 
     if ((frame_rate || max_frame_rate) &&
         video_sync_method == VSYNC_PASSTHROUGH)
-        av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r/-fpsmax can produce invalid output files\n");
+        av_log(NULL, AV_LOG_ERROR, "Using -vsync passthrough and -r/-fpsmax can produce invalid output files\n");
 
     MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, oc, st);
     if (frame_aspect_ratio) {
@@ -3201,8 +3201,11 @@  static int opt_vsync(void *optctx, const char *opt, const char *arg)
     else if (!av_strcasecmp(arg, "passthrough")) video_sync_method = VSYNC_PASSTHROUGH;
     else if (!av_strcasecmp(arg, "drop"))        video_sync_method = VSYNC_DROP;
 
-    if (video_sync_method == VSYNC_AUTO)
+    if (video_sync_method == VSYNC_AUTO) {
         video_sync_method = parse_number_or_die("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR);
+        av_log(NULL, AV_LOG_WARNING, "Passing a number to -vsync is deprecated,"
+               " use a string argument as described in the manual.\n");
+    }
     return 0;
 }