]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_select.c
mandelbrot: remove always-false condition in fill_from_cache
[ffmpeg] / libavfilter / vf_select.c
index bbfb63edf35ce71f8b53de10c79720985368020c..18f1b4f768decad3f48d03af517caa7046a7f120 100644 (file)
 #include "libavutil/fifo.h"
 #include "avfilter.h"
 
-static const char *var_names[] = {
-    "E",                 ///< Euler number
-    "PHI",               ///< golden ratio
-    "PI",                ///< greek pi
-
+static const char * const var_names[] = {
     "TB",                ///< timebase
 
     "pts",               ///< original pts in the file of the frame
@@ -45,18 +41,18 @@ static const char *var_names[] = {
     "prev_selected_t",   ///< previously selected time
 
     "pict_type",         ///< the type of picture in the movie
-    "PICT_TYPE_I",
-    "PICT_TYPE_P",
-    "PICT_TYPE_B",
-    "PICT_TYPE_S",
-    "PICT_TYPE_SI",
-    "PICT_TYPE_SP",
-    "PICT_TYPE_BI",
+    "I",
+    "P",
+    "B",
+    "S",
+    "SI",
+    "SP",
+    "BI",
 
     "interlace_type",    ///< the frame interlace type
-    "INTERLACE_TYPE_P",
-    "INTERLACE_TYPE_T",
-    "INTERLACE_TYPE_B",
+    "PROGRESSIVE",
+    "TOPFIRST",
+    "BOTTOMFIRST",
 
     "n",                 ///< frame number (starting from zero)
     "selected_n",        ///< selected frame number (starting from zero)
@@ -69,10 +65,6 @@ static const char *var_names[] = {
 };
 
 enum var_name {
-    VAR_E,
-    VAR_PHI,
-    VAR_PI,
-
     VAR_TB,
 
     VAR_PTS,
@@ -146,10 +138,6 @@ static int config_input(AVFilterLink *inlink)
 {
     SelectContext *select = inlink->dst->priv;
 
-    select->var_values[VAR_E]   = M_E;
-    select->var_values[VAR_PHI] = M_PHI;
-    select->var_values[VAR_PI]  = M_PI;
-
     select->var_values[VAR_N]          = 0.0;
     select->var_values[VAR_SELECTED_N] = 0.0;
 
@@ -317,19 +305,14 @@ static av_cold void uninit(AVFilterContext *ctx)
 {
     SelectContext *select = ctx->priv;
     AVFilterBufferRef *picref;
-    int i;
 
-    if (select->expr)
-        av_expr_free(select->expr);
+    av_expr_free(select->expr);
     select->expr = NULL;
 
-    if (select->pending_frames) {
-        for (i = 0; i < av_fifo_size(select->pending_frames)/sizeof(picref); i++) {
-            av_fifo_generic_read(select->pending_frames, &picref, sizeof(picref), NULL);
-            avfilter_unref_buffer(picref);
-        }
-        av_fifo_free(select->pending_frames);
-    }
+    while (select->pending_frames &&
+           av_fifo_generic_read(select->pending_frames, &picref, sizeof(picref), NULL) == sizeof(picref))
+        avfilter_unref_buffer(picref);
+    av_fifo_free(select->pending_frames);
     select->pending_frames = NULL;
 }
 
@@ -341,7 +324,7 @@ AVFilter avfilter_vf_select = {
 
     .priv_size = sizeof(SelectContext),
 
-    .inputs    = (AVFilterPad[]) {{ .name             = "default",
+    .inputs    = (const AVFilterPad[]) {{ .name       = "default",
                                     .type             = AVMEDIA_TYPE_VIDEO,
                                     .get_video_buffer = avfilter_null_get_video_buffer,
                                     .config_props     = config_input,
@@ -349,7 +332,7 @@ AVFilter avfilter_vf_select = {
                                     .draw_slice       = draw_slice,
                                     .end_frame        = end_frame },
                                   { .name = NULL }},
-    .outputs   = (AVFilterPad[]) {{ .name             = "default",
+    .outputs   = (const AVFilterPad[]) {{ .name       = "default",
                                     .type             = AVMEDIA_TYPE_VIDEO,
                                     .poll_frame       = poll_frame,
                                     .request_frame    = request_frame, },