[FFmpeg-devel,v1,5/6] avfilter/af_silenceremove: change the max range of time to INT64_MAX

Submitted by lance.lmwang@gmail.com on Sept. 30, 2019, 1:36 p.m.

Details

Message ID 20190930133647.6290-5-lance.lmwang@gmail.com
State New
Headers show

Commit Message

lance.lmwang@gmail.com Sept. 30, 2019, 1:36 p.m.
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/af_silenceremove.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Paul B Mahol Sept. 30, 2019, 1:45 p.m.
Please no. Someone already posted similar patch.
There are reasons why this is like currently, so please do not change it.
It allocates memory.

On 9/30/19, lance.lmwang@gmail.com <lance.lmwang@gmail.com> wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavfilter/af_silenceremove.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c
> index 7dd8c5a..7d76e49 100644
> --- a/libavfilter/af_silenceremove.c
> +++ b/libavfilter/af_silenceremove.c
> @@ -105,16 +105,16 @@ typedef struct SilenceRemoveContext {
>
>  static const AVOption silenceremove_options[] = {
>      { "start_periods",   NULL,
>    OFFSET(start_periods),       AV_OPT_TYPE_INT,      {.i64=0},     0,
> 9000, AF },
> -    { "start_duration",  "set start duration of non-silence part",
>    OFFSET(start_duration_opt),  AV_OPT_TYPE_DURATION, {.i64=0},     0,
> INT32_MAX, AF },
> +    { "start_duration",  "set start duration of non-silence part",
>    OFFSET(start_duration_opt),  AV_OPT_TYPE_DURATION, {.i64=0},     0,
> INT64_MAX, AF },
>      { "start_threshold", "set threshold for start silence detection",
>    OFFSET(start_threshold),     AV_OPT_TYPE_DOUBLE,   {.dbl=0},     0,
> DBL_MAX, AF },
> -    { "start_silence",   "set start duration of silence part to keep",
>    OFFSET(start_silence_opt),   AV_OPT_TYPE_DURATION, {.i64=0},     0,
> INT32_MAX, AF },
> +    { "start_silence",   "set start duration of silence part to keep",
>    OFFSET(start_silence_opt),   AV_OPT_TYPE_DURATION, {.i64=0},     0,
> INT64_MAX, AF },
>      { "start_mode",      "set which channel will trigger trimming from
> start", OFFSET(start_mode),          AV_OPT_TYPE_INT,      {.i64=T_ANY},
> T_ANY, T_ALL, AF, "mode" },
>      {   "any",           0,
>    0,                           AV_OPT_TYPE_CONST,    {.i64=T_ANY}, 0,
>   0, AF, "mode" },
>      {   "all",           0,
>    0,                           AV_OPT_TYPE_CONST,    {.i64=T_ALL}, 0,
>   0, AF, "mode" },
>      { "stop_periods",    NULL,
>    OFFSET(stop_periods),        AV_OPT_TYPE_INT,      {.i64=0}, -9000,
> 9000, AF },
> -    { "stop_duration",   "set stop duration of non-silence part",
>    OFFSET(stop_duration_opt),   AV_OPT_TYPE_DURATION, {.i64=0},     0,
> INT32_MAX, AF },
> +    { "stop_duration",   "set stop duration of non-silence part",
>    OFFSET(stop_duration_opt),   AV_OPT_TYPE_DURATION, {.i64=0},     0,
> INT64_MAX, AF },
>      { "stop_threshold",  "set threshold for stop silence detection",
>    OFFSET(stop_threshold),      AV_OPT_TYPE_DOUBLE,   {.dbl=0},     0,
> DBL_MAX, AF },
> -    { "stop_silence",    "set stop duration of silence part to keep",
>    OFFSET(stop_silence_opt),    AV_OPT_TYPE_DURATION, {.i64=0},     0,
> INT32_MAX, AF },
> +    { "stop_silence",    "set stop duration of silence part to keep",
>    OFFSET(stop_silence_opt),    AV_OPT_TYPE_DURATION, {.i64=0},     0,
> INT64_MAX, AF },
>      { "stop_mode",       "set which channel will trigger trimming from
> end",   OFFSET(stop_mode),           AV_OPT_TYPE_INT,      {.i64=T_ANY},
> T_ANY, T_ALL, AF, "mode" },
>      { "detection",       "set how silence is detected",
>    OFFSET(detection),           AV_OPT_TYPE_INT,      {.i64=D_RMS},
> D_PEAK,D_RMS, AF, "detection" },
>      {   "peak",          "use absolute values of samples",
>    0,                           AV_OPT_TYPE_CONST,    {.i64=D_PEAK},0,
>   0, AF, "detection" },
> --
> 2.6.4
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Patch hide | download patch | download mbox

diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c
index 7dd8c5a..7d76e49 100644
--- a/libavfilter/af_silenceremove.c
+++ b/libavfilter/af_silenceremove.c
@@ -105,16 +105,16 @@  typedef struct SilenceRemoveContext {
 
 static const AVOption silenceremove_options[] = {
     { "start_periods",   NULL,                                                 OFFSET(start_periods),       AV_OPT_TYPE_INT,      {.i64=0},     0,      9000, AF },
-    { "start_duration",  "set start duration of non-silence part",             OFFSET(start_duration_opt),  AV_OPT_TYPE_DURATION, {.i64=0},     0, INT32_MAX, AF },
+    { "start_duration",  "set start duration of non-silence part",             OFFSET(start_duration_opt),  AV_OPT_TYPE_DURATION, {.i64=0},     0, INT64_MAX, AF },
     { "start_threshold", "set threshold for start silence detection",          OFFSET(start_threshold),     AV_OPT_TYPE_DOUBLE,   {.dbl=0},     0,   DBL_MAX, AF },
-    { "start_silence",   "set start duration of silence part to keep",         OFFSET(start_silence_opt),   AV_OPT_TYPE_DURATION, {.i64=0},     0, INT32_MAX, AF },
+    { "start_silence",   "set start duration of silence part to keep",         OFFSET(start_silence_opt),   AV_OPT_TYPE_DURATION, {.i64=0},     0, INT64_MAX, AF },
     { "start_mode",      "set which channel will trigger trimming from start", OFFSET(start_mode),          AV_OPT_TYPE_INT,      {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" },
     {   "any",           0,                                                    0,                           AV_OPT_TYPE_CONST,    {.i64=T_ANY}, 0,         0, AF, "mode" },
     {   "all",           0,                                                    0,                           AV_OPT_TYPE_CONST,    {.i64=T_ALL}, 0,         0, AF, "mode" },
     { "stop_periods",    NULL,                                                 OFFSET(stop_periods),        AV_OPT_TYPE_INT,      {.i64=0}, -9000,      9000, AF },
-    { "stop_duration",   "set stop duration of non-silence part",              OFFSET(stop_duration_opt),   AV_OPT_TYPE_DURATION, {.i64=0},     0, INT32_MAX, AF },
+    { "stop_duration",   "set stop duration of non-silence part",              OFFSET(stop_duration_opt),   AV_OPT_TYPE_DURATION, {.i64=0},     0, INT64_MAX, AF },
     { "stop_threshold",  "set threshold for stop silence detection",           OFFSET(stop_threshold),      AV_OPT_TYPE_DOUBLE,   {.dbl=0},     0,   DBL_MAX, AF },
-    { "stop_silence",    "set stop duration of silence part to keep",          OFFSET(stop_silence_opt),    AV_OPT_TYPE_DURATION, {.i64=0},     0, INT32_MAX, AF },
+    { "stop_silence",    "set stop duration of silence part to keep",          OFFSET(stop_silence_opt),    AV_OPT_TYPE_DURATION, {.i64=0},     0, INT64_MAX, AF },
     { "stop_mode",       "set which channel will trigger trimming from end",   OFFSET(stop_mode),           AV_OPT_TYPE_INT,      {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" },
     { "detection",       "set how silence is detected",                        OFFSET(detection),           AV_OPT_TYPE_INT,      {.i64=D_RMS}, D_PEAK,D_RMS, AF, "detection" },
     {   "peak",          "use absolute values of samples",                     0,                           AV_OPT_TYPE_CONST,    {.i64=D_PEAK},0,         0, AF, "detection" },