]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/aeval.c
avfilter: Constify all AVFilters
[ffmpeg] / libavfilter / aeval.c
index cdddbaf31d427e7c09c9c3c3bdb4a13f7269af2a..ed7cf502de8657ecf9104adda5ec85a87add7135 100644 (file)
@@ -89,8 +89,8 @@ static const AVOption aevalsrc_options[]= {
     { "exprs",       "set the '|'-separated list of channels expressions", OFFSET(exprs), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
     { "nb_samples",  "set the number of samples per requested frame", OFFSET(nb_samples),      AV_OPT_TYPE_INT,    {.i64 = 1024},    0,        INT_MAX, FLAGS },
     { "n",           "set the number of samples per requested frame", OFFSET(nb_samples),      AV_OPT_TYPE_INT,    {.i64 = 1024},    0,        INT_MAX, FLAGS },
-    { "sample_rate", "set the sample rate",                           OFFSET(sample_rate_str), AV_OPT_TYPE_STRING, {.str = "44100"}, CHAR_MIN, CHAR_MAX, FLAGS },
-    { "s",           "set the sample rate",                           OFFSET(sample_rate_str), AV_OPT_TYPE_STRING, {.str = "44100"}, CHAR_MIN, CHAR_MAX, FLAGS },
+    { "sample_rate", "set the sample rate",                           OFFSET(sample_rate_str), AV_OPT_TYPE_STRING, {.str = "44100"}, 0, 0, FLAGS },
+    { "s",           "set the sample rate",                           OFFSET(sample_rate_str), AV_OPT_TYPE_STRING, {.str = "44100"}, 0, 0, FLAGS },
     { "duration",    "set audio duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },
     { "d",           "set audio duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },
     { "channel_layout", "set channel layout", OFFSET(chlayout_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
@@ -258,7 +258,7 @@ static int query_formats(AVFilterContext *ctx)
     if (ret < 0)
         return ret;
 
-    layouts = avfilter_make_format64_list(chlayouts);
+    layouts = ff_make_format64_list(chlayouts);
     if (!layouts)
         return AVERROR(ENOMEM);
     ret = ff_set_common_channel_layouts(ctx, layouts);
@@ -322,7 +322,7 @@ static const AVFilterPad aevalsrc_outputs[] = {
     { NULL }
 };
 
-AVFilter ff_asrc_aevalsrc = {
+const AVFilter ff_asrc_aevalsrc = {
     .name          = "aevalsrc",
     .description   = NULL_IF_CONFIG_SMALL("Generate an audio signal generated by an expression."),
     .query_formats = query_formats,
@@ -362,7 +362,7 @@ static int aeval_query_formats(AVFilterContext *ctx)
 
     // inlink supports any channel layout
     layouts = ff_all_channel_counts();
-    if ((ret = ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts)) < 0)
+    if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0)
         return ret;
 
     if (eval->same_chlayout) {
@@ -376,7 +376,7 @@ static int aeval_query_formats(AVFilterContext *ctx)
                               eval->out_channel_layout ? eval->out_channel_layout :
                               FF_COUNT2LAYOUT(eval->nb_channels))) < 0)
             return ret;
-        if ((ret = ff_channel_layouts_ref(layouts, &outlink->in_channel_layouts)) < 0)
+        if ((ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts)) < 0)
             return ret;
     }
 
@@ -416,8 +416,6 @@ static int aeval_config_output(AVFilterLink *outlink)
     return 0;
 }
 
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
-
 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 {
     EvalContext *eval     = inlink->dst->priv;
@@ -475,7 +473,7 @@ static const AVFilterPad aeval_outputs[] = {
     { NULL }
 };
 
-AVFilter ff_af_aeval = {
+const AVFilter ff_af_aeval = {
     .name          = "aeval",
     .description   = NULL_IF_CONFIG_SMALL("Filter audio signal according to a specified expression."),
     .query_formats = aeval_query_formats,
@@ -485,6 +483,7 @@ AVFilter ff_af_aeval = {
     .inputs        = aeval_inputs,
     .outputs       = aeval_outputs,
     .priv_class    = &aeval_class,
+    .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
 };
 
 #endif /* CONFIG_AEVAL_FILTER */