FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_fps.c File Reference
#include <float.h>
#include <stdint.h>
#include "libavutil/avassert.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "internal.h"

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
 

Enumerations

enum  EOFAction {
  EOF_ACTION_REPEAT, EOF_ACTION_ENDALL, EOF_ACTION_PASS, EOF_ACTION_ROUND,
  EOF_ACTION_PASS, EOF_ACTION_NB
}
 

Functions

 AVFILTER_DEFINE_CLASS (fps)
 
static av_cold int init (AVFilterContext *ctx)
 
static AVFrameshift_frame (AVFilterContext *ctx, FPSContext *s)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int config_props (AVFilterLink *outlink)
 
static int read_frame (AVFilterContext *ctx, FPSContext *s, AVFilterLink *inlink, AVFilterLink *outlink)
 
static int write_frame (AVFilterContext *ctx, FPSContext *s, AVFilterLink *outlink, int *again)
 
static void update_eof_pts (AVFilterContext *ctx, FPSContext *s, AVFilterLink *inlink, AVFilterLink *outlink, int64_t status_pts)
 
static int activate (AVFilterContext *ctx)
 

Variables

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

Detailed Description

a filter enforcing given constant framerate

Definition in file vf_fps.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 75 of file vf_fps.c.

◆ V

#define V   AV_OPT_FLAG_VIDEO_PARAM

Definition at line 76 of file vf_fps.c.

◆ F

Definition at line 77 of file vf_fps.c.

Enumeration Type Documentation

◆ EOFAction

enum EOFAction
Enumerator
EOF_ACTION_REPEAT 
EOF_ACTION_ENDALL 
EOF_ACTION_PASS 
EOF_ACTION_ROUND 
EOF_ACTION_PASS 
EOF_ACTION_NB 

Definition at line 39 of file vf_fps.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( fps  )

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 95 of file vf_fps.c.

◆ shift_frame()

static AVFrame* shift_frame ( AVFilterContext ctx,
FPSContext s 
)
static

Definition at line 107 of file vf_fps.c.

Referenced by uninit(), and write_frame().

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 135 of file vf_fps.c.

◆ config_props()

static int config_props ( AVFilterLink outlink)
static

Definition at line 150 of file vf_fps.c.

◆ read_frame()

static int read_frame ( AVFilterContext ctx,
FPSContext s,
AVFilterLink inlink,
AVFilterLink outlink 
)
static

Definition at line 180 of file vf_fps.c.

Referenced by activate(), and compute_vmaf_score().

◆ write_frame()

static int write_frame ( AVFilterContext ctx,
FPSContext s,
AVFilterLink outlink,
int again 
)
static

Definition at line 213 of file vf_fps.c.

Referenced by activate().

◆ update_eof_pts()

static void update_eof_pts ( AVFilterContext ctx,
FPSContext s,
AVFilterLink inlink,
AVFilterLink outlink,
int64_t  status_pts 
)
static

Definition at line 265 of file vf_fps.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 274 of file vf_fps.c.

Variable Documentation

◆ fps_options

const AVOption fps_options[]
static
Initial value:
= {
{ "fps", "A string describing desired output framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, 0, INT_MAX, V|F },
{ "start_time", "Assume the first PTS should be this value.", OFFSET(start_time), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX}, -DBL_MAX, DBL_MAX, 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", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_ZERO }, 0, 0, V|F, "round" },
{ "inf", "round away from 0", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_INF }, 0, 0, V|F, "round" },
{ "down", "round towards -infty", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_DOWN }, 0, 0, V|F, "round" },
{ "up", "round towards +infty", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_UP }, 0, 0, V|F, "round" },
{ "near", "round to nearest", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_NEAR_INF }, 0, 0, V|F, "round" },
{ "eof_action", "action performed for last frame", OFFSET(eof_action), AV_OPT_TYPE_INT, { .i64 = EOF_ACTION_ROUND }, 0, EOF_ACTION_NB-1, V|F, "eof_action" },
{ "round", "round similar to other frames", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_ROUND }, 0, 0, V|F, "eof_action" },
{ "pass", "pass through last frame", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_PASS }, 0, 0, V|F, "eof_action" },
{ NULL }
}

Definition at line 78 of file vf_fps.c.

◆ avfilter_vf_fps_inputs

const AVFilterPad avfilter_vf_fps_inputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}

Definition at line 329 of file vf_fps.c.

◆ avfilter_vf_fps_outputs

const AVFilterPad avfilter_vf_fps_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
},
{ NULL }
}

Definition at line 337 of file vf_fps.c.

◆ ff_vf_fps

AVFilter ff_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,
}

Definition at line 346 of file vf_fps.c.

AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:236
EOF_ACTION_PASS
@ EOF_ACTION_PASS
Definition: vf_fps.c:41
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_fps.c:95
config_props
static int config_props(AVFilterLink *outlink)
Definition: vf_fps.c:150
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_fps.c:135
framerate
int framerate
Definition: h264_levels.c:65
AV_ROUND_UP
@ AV_ROUND_UP
Round toward +infinity.
Definition: mathematics.h:83
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:225
V
#define V
Definition: vf_fps.c:76
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
OFFSET
#define OFFSET(x)
Definition: vf_fps.c:75
NULL
#define NULL
Definition: coverity.c:32
AV_ROUND_INF
@ AV_ROUND_INF
Round away from zero.
Definition: mathematics.h:81
avfilter_vf_fps_outputs
static const AVFilterPad avfilter_vf_fps_outputs[]
Definition: vf_fps.c:337
AV_ROUND_NEAR_INF
@ AV_ROUND_NEAR_INF
Round to nearest and halfway cases away from zero.
Definition: mathematics.h:84
inputs
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: filter_design.txt:243
avfilter_vf_fps_inputs
static const AVFilterPad avfilter_vf_fps_inputs[]
Definition: vf_fps.c:329
FPSContext
Definition: vf_fps.c:45
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
AV_ROUND_ZERO
@ AV_ROUND_ZERO
Round toward zero.
Definition: mathematics.h:80
start_time
static int64_t start_time
Definition: ffplay.c:331
EOF_ACTION_ROUND
@ EOF_ACTION_ROUND
Definition: vf_fps.c:40
EOF_ACTION_NB
@ EOF_ACTION_NB
Definition: vf_fps.c:42
AV_ROUND_DOWN
@ AV_ROUND_DOWN
Round toward -infinity.
Definition: mathematics.h:82
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
F
#define F
Definition: vf_fps.c:77
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
activate
static int activate(AVFilterContext *ctx)
Definition: vf_fps.c:274
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232