FFmpeg
Macros | Enumerations | Functions | Variables
framesync.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "framesync.h"

Go to the source code of this file.

Macros

#define  OFFSET(member)   offsetof(FFFrameSync, member)
 
 

Enumerations

 

Functions

static const char *  framesync_name (void *ptr)
 
const AVClassff_framesync_child_class_iterate (void **iter)
 
 
  Pre-initialize a frame sync structure. More...
 
int  ff_framesync_init (FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
  Initialize a frame sync structure. More...
 
 
 
  Configure a frame sync structure. More...
 
 
 
static void  framesync_inject_frame (FFFrameSync *fs, unsigned in, AVFrame *frame)
 
static void  framesync_inject_status (FFFrameSync *fs, unsigned in, int status, int64_t eof_pts)
 
int  ff_framesync_get_frame (FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
  Get the current frame in an input. More...
 
  Free all memory currently allocated. More...
 
  Examine the frames in the filter's input and try to produce output. More...
 
  Initialize a frame sync structure for dualinput. More...
 
 
  Same as ff_framesync_dualinput_get(), but make sure that f0 is writable. More...
 

Variables

static const AVOption  framesync_options []
 
 

Macro Definition Documentation

OFFSET

#define OFFSET (   member )    offsetof(FFFrameSync, member)

Definition at line 28 of file framesync.c.

FLAGS

Definition at line 29 of file framesync.c.

Enumeration Type Documentation

anonymous enum

anonymous enum
Enumerator
STATE_BOF 
STATE_RUN 
STATE_EOF 

Definition at line 70 of file framesync.c.

Function Documentation

framesync_name()

static const char* framesync_name ( void *  ptr )
static

Definition at line 31 of file framesync.c.

ff_framesync_child_class_iterate()

const AVClass* ff_framesync_child_class_iterate ( void **  iter )

Definition at line 63 of file framesync.c.

consume_from_fifos()

static int consume_from_fifos ( FFFrameSyncfs )
static

Definition at line 313 of file framesync.c.

Referenced by framesync_advance().

ff_framesync_preinit()

void ff_framesync_preinit ( FFFrameSyncfs )

Pre-initialize a frame sync structure.

It sets the class pointer and inits the options to their default values. The entire structure is expected to be already set to 0. This step is optional, but necessary to use the options.

Definition at line 78 of file framesync.c.

Referenced by ff_framesync_init(), and preinit().

ff_framesync_init()

int ff_framesync_init ( FFFrameSyncfs,
AVFilterContextparent,
unsigned  nb_in 
)

Initialize a frame sync structure.

The entire structure is expected to be already set to 0 or preinited.

Parameters
fs frame sync structure to initialize
parent parent AVFilterContext object
nb_in number of inputs
Returns
>= 0 for success or a negative error code

Definition at line 86 of file framesync.c.

Referenced by config_output(), config_props(), ff_framesync_init_dualinput(), init_framesync(), lut2_config_output(), and program_opencl_config_output().

framesync_eof()

static void framesync_eof ( FFFrameSyncfs,
int64_t  pts 
)
static

Definition at line 106 of file framesync.c.

Referenced by framesync_advance(), and framesync_sync_level_update().

framesync_sync_level_update()

static void framesync_sync_level_update ( FFFrameSyncfs,
int64_t  eof_pts 
)
static

Definition at line 113 of file framesync.c.

Referenced by ff_framesync_configure(), and framesync_inject_status().

ff_framesync_configure()

int ff_framesync_configure ( FFFrameSyncfs )

Configure a frame sync structure.

Must be called after all options are set but before all use.

Returns
>= 0 for success or a negative error code

Definition at line 137 of file framesync.c.

Referenced by config_output(), config_props(), config_props_output(), init_framesync(), lut2_config_output(), overlay_cuda_config_output(), overlay_opencl_config_output(), overlay_vaapi_config_output(), overlay_vulkan_config_output(), and program_opencl_config_output().

framesync_advance()

static int framesync_advance ( FFFrameSyncfs )
static

Definition at line 187 of file framesync.c.

Referenced by ff_framesync_activate().

framesync_pts_extrapolate()

static int64_t framesync_pts_extrapolate ( FFFrameSyncfs,
unsigned  in,
int64_t  pts 
)
static

Definition at line 238 of file framesync.c.

Referenced by framesync_inject_status().

framesync_inject_frame()

static void framesync_inject_frame ( FFFrameSyncfs,
unsigned  in,
AVFrameframe 
)
static

Definition at line 245 of file framesync.c.

Referenced by consume_from_fifos().

framesync_inject_status()

static void framesync_inject_status ( FFFrameSyncfs,
unsigned  in,
int  status,
int64_t  eof_pts 
)
static

Definition at line 258 of file framesync.c.

Referenced by consume_from_fifos().

ff_framesync_get_frame()

int ff_framesync_get_frame ( FFFrameSyncfs,
unsigned  in,
AVFrame **  rframe,
unsigned  get 
)

Get the current frame in an input.

Parameters
fs frame sync structure
in index of the input
rframe used to return the current frame (or NULL)
get if not zero, the calling code needs to get ownership of the returned frame; the current frame will either be duplicated or removed from the framesync structure

Definition at line 269 of file framesync.c.

Referenced by blend_frame(), do_scale(), ff_framesync_dualinput_get(), overlay_opencl_blend(), overlay_vaapi_blend(), overlay_vulkan_blend(), process_frame(), program_opencl_filter(), and remap_opencl_process_frame().

ff_framesync_uninit()

void ff_framesync_uninit ( FFFrameSyncfs )

ff_framesync_activate()

int ff_framesync_activate ( FFFrameSyncfs )

Examine the frames in the filter's input and try to produce output.

This function can be the complete implementation of the activate method of a filter using framesync.

Definition at line 352 of file framesync.c.

Referenced by activate(), overlay_cuda_activate(), overlay_opencl_activate(), overlay_vaapi_activate(), overlay_vulkan_activate(), program_opencl_activate(), and stack_activate().

ff_framesync_init_dualinput()

int ff_framesync_init_dualinput ( FFFrameSyncfs,
AVFilterContextparent 
)

Initialize a frame sync structure for dualinput.

Compared to generic framesync, dualinput assumes the first input is the main one and the filtering is performed on it. The first input will be the only one with sync set and generic timeline support will just pass it unchanged when disabled.

Equivalent to ff_framesync_init(fs, parent, 2) then setting the time base, sync and ext modes on the inputs.

Definition at line 372 of file framesync.c.

Referenced by config_output(), config_props_output(), overlay_cuda_config_output(), overlay_opencl_config_output(), overlay_vaapi_config_output(), and overlay_vulkan_config_output().

ff_framesync_dualinput_get()

int ff_framesync_dualinput_get ( FFFrameSyncfs,
AVFrame **  f0,
AVFrame **  f1 
)
Parameters
f0 used to return the main frame
f1 used to return the second frame, or NULL if disabled
Returns
>=0 for success or AVERROR code
Note
The frame returned in f0 belongs to the caller (get = 1 in ff_framesync_get_frame()) while the frame returned in f1 is still owned by the framesync structure.

Definition at line 390 of file framesync.c.

Referenced by blend_frame_for_dualinput(), do_convolve(), do_corr(), do_identity(), do_morpho(), do_psnr(), do_ssim(), do_ssim360(), do_vmaf(), do_xpsnr(), ff_framesync_dualinput_get_writable(), overlay_cuda_blend(), process_frame(), and varblur_frame().

ff_framesync_dualinput_get_writable()

int ff_framesync_dualinput_get_writable ( FFFrameSyncfs,
AVFrame **  f0,
AVFrame **  f1 
)

Same as ff_framesync_dualinput_get(), but make sure that f0 is writable.

Definition at line 410 of file framesync.c.

Referenced by do_alphamerge(), do_blend(), and load_apply_palette().

Variable Documentation

framesync_options

const AVOption framesync_options[]
static
Initial value:
= {
{ "eof_action", "Action to take when encountering EOF from secondary input ",
OFFSET(opt_eof_action), AV_OPT_TYPE_INT, { .i64 = EOF_ACTION_REPEAT },
EOF_ACTION_REPEAT, EOF_ACTION_PASS, .flags = FLAGS, .unit = "eof_action" },
{ "repeat", "Repeat the previous frame.", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_REPEAT }, .flags = FLAGS, .unit = "eof_action" },
{ "endall", "End both streams.", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_ENDALL }, .flags = FLAGS, .unit = "eof_action" },
{ "pass", "Pass through the main input.", 0, AV_OPT_TYPE_CONST, { .i64 = EOF_ACTION_PASS }, .flags = FLAGS, .unit = "eof_action" },
{ "shortest", "force termination when the shortest input terminates", OFFSET(opt_shortest), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ "repeatlast", "extend last frame of secondary streams beyond EOF", OFFSET(opt_repeatlast), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
{ "ts_sync_mode", "How strictly to sync streams based on secondary input timestamps",
OFFSET(opt_ts_sync_mode), AV_OPT_TYPE_INT, { .i64 = TS_DEFAULT },
TS_DEFAULT, TS_NEAREST, .flags = FLAGS, .unit = "ts_sync_mode" },
{ "default", "Frame from secondary input with the nearest lower or equal timestamp to the primary input frame",
0, AV_OPT_TYPE_CONST, { .i64 = TS_DEFAULT }, .flags = FLAGS, .unit = "ts_sync_mode" },
{ "nearest", "Frame from secondary input with the absolute nearest timestamp to the primary input frame",
0, AV_OPT_TYPE_CONST, { .i64 = TS_NEAREST }, .flags = FLAGS, .unit = "ts_sync_mode" },
{ NULL }
}

Definition at line 36 of file framesync.c.

ff_framesync_class

const AVClass ff_framesync_class
Initial value:
= {
.class_name = "framesync",
.item_name = framesync_name,
.option = framesync_options,
.parent_log_context_offset = OFFSET(parent),
}

Definition at line 54 of file framesync.c.

Referenced by child_class_iterate(), ff_framesync_child_class_iterate(), and ff_framesync_preinit().

@ EOF_ACTION_ENDALL
Definition: framesync.h:28
#define OFFSET(member)
Definition: framesync.c:28
#define FLAGS
Definition: framesync.c:29
@ EOF_ACTION_PASS
Definition: framesync.h:29
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
@ TS_DEFAULT
Sync to frames from secondary input with the nearest, lower or equal timestamp to the frame event one...
Definition: framesync.h:90
#define NULL
Definition: coverity.c:32
@ AV_CLASS_CATEGORY_FILTER
Definition: log.h:36
static const AVOption framesync_options[]
Definition: framesync.c:36
@ EOF_ACTION_REPEAT
Definition: framesync.h:27
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
@ TS_NEAREST
Sync to frames from secondary input with the absolute nearest timestamp to the frame event one.
Definition: framesync.h:96
static const char * framesync_name(void *ptr)
Definition: framesync.c:31
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299

Generated on Fri Aug 22 2025 14:00:04 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /