#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
"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)
};
enum var_name {
- VAR_E,
- VAR_PHI,
- VAR_PI,
-
VAR_TB,
VAR_PTS,
{
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;
{
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;
}
.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,
.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, },