28 #include "libavutil/common.h"
29 #include "libavutil/eval.h"
30 #include "libavutil/mathematics.h"
31 #include "libavutil/opt.h"
32 #include "libavutil/parseutils.h"
33 #include "libavutil/pixdesc.h"
69 #if FF_API_OLD_FILTER_OPTS
75 #if FF_API_OLD_FILTER_OPTS
82 "dar=<number> or dar=num/den.\n");
98 #define OFFSET(x) offsetof(AspectContext, x)
99 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM
106 double var_values[
VARS_NB], res;
109 var_values[
VAR_PI] = M_PI;
112 var_values[
VAR_W] = inlink->
w;
113 var_values[
VAR_H] = inlink->
h;
114 var_values[
VAR_A] = (double) inlink->
w / inlink->
h;
126 "Error when evaluating the expression '%s'\n", s->
ratio_expr);
129 *aspect_ratio =
av_d2q(res, INT_MAX);
133 #if CONFIG_SETDAR_FILTER
141 #if FF_API_OLD_FILTER_OPTS
146 #if FF_API_OLD_FILTER_OPTS
162 inlink->
w, inlink->
h, dar.
num, dar.
den,
168 static const AVOption setdar_options[] = {
169 #if FF_API_OLD_FILTER_OPTS
177 static const AVClass setdar_class = {
180 .option = setdar_options,
184 static const AVFilterPad avfilter_vf_setdar_inputs[] = {
188 .config_props = setdar_config_props,
195 static const AVFilterPad avfilter_vf_setdar_outputs[] = {
207 #if FF_API_OLD_FILTER_OPTS
212 .priv_class = &setdar_class,
214 .
inputs = avfilter_vf_setdar_inputs,
216 .
outputs = avfilter_vf_setdar_outputs,
220 #if CONFIG_SETSAR_FILTER
227 #if FF_API_OLD_FILTER_OPTS
232 #if FF_API_OLD_FILTER_OPTS
241 static const AVOption setsar_options[] = {
242 #if FF_API_OLD_FILTER_OPTS
250 static const AVClass setsar_class = {
253 .option = setsar_options,
257 static const AVFilterPad avfilter_vf_setsar_inputs[] = {
261 .config_props = setsar_config_props,
268 static const AVFilterPad avfilter_vf_setsar_outputs[] = {
280 #if FF_API_OLD_FILTER_OPTS
285 .priv_class = &setsar_class,
287 .
inputs = avfilter_vf_setsar_inputs,
289 .
outputs = avfilter_vf_setsar_outputs,
This structure describes decoded (raw) audio or video data.
static const char *const var_names[]
const char * name
Filter name.
void * priv
private data for use by the filter
#define AV_LOG_WARNING
Something somehow does not look correct.
static const AVFilterPad outputs[]
int h
agreed upon image height
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
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)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define AV_LOG_VERBOSE
Detailed information.
A link between two filters.
#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. ...
static av_cold int init(AVFilterContext *ctx)
int w
agreed upon image width
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
AVRational av_d2q(double d, int max) av_const
Convert a double precision floating point number to a rational.
int av_expr_parse_and_eval(double *res, 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.
int format
agreed upon media format
Main libavfilter public API header.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
AVFilterLink ** outputs
array of pointers to output links
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.
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
rational number numerator/denominator
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
struct AVFilterPad AVFilterPad
av_default_item_name
Return the context name.
static int filter_frame(AVFilterLink *link, AVFrame *frame)