Browse code

ffmpeg: fix passing swresample options to the auto inserted swr

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/11/23 23:35:48
Showing 1 changed files
... ...
@@ -28,6 +28,7 @@
28 28
 #include "libavutil/avstring.h"
29 29
 #include "libavutil/bprint.h"
30 30
 #include "libavutil/channel_layout.h"
31
+#include "libavutil/opt.h"
31 32
 #include "libavutil/pixdesc.h"
32 33
 #include "libavutil/pixfmt.h"
33 34
 #include "libavutil/imgutils.h"
... ...
@@ -724,6 +725,15 @@ int configure_filtergraph(FilterGraph *fg)
724 724
         char args[255];
725 725
         snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags);
726 726
         fg->graph->scale_sws_opts = av_strdup(args);
727
+
728
+        args[0] = 0;
729
+        if (ost->swr_dither_method)
730
+            av_strlcatf(args, sizeof(args), "dither_method=%d:", (int)ost->swr_dither_method);
731
+        if (ost->swr_dither_scale != 1.0)
732
+            av_strlcatf(args, sizeof(args), "dither_scale=%f:", ost->swr_dither_scale);
733
+        if (strlen(args))
734
+            args[strlen(args)-1] = 0;
735
+        av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
727 736
     }
728 737
 
729 738
     if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)