75 #define OFFSET(x) offsetof(AspectContext, x) 76 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM 92 double var_values[
VARS_NB], res;
95 var_values[
VAR_W] = inlink->
w;
96 var_values[
VAR_H] = inlink->
h;
97 var_values[
VAR_A] = (double) inlink->
w / inlink->
h;
115 "Error when evaluating the expression '%s'\n", s->
ratio_expr);
118 if (aspect_ratio->
num < 0 || aspect_ratio->
den <= 0) {
120 "Invalid string '%s' for aspect ratio\n", s->
ratio_expr);
126 #if CONFIG_SETDAR_FILTER 144 s->
dar.
den * inlink->
w, INT_MAX);
154 inlink->
w, inlink->
h, old_dar.
num, old_dar.
den, old_sar.
num, old_sar.
den,
160 static const AVOption setdar_options[] = {
170 static const AVFilterPad avfilter_vf_setdar_inputs[] = {
179 static const AVFilterPad avfilter_vf_setdar_outputs[] = {
183 .config_props = setdar_config_props,
192 .priv_class = &setdar_class,
193 .
inputs = avfilter_vf_setdar_inputs,
194 .
outputs = avfilter_vf_setdar_outputs,
199 #if CONFIG_SETSAR_FILTER 218 inlink->
w, inlink->
h, old_sar.
num, old_sar.
den, old_dar.
num, old_dar.
den,
224 static const AVOption setsar_options[] = {
234 static const AVFilterPad avfilter_vf_setsar_inputs[] = {
243 static const AVFilterPad avfilter_vf_setsar_outputs[] = {
247 .config_props = setsar_config_props,
256 .priv_class = &setsar_class,
257 .
inputs = avfilter_vf_setsar_inputs,
258 .
outputs = avfilter_vf_setsar_outputs,
int av_parse_ratio(AVRational *q, const char *str, int max, int log_offset, void *log_ctx)
Parse str and store the parsed ratio in q.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
static const char *const var_names[]
static void compute_dar(AVRational *dar, AVRational sar, int w, int h)
Main libavfilter public API header.
int h
agreed upon image height
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
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.
static int get_aspect_ratio(AVFilterLink *inlink, AVRational *aspect_ratio)
#define AV_LOG_VERBOSE
Detailed information.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
A filter pad used for either input or output.
A link between two filters.
int av_expr_parse_and_eval(double *d, const char *s, const char *const *const_names, const double *const_values, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx)
Parse and evaluate an expression.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
#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
int w
agreed upon image width
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
AVFilterContext * src
source filter
static const AVFilterPad outputs[]
int format
agreed upon media format
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
const char * name
Filter name.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
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 link
AVFilterLink ** outputs
array of pointers to output links
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
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
common internal and external API header
AVFilterContext * dst
dest filter
#define AVFILTER_DEFINE_CLASS(fname)
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
static int filter_frame(AVFilterLink *link, AVFrame *frame)
simple arithmetic expression evaluator