[libav-commits] avconv: automatically insert asyncts when -async is used.

Anton Khirnov git at libav.org
Mon May 14 21:38:40 CEST 2012


Module: libav
Branch: master
Commit: 6eeb9a0433d793dbd86c43d3dea1a2f8015f1147

Author:    Anton Khirnov <anton at khirnov.net>
Committer: Anton Khirnov <anton at khirnov.net>
Date:      Wed May  9 06:39:37 2012 +0200

avconv: automatically insert asyncts when -async is used.

Deprecate -async.

---

 avconv.c        |   27 +++++++++++++++++++++++++++
 doc/avconv.texi |    1 +
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/avconv.c b/avconv.c
index 25958ea..85ee6f7 100644
--- a/avconv.c
+++ b/avconv.c
@@ -703,6 +703,33 @@ static int configure_audio_filters(FilterGraph *fg, AVFilterContext **in_filter,
         *out_filter = format;
     }
 
+    if (audio_sync_method > 0) {
+        AVFilterContext *async;
+        char args[256];
+        int  len = 0;
+
+        av_log(NULL, AV_LOG_WARNING, "-async has been deprecated. Used the "
+               "asyncts audio filter instead.\n");
+
+        if (audio_sync_method > 1)
+            len += snprintf(args + len, sizeof(args) - len, "compensate=1:"
+                            "max_comp=%d:", audio_sync_method);
+        snprintf(args + len, sizeof(args) - len, "min_delta=%f",
+                 audio_drift_threshold);
+
+        ret = avfilter_graph_create_filter(&async,
+                                           avfilter_get_by_name("asyncts"),
+                                           "async", args, NULL, fg->graph);
+        if (ret < 0)
+            return ret;
+
+        ret = avfilter_link(*in_filter, 0, async, 0);
+        if (ret < 0)
+            return ret;
+
+        *in_filter = async;
+    }
+
     return 0;
 }
 
diff --git a/doc/avconv.texi b/doc/avconv.texi
index 511642a..d6e4096 100644
--- a/doc/avconv.texi
+++ b/doc/avconv.texi
@@ -610,6 +610,7 @@ Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps
 the parameter is the maximum samples per second by which the audio is changed.
 -async 1 is a special case where only the start of the audio stream is corrected
 without any later correction.
+This option has been deprecated. Use the @code{asyncts} audio filter instead.
 @item -copyts
 Copy timestamps from input to output.
 @item -copytb



More information about the libav-commits mailing list