156 #define OFFSET(x) offsetof(SelectContext, x) 157 #define DEFINE_OPTIONS(filt_name, FLAGS) \ 158 static const AVOption filt_name##_options[] = { \ 159 { "expr", "set an expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags=FLAGS }, \ 160 { "e", "set an expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags=FLAGS }, \ 161 { "outputs", "set the number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, .flags=FLAGS }, \ 162 { "n", "set the number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, .flags=FLAGS }, \ 198 #define INTERLACE_TYPE_P 0 199 #define INTERLACE_TYPE_T 1 200 #define INTERLACE_TYPE_B 2 266 mafd = (double)sad / (frame->
width * 3 * frame->
height);
268 ret = av_clipf(
FFMIN(mafd, diff) / 100., 0, 1);
281 if (start_time_entry) {
283 if (pts >= start_time) {
284 if (duration_entry) {
286 if (pts < start_time + duration)
298 #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d)) 299 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) 319 switch (inlink->
type) {
341 "n:%f pts:%f t:%f key:%d",
347 switch (inlink->
type) {
364 }
else if (
isnan(res) || res < 0) {
421 #if CONFIG_ASELECT_FILTER 431 if ((ret =
init(ctx)) < 0)
442 static const AVFilterPad avfilter_af_aselect_inputs[] = {
455 .init = aselect_init,
458 .
inputs = avfilter_af_aselect_inputs,
459 .priv_class = &aselect_class,
464 #if CONFIG_SELECT_FILTER 496 if ((ret =
init(ctx)) < 0)
502 static const AVFilterPad avfilter_vf_select_inputs[] = {
519 .priv_class = &select_class,
520 .
inputs = avfilter_vf_select_inputs,
void(* ff_scene_sad_fn)(SCENE_SAD_PARAMS)
This structure describes decoded (raw) audio or video data.
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
static av_cold void uninit(AVFilterContext *ctx)
Main libavfilter public API header.
packed RGB 8:8:8, 24bpp, RGBRGB...
ff_scene_sad_fn ff_scene_sad_get_fn(int depth)
#define AV_OPT_FLAG_AUDIO_PARAM
enum AVMediaType type
AVFilterPad type.
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
static double get_concatdec_select(AVFrame *frame, int64_t pts)
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
AVFilterPad * output_pads
array of output pads
static int64_t start_time
ff_scene_sad_fn sad
Sum of the absolute difference function (scene detect only)
static void select_frame(AVFilterContext *ctx, AVFrame *frame)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
AVDictionary * metadata
metadata.
int interlaced_frame
The content of the picture is interlaced.
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
#define i(width, name, range_min, range_max)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int sample_rate
samples per second
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
double var_values[VAR_VARS_NB]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
unsigned nb_outputs
number of output pads
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
int select_out
mark the selected output pad index
char * av_asprintf(const char *fmt,...)
static int config_input(AVFilterLink *inlink)
common internal API header
enum AVPictureType pict_type
Picture type of the frame.
packed RGB 8:8:8, 24bpp, BGRBGR...
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
const AVFilterPad * inputs
List of inputs, terminated by a zeroed element.
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define AV_OPT_FLAG_VIDEO_PARAM
static double get_scene_score(AVFilterContext *ctx, AVFrame *frame)
a very simple circular buffer FIFO implementation
double prev_mafd
previous MAFD (scene detect only)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Describe the class of an AVClass context structure.
#define CONFIG_SELECT_FILTER
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
static int request_frame(AVFilterLink *outlink)
#define flags(name, subs,...)
enum AVMediaType type
filter media type
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int do_scene_detect
1 if the expression requires scene detection variables, 0 otherwise
AVFrame * prev_picref
previous frame (scene detect only)
#define DEFINE_OPTIONS(filt_name, FLAGS)
static int query_formats(AVFilterContext *ctx)
static av_cold int init(AVFilterContext *ctx)
static av_always_inline int diff(const uint32_t a, const uint32_t b)
int top_field_first
If the content is interlaced, is top field displayed first.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
AVFilterContext * dst
dest filter
#define AVFILTER_DEFINE_CLASS(fname)
int key_frame
1 -> keyframe, 0-> not
int(* request_frame)(AVFilterLink *link)
Frame request callback.
static const char *const var_names[]
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
static int ff_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new output pad for the filter.
AVPixelFormat
Pixel format.
int nb_samples
number of audio samples (per channel) described by this frame
const AVFilter * filter
the AVFilter of which this is an instance
simple arithmetic expression evaluator