vf_fps.c File Reference

a filter enforcing given constant framerate More...

#include "libavutil/common.h"
#include "libavutil/fifo.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"
Include dependency graph for vf_fps.c:

Go to the source code of this file.

Data Structures

struct  FPSContext
 

Macros

#define OFFSET(x)   offsetof(FPSContext, x)
 
#define V   AV_OPT_FLAG_VIDEO_PARAM
 
#define F   AV_OPT_FLAG_FILTERING_PARAM
 

Typedefs

typedef struct FPSContext FPSContext
 

Functions

 AVFILTER_DEFINE_CLASS (fps)
 
static av_cold int init (AVFilterContext *ctx)
 
static void flush_fifo (AVFifoBuffer *fifo)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int config_props (AVFilterLink *link)
 
static int request_frame (AVFilterLink *outlink)
 
static int write_to_fifo (AVFifoBuffer *fifo, AVFrame *buf)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *buf)
 

Variables

static const AVOption fps_options []
 
static const AVFilterPad avfilter_vf_fps_inputs []
 
static const AVFilterPad avfilter_vf_fps_outputs []
 
AVFilter avfilter_vf_fps
 

Detailed Description

a filter enforcing given constant framerate

Definition in file vf_fps.c.

Macro Definition Documentation

Definition at line 59 of file vf_fps.c.

#define OFFSET (   x)    offsetof(FPSContext, x)

Definition at line 57 of file vf_fps.c.

#define V   AV_OPT_FLAG_VIDEO_PARAM

Definition at line 58 of file vf_fps.c.

Typedef Documentation

typedef struct FPSContext FPSContext

Function Documentation

AVFILTER_DEFINE_CLASS ( fps  )
static int config_props ( AVFilterLink link)
static

Definition at line 106 of file vf_fps.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame buf 
)
static

Definition at line 164 of file vf_fps.c.

static void flush_fifo ( AVFifoBuffer fifo)
static

Definition at line 84 of file vf_fps.c.

Referenced by filter_frame(), and uninit().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 73 of file vf_fps.c.

static int request_frame ( AVFilterLink outlink)
static

Definition at line 119 of file vf_fps.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 93 of file vf_fps.c.

static int write_to_fifo ( AVFifoBuffer fifo,
AVFrame buf 
)
static

Definition at line 150 of file vf_fps.c.

Referenced by filter_frame().

Variable Documentation

AVFilter avfilter_vf_fps
Initial value:
= {
.name = "fps",
.description = NULL_IF_CONFIG_SMALL("Force constant framerate."),
.init = init,
.uninit = uninit,
.priv_size = sizeof(FPSContext),
.priv_class = &fps_class,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static av_cold int init(AVFilterContext *ctx)
Definition: vf_fps.c:73
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_fps.c:93
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const AVFilterPad avfilter_vf_fps_inputs[]
Definition: vf_fps.c:257
static const AVFilterPad avfilter_vf_fps_outputs[]
Definition: vf_fps.c:266
struct FPSContext FPSContext
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs

Definition at line 276 of file vf_fps.c.

const AVFilterPad avfilter_vf_fps_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
Definition: vf_fps.c:164
NULL
Definition: eval.c:55

Definition at line 257 of file vf_fps.c.

const AVFilterPad avfilter_vf_fps_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = request_frame,
.config_props = config_props
},
{ NULL }
}
static int request_frame(AVFilterLink *outlink)
Definition: vf_fps.c:119
NULL
Definition: eval.c:55
static int config_props(AVFilterLink *link)
Definition: vf_fps.c:106

Definition at line 266 of file vf_fps.c.

const AVOption fps_options[]
static
Initial value:
= {
{ "fps", "A string describing desired output framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, .flags = V|F },
{ "round", "set rounding method for timestamps", OFFSET(rounding), AV_OPT_TYPE_INT, { .i64 = AV_ROUND_NEAR_INF }, 0, 5, V|F, "round" },
{ "zero", "round towards 0", OFFSET(rounding), AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_ZERO }, 0, 5, V|F, "round" },
{ "inf", "round away from 0", OFFSET(rounding), AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_INF }, 0, 5, V|F, "round" },
{ "down", "round towards -infty", OFFSET(rounding), AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_DOWN }, 0, 5, V|F, "round" },
{ "up", "round towards +infty", OFFSET(rounding), AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_UP }, 0, 5, V|F, "round" },
{ "near", "round to nearest", OFFSET(rounding), AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_NEAR_INF }, 0, 5, V|F, "round" },
{ NULL },
}
#define F
Definition: vf_fps.c:59
Round toward +infinity.
Definition: mathematics.h:71
Round away from zero.
Definition: mathematics.h:69
Round to nearest and halfway cases away from zero.
Definition: mathematics.h:72
#define V
Definition: vf_fps.c:58
#define OFFSET(x)
Definition: vf_fps.c:57
Round toward zero.
Definition: mathematics.h:68
NULL
Definition: eval.c:55
offset must point to AVRational
Definition: opt.h:233
Round toward -infinity.
Definition: mathematics.h:70

Definition at line 60 of file vf_fps.c.