summaryrefslogtreecommitdiff
path: root/libavfilter/af_afade.c
diff options
context:
space:
mode:
authorGyan Doshi <ffmpeg@gyani.pro>2019-01-23 13:35:23 +0530
committerGyan Doshi <ffmpeg@gyani.pro>2019-01-24 22:08:34 +0530
commit3224d6691cdc59ef0d31cdb35efac27494ff515b (patch)
treebfc8c7c4a4b76e8db50e115dd5fcf76bbe7d8386 /libavfilter/af_afade.c
parente0ad7d57415b6c8e32126f1bc21052b2c3698b39 (diff)
avfilter/afade+acrossfade: allow skipping fade on inputs
New fade curve value 'nofade' passes audio samples as-is. Primarily useful in carrying out acrossfade without fades.
Diffstat (limited to 'libavfilter/af_afade.c')
-rw-r--r--libavfilter/af_afade.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
index 751db7da4d..195fb65ab5 100644
--- a/libavfilter/af_afade.c
+++ b/libavfilter/af_afade.c
@@ -51,7 +51,7 @@ typedef struct AudioFadeContext {
int curve0, int curve1);
} AudioFadeContext;
-enum CurveType { TRI, QSIN, ESIN, HSIN, LOG, IPAR, QUA, CUB, SQU, CBR, PAR, EXP, IQSIN, IHSIN, DESE, DESI, LOSI, NB_CURVES };
+enum CurveType { TRI, QSIN, ESIN, HSIN, LOG, IPAR, QUA, CUB, SQU, CBR, PAR, EXP, IQSIN, IHSIN, DESE, DESI, LOSI, NONE, NB_CURVES };
#define OFFSET(x) offsetof(AudioFadeContext, x)
#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
@@ -153,6 +153,9 @@ static double fade_gain(int curve, int64_t index, int64_t range)
gain = (A - B) / (C - B);
}
break;
+ case NONE:
+ gain = 1.0;
+ break;
}
return gain;
@@ -260,6 +263,7 @@ static const AVOption afade_options[] = {
{ "dese", "double-exponential seat", 0, AV_OPT_TYPE_CONST, {.i64 = DESE }, 0, 0, FLAGS, "curve" },
{ "desi", "double-exponential sigmoid", 0, AV_OPT_TYPE_CONST, {.i64 = DESI }, 0, 0, FLAGS, "curve" },
{ "losi", "logistic sigmoid", 0, AV_OPT_TYPE_CONST, {.i64 = LOSI }, 0, 0, FLAGS, "curve" },
+ { "nofade", "no fade; keep audio as-is", 0, AV_OPT_TYPE_CONST, {.i64 = NONE }, 0, 0, FLAGS, "curve" },
{ NULL }
};
@@ -380,6 +384,7 @@ static const AVOption acrossfade_options[] = {
{ "dese", "double-exponential seat", 0, AV_OPT_TYPE_CONST, {.i64 = DESE }, 0, 0, FLAGS, "curve" },
{ "desi", "double-exponential sigmoid", 0, AV_OPT_TYPE_CONST, {.i64 = DESI }, 0, 0, FLAGS, "curve" },
{ "losi", "logistic sigmoid", 0, AV_OPT_TYPE_CONST, {.i64 = LOSI }, 0, 0, FLAGS, "curve" },
+ { "nofade", "no fade; keep audio as-is", 0, AV_OPT_TYPE_CONST, {.i64 = NONE }, 0, 0, FLAGS, "curve" },
{ "curve2", "set fade curve type for 2nd stream", OFFSET(curve2), AV_OPT_TYPE_INT, {.i64 = TRI }, 0, NB_CURVES - 1, FLAGS, "curve" },
{ "c2", "set fade curve type for 2nd stream", OFFSET(curve2), AV_OPT_TYPE_INT, {.i64 = TRI }, 0, NB_CURVES - 1, FLAGS, "curve" },
{ NULL }