75 #define OFFSET(x) offsetof(FPSContext, x)
76 #define V AV_OPT_FLAG_VIDEO_PARAM
77 #define F AV_OPT_FLAG_FILTERING_PARAM
115 s->frames[0] =
s->frames[1];
120 s->frames_out +=
s->cur_frame_out;
121 if (
s->cur_frame_out > 1) {
124 s->dup +=
s->cur_frame_out - 1;
125 }
else if (
s->cur_frame_out == 0) {
130 s->cur_frame_out = 0;
141 while (
s->frames_count > 0) {
147 "%d frames duplicated.\n",
s->frames_in,
s->frames_out,
s->drop,
s->dup);
162 if (first_pts < INT64_MIN || first_pts > INT64_MAX) {
171 s->next_pts =
s->out_pts_off;
173 s->in_pts_off,
s->out_pts_off,
s->start_time);
206 s->frames[
s->frames_count++] =
frame;
217 av_assert1(
s->frames_count == 2 || (
s->status &&
s->frames_count == 1));
222 s->next_pts =
s->frames[0]->pts;
239 if ((
s->frames_count == 2 &&
s->frames[1]->pts <=
s->next_pts) ||
240 (
s->status &&
s->status_pts <=
s->next_pts)) {
297 if (
s->frames_count < 2) {
312 if (
s->frames_count > 0) {
321 if (
s->status &&
s->frames_count == 0) {
352 .priv_class = &fps_class,
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
int ff_inlink_check_available_frame(AVFilterLink *link)
Test if a frame is available on the link.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Main libavfilter public API header.
static int64_t start_time
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
#define FFERROR_NOT_READY
Filters implementation helper functions.
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
Remove and free all side data instances of the given type.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
@ AV_FRAME_DATA_A53_CC
ATSC A53 Part 4 Closed Captions.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
@ AV_ROUND_INF
Round away from zero.
@ AV_ROUND_ZERO
Round toward zero.
@ AV_ROUND_DOWN
Round toward -infinity.
@ AV_ROUND_PASS_MINMAX
Flag telling rescaling functions to pass INT64_MIN/MAX through unchanged, avoiding special cases for ...
@ AV_ROUND_UP
Round toward +infinity.
@ AV_ROUND_NEAR_INF
Round to nearest and halfway cases away from zero.
int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, enum AVRounding rnd)
Rescale a 64-bit integer by 2 rational numbers with specified rounding.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Describe the class of an AVClass context structure.
A link between two filters.
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Rational number (pair of numerator and denominator).
int frames_in
number of frames on input
int dup
number of frames duplicated
int rounding
AVRounding method for timestamps.
int status
buffered input status
int eof_action
action performed for last frame in FIFO
int frames_out
number of frames on output
int64_t status_pts
buffered input status timestamp
int64_t in_pts_off
input frame pts offset for start_time handling
int cur_frame_out
number of times current frame has been output
double start_time
pts, in seconds, of the expected first frame
int64_t next_pts
pts of the next frame to output
int64_t out_pts_off
output frame pts offset for start_time handling
int frames_count
number of buffered frames
int drop
number of framed dropped
AVRational framerate
target framerate
AVFrame * frames[2]
buffered frames
static int config_props(AVFilterLink *outlink)
static void update_eof_pts(AVFilterContext *ctx, FPSContext *s, AVFilterLink *inlink, AVFilterLink *outlink, int64_t status_pts)
static AVFrame * shift_frame(AVFilterContext *ctx, FPSContext *s)
static const AVFilterPad avfilter_vf_fps_outputs[]
static const AVFilterPad avfilter_vf_fps_inputs[]
static int write_frame(AVFilterContext *ctx, FPSContext *s, AVFilterLink *outlink, int *again)
AVFILTER_DEFINE_CLASS(fps)
static int activate(AVFilterContext *ctx)
static av_cold int init(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static int read_frame(AVFilterContext *ctx, FPSContext *s, AVFilterLink *inlink, AVFilterLink *outlink)
static const AVOption fps_options[]