FFmpeg
Loading...
Searching...
No Matches
vf_fps.c File Reference

a filter enforcing given constant framerate More...

#include <float.h>
#include <stdint.h>
#include "libavutil/avassert.h"
#include "libavutil/eval.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "ccfifo.h"
#include "filters.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  FPSContext
 

Macros

#define OFFSET(x)
 
#define V   AV_OPT_FLAG_VIDEO_PARAM
 
#define F   AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  EOFAction { EOF_ACTION_ROUND , EOF_ACTION_PASS , EOF_ACTION_NB }
 
enum  var_name {
  VAR_SOURCE_FPS , VAR_FPS_NTSC , VAR_FPS_PAL , VAR_FPS_FILM ,
  VAR_FPS_NTSC_FILM , VARS_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 char *const var_names []
 
static const double ntsc_fps = 30000.0 / 1001.0
 
static const double pal_fps = 25.0
 
static const double film_fps = 24.0
 
static const double ntsc_film_fps = 24000.0 / 1001.0
 
static const AVOption fps_options []
 
static const AVFilterPad avfilter_vf_fps_outputs []
 
const FFFilter ff_vf_fps
 

Detailed Description

a filter enforcing given constant framerate

Definition in file vf_fps.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 101 of file vf_fps.c.

◆ V

#define V   AV_OPT_FLAG_VIDEO_PARAM

Definition at line 102 of file vf_fps.c.

◆ F

Definition at line 103 of file vf_fps.c.

Enumeration Type Documentation

◆ EOFAction

enum EOFAction
Enumerator
EOF_ACTION_ROUND 
EOF_ACTION_PASS 
EOF_ACTION_NB 

Definition at line 41 of file vf_fps.c.

◆ var_name

enum var_name
Enumerator
VAR_SOURCE_FPS 
VAR_FPS_NTSC 
VAR_FPS_PAL 
VAR_FPS_FILM 
VAR_FPS_NTSC_FILM 
VARS_NB 

Definition at line 56 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 121 of file vf_fps.c.

◆ shift_frame()

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

Definition at line 132 of file vf_fps.c.

Referenced by uninit(), and write_frame().

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 160 of file vf_fps.c.

◆ config_props()

static int config_props ( AVFilterLink * outlink)
static

Definition at line 176 of file vf_fps.c.

◆ read_frame()

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

Definition at line 230 of file vf_fps.c.

Referenced by activate().

◆ write_frame()

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

Definition at line 264 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 317 of file vf_fps.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext * ctx)
static

Definition at line 326 of file vf_fps.c.

Variable Documentation

◆ var_names

const char* const var_names[]
static
Initial value:
= {
"source_fps",
"ntsc",
"pal",
"film",
"ntsc_film",
}
#define NULL
Definition coverity.c:32

Definition at line 47 of file vf_fps.c.

◆ ntsc_fps

const double ntsc_fps = 30000.0 / 1001.0
static

Definition at line 65 of file vf_fps.c.

Referenced by config_props().

◆ pal_fps

const double pal_fps = 25.0
static

Definition at line 66 of file vf_fps.c.

Referenced by config_props().

◆ film_fps

const double film_fps = 24.0
static

Definition at line 67 of file vf_fps.c.

Referenced by config_props().

◆ ntsc_film_fps

const double ntsc_film_fps = 24000.0 / 1001.0
static

Definition at line 68 of file vf_fps.c.

Referenced by config_props().

◆ fps_options

const AVOption fps_options[]
static
Initial value:
= {
{ "fps", "A string describing desired output framerate", OFFSET(framerate), AV_OPT_TYPE_STRING, { .str = "25" }, 0, 0, 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, .unit = "round" },
{ "zero", "round towards 0", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_ZERO }, 0, 0, V|F, .unit = "round" },
{ "inf", "round away from 0", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_INF }, 0, 0, V|F, .unit = "round" },
{ "down", "round towards -infty", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_DOWN }, 0, 0, V|F, .unit = "round" },
{ "up", "round towards +infty", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_UP }, 0, 0, V|F, .unit = "round" },
{ "near", "round to nearest", 0, AV_OPT_TYPE_CONST, { .i64 = AV_ROUND_NEAR_INF }, 0, 0, V|F, .unit = "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, .unit = "eof_action" },
{ "round", "round similar to other frames", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_ROUND }, 0, 0, V|F, .unit = "eof_action" },
{ "pass", "pass through last frame", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_PASS }, 0, 0, V|F, .unit = "eof_action" },
{ NULL }
}
#define V
Definition avdct.c:32
#define F(x)
#define OFFSET(x)
static int64_t start_time
Definition ffplay.c:329
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
@ AV_ROUND_INF
Round away from zero.
@ AV_ROUND_ZERO
Round toward zero.
@ AV_ROUND_DOWN
Round toward -infinity.
@ AV_ROUND_UP
Round toward +infinity.
@ AV_ROUND_NEAR_INF
Round to nearest and halfway cases away from zero.
@ EOF_ACTION_PASS
Definition packetsync.h:31
float framerate
Definition av1_levels.c:29
@ EOF_ACTION_NB
Definition vf_fps.c:44
@ EOF_ACTION_ROUND
Definition vf_fps.c:42

Definition at line 104 of file vf_fps.c.

◆ avfilter_vf_fps_outputs

const AVFilterPad avfilter_vf_fps_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
},
}
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int config_props(AVBitStreamFilterLink *link)
Definition source.c:181

Definition at line 381 of file vf_fps.c.

◆ ff_vf_fps

const FFFilter ff_vf_fps
Initial value:
= {
.p.name = "fps",
.p.description = NULL_IF_CONFIG_SMALL("Force constant framerate."),
.p.priv_class = &fps_class,
.init = init,
.uninit = uninit,
.priv_size = sizeof(FPSContext),
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition avfilter.h:182
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static const AVFilterPad avfilter_vf_fps_outputs[]
Definition vf_fps.c:381
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition video.c:37

Definition at line 389 of file vf_fps.c.