Go to the documentation of this file.
26 #include "config_components.h"
168 #define OFFSET(x) offsetof(SelectContext, x)
169 #define DEFINE_OPTIONS(filt_name, FLAGS) \
170 static const AVOption filt_name##_options[] = { \
171 { "expr", "set an expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags=FLAGS }, \
172 { "e", "set an expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags=FLAGS }, \
173 { "outputs", "set the number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, .flags=FLAGS }, \
174 { "n", "set the number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, .flags=FLAGS }, \
199 pad.
type =
ctx->filter->inputs[0].type;
208 #define INTERLACE_TYPE_P 0
209 #define INTERLACE_TYPE_T 1
210 #define INTERLACE_TYPE_B 2
218 desc->nb_components >= 3;
223 for (
int plane = 0; plane < select->
nb_planes; plane++) {
225 int vsub =
desc->log2_chroma_h;
291 for (
int plane = 0; plane < select->
nb_planes; plane++) {
295 select->
width[plane], select->
height[plane], &plane_sad);
297 count += select->
width[plane] * select->
height[plane];
315 if (start_time_entry) {
318 if (duration_entry) {
376 "n:%f pts:%f t:%f key:%d",
399 }
else if (
isnan(res) || res < 0) {
452 #if CONFIG_ASELECT_FILTER
473 static const AVFilterPad avfilter_af_aselect_inputs[] = {
485 .init = aselect_init,
489 .priv_class = &aselect_class,
494 #if CONFIG_SELECT_FILTER
528 static const AVFilterPad avfilter_vf_select_inputs[] = {
543 .priv_class = &select_class,
#define FF_ENABLE_DEPRECATION_WARNINGS
AVPixelFormat
Pixel format.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static int request_frame(AVFilterLink *outlink)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
char * av_asprintf(const char *fmt,...)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
static double get_concatdec_select(AVFrame *frame, int64_t pts)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define FILTER_QUERY_FUNC(func)
static av_cold void uninit(AVFilterContext *ctx)
#define AV_PIX_FMT_YUV420P10
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
const char * name
Filter name.
ff_scene_sad_fn sad
Sum of the absolute difference function (scene detect only)
A link between two filters.
static __device__ float ceilf(float a)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
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.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
A filter pad used for either input or output.
#define AV_OPT_FLAG_AUDIO_PARAM
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int(* request_frame)(AVFilterLink *link)
Frame request callback.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
static double get_scene_score(AVFilterContext *ctx, AVFrame *frame)
#define AV_CEIL_RSHIFT(a, b)
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static enum AVPixelFormat pix_fmts[]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int select_out
mark the selected output pad index
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FILTER_INPUTS(array)
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
ff_scene_sad_fn ff_scene_sad_get_fn(int depth)
Describe the class of an AVClass context structure.
static __device__ float fabs(float a)
const AVFilter ff_af_aselect
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
AVFilterLink ** inputs
array of pointers to input links
@ AV_PICTURE_TYPE_SI
Switching Intra.
@ AV_PICTURE_TYPE_I
Intra.
AVFrame * prev_picref
previous frame (scene detect only)
#define DEFINE_OPTIONS(filt_name, FLAGS)
static av_cold int init(AVFilterContext *ctx)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PICTURE_TYPE_SP
Switching Predicted.
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
double prev_mafd
previous MAFD (scene detect only)
int do_scene_detect
1 if the expression requires scene detection variables, 0 otherwise
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
static int config_input(AVFilterLink *inlink)
#define AV_OPT_FLAG_FILTERING_PARAM
A generic parameter which can be set by the user for filtering.
enum AVPictureType pict_type
Picture type of the frame.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
static int64_t start_time
void(* ff_scene_sad_fn)(SCENE_SAD_PARAMS)
static const char *const var_names[]
attribute_deprecated int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
AVFilterContext * src
source filter
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
#define AVFILTER_DEFINE_CLASS(fname)
int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane)
Compute the size of an image line with format pix_fmt and width width for the plane plane.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
int nb_samples
number of audio samples (per channel) described by this frame
#define i(width, name, range_min, range_max)
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
#define AV_OPT_FLAG_VIDEO_PARAM
const char * name
Pad name.
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
static void select_frame(AVFilterContext *ctx, AVFrame *frame)
enum AVMediaType type
AVFilterPad type.
double var_values[VAR_VARS_NB]
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
AVDictionary * metadata
metadata.
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
#define FF_DISABLE_DEPRECATION_WARNINGS
@ AV_PICTURE_TYPE_P
Predicted.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
@ AV_PICTURE_TYPE_BI
BI type.
static int query_formats(AVFilterContext *ctx)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
const AVFilter ff_vf_select