New fade curve value 'nofade' passes audio samples as-is. Primarily useful in carrying out acrossfade without fades.
Unified · Split
| @@ -958,6 +958,8 @@ select double-exponential seat · 957 unmodified lines | ||
| 958 | 958 | select double-exponential sigmoid |
| 959 | 959 | @item losi |
| 960 | 960 | select logistic sigmoid |
| 961 | +@item nofade | |
| 962 | +no fade applied | |
| 961 | 963 | @end table |
| 962 | 964 | @end table |
| 963 | 965 | |
| @@ -51,7 +51,7 @@ typedef struct AudioFadeContext { · 50 unmodified lines | ||
| 51 | 51 | int curve0, int curve1); |
| 52 | 52 | } AudioFadeContext; |
| 53 | 53 | |
| 54 | −enum CurveType { TRI, QSIN, ESIN, HSIN, LOG, IPAR, QUA, CUB, SQU, CBR, PAR, EXP, IQSIN, IHSIN, DESE, DESI, LOSI, NB_CURVES }; | |
| 54 | +enum CurveType { TRI, QSIN, ESIN, HSIN, LOG, IPAR, QUA, CUB, SQU, CBR, PAR, EXP, IQSIN, IHSIN, DESE, DESI, LOSI, NONE, NB_CURVES }; | |
| 55 | 55 | |
| 56 | 56 | #define OFFSET(x) offsetof(AudioFadeContext, x) |
| 57 | 57 | #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) · 95 unmodified lines | ||
| 153 | 153 | gain = (A - B) / (C - B); |
| 154 | 154 | } |
| 155 | 155 | break; |
| 156 | + case NONE: | |
| 157 | + gain = 1.0; | |
| 158 | + break; | |
| 156 | 159 | } |
| 157 | 160 | |
| 158 | 161 | return gain; |
| @@ -260,6 +263,7 @@ static const AVOption afade_options[] = { · 101 unmodified lines | ||
| 260 | 263 | { "dese", "double-exponential seat", 0, AV_OPT_TYPE_CONST, {.i64 = DESE }, 0, 0, FLAGS, "curve" }, |
| 261 | 264 | { "desi", "double-exponential sigmoid", 0, AV_OPT_TYPE_CONST, {.i64 = DESI }, 0, 0, FLAGS, "curve" }, |
| 262 | 265 | { "losi", "logistic sigmoid", 0, AV_OPT_TYPE_CONST, {.i64 = LOSI }, 0, 0, FLAGS, "curve" }, |
| 266 | + { "nofade", "no fade; keep audio as-is", 0, AV_OPT_TYPE_CONST, {.i64 = NONE }, 0, 0, FLAGS, "curve" }, | |
| 263 | 267 | { NULL } |
| 264 | 268 | }; |
| 265 | 269 | |
| @@ -380,6 +384,7 @@ static const AVOption acrossfade_options[] = { · 114 unmodified lines | ||
| 380 | 384 | { "dese", "double-exponential seat", 0, AV_OPT_TYPE_CONST, {.i64 = DESE }, 0, 0, FLAGS, "curve" }, |
| 381 | 385 | { "desi", "double-exponential sigmoid", 0, AV_OPT_TYPE_CONST, {.i64 = DESI }, 0, 0, FLAGS, "curve" }, |
| 382 | 386 | { "losi", "logistic sigmoid", 0, AV_OPT_TYPE_CONST, {.i64 = LOSI }, 0, 0, FLAGS, "curve" }, |
| 387 | + { "nofade", "no fade; keep audio as-is", 0, AV_OPT_TYPE_CONST, {.i64 = NONE }, 0, 0, FLAGS, "curve" }, | |
| 383 | 388 | { "curve2", "set fade curve type for 2nd stream", OFFSET(curve2), AV_OPT_TYPE_INT, {.i64 = TRI }, 0, NB_CURVES - 1, FLAGS, "curve" }, |
| 384 | 389 | { "c2", "set fade curve type for 2nd stream", OFFSET(curve2), AV_OPT_TYPE_INT, {.i64 = TRI }, 0, NB_CURVES - 1, FLAGS, "curve" }, |
| 385 | 390 | { NULL } |