Commit a5e8c41c authored by Anton Khirnov's avatar Anton Khirnov

lavfi: remove 'opaque' parameter from AVFilter.init()

It is not used in any filters currently and is inherently evil. If
passing binary data to filters is required in the future, it should be
done with some AVOptions-based system.
parent fbcaceb1
......@@ -86,7 +86,7 @@ static int get_sample_rate(const char *samplerate)
return FFMAX(ret, 0);
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
AFormatContext *s = ctx->priv;
int ret;
......
......@@ -479,7 +479,7 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
avfilter_unref_buffer(buf);
}
static int init(AVFilterContext *ctx, const char *args, void *opaque)
static int init(AVFilterContext *ctx, const char *args)
{
MixContext *s = ctx->priv;
int i, ret;
......
......@@ -56,7 +56,7 @@ static const AVClass async_class = {
.version = LIBAVUTIL_VERSION_INT,
};
static int init(AVFilterContext *ctx, const char *args, void *opaque)
static int init(AVFilterContext *ctx, const char *args)
{
ASyncContext *s = ctx->priv;
int ret;
......
......@@ -118,8 +118,7 @@ static int get_channel(char **map, uint64_t *ch, char delim)
return 0;
}
static av_cold int channelmap_init(AVFilterContext *ctx, const char *args,
void *opaque)
static av_cold int channelmap_init(AVFilterContext *ctx, const char *args)
{
ChannelMapContext *s = ctx->priv;
int ret;
......
......@@ -52,7 +52,7 @@ static const AVClass channelsplit_class = {
.version = LIBAVUTIL_VERSION_INT,
};
static int init(AVFilterContext *ctx, const char *arg, void *opaque)
static int init(AVFilterContext *ctx, const char *arg)
{
ChannelSplitContext *s = ctx->priv;
int nb_channels;
......
......@@ -184,7 +184,7 @@ static int parse_maps(AVFilterContext *ctx)
return 0;
}
static int join_init(AVFilterContext *ctx, const char *args, void *opaque)
static int join_init(AVFilterContext *ctx, const char *args)
{
JoinContext *s = ctx->priv;
int ret, i;
......
......@@ -30,7 +30,7 @@ typedef struct {
int64_t sample_rate;
} ANullContext;
static int init(AVFilterContext *ctx, const char *args, void *opaque)
static int init(AVFilterContext *ctx, const char *args)
{
ANullContext *priv = ctx->priv;
char channel_layout_str[128] = "";
......
......@@ -429,7 +429,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
int ret=0;
if (filter->filter->init)
ret = filter->filter->init(filter, args, opaque);
ret = filter->filter->init(filter, args);
return ret;
}
......
......@@ -456,10 +456,8 @@ typedef struct AVFilter {
/**
* Filter initialization function. Args contains the user-supplied
* parameters. FIXME: maybe an AVOption-based system would be better?
* opaque is data provided by the code requesting creation of the filter,
* and is used to pass data to the filter.
*/
int (*init)(AVFilterContext *ctx, const char *args, void *opaque);
int (*init)(AVFilterContext *ctx, const char *args);
/**
* Filter uninitialization function. Should deallocate any memory held
......
......@@ -173,7 +173,7 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf)
return 0;
}
static av_cold int init_video(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init_video(AVFilterContext *ctx, const char *args)
{
BufferSourceContext *c = ctx->priv;
char pix_fmt_str[128];
......@@ -219,7 +219,7 @@ static const AVClass abuffer_class = {
.version = LIBAVUTIL_VERSION_INT,
};
static av_cold int init_audio(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init_audio(AVFilterContext *ctx, const char *args)
{
BufferSourceContext *s = ctx->priv;
int ret = 0;
......
......@@ -50,7 +50,7 @@ typedef struct {
int allocated_samples; ///< number of samples buf_out was allocated for
} FifoContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
FifoContext *fifo = ctx->priv;
fifo->last = &fifo->root;
......
......@@ -28,7 +28,7 @@
#include "internal.h"
#include "video.h"
static int split_init(AVFilterContext *ctx, const char *args, void *opaque)
static int split_init(AVFilterContext *ctx, const char *args)
{
int i, nb_outputs = 2;
......
......@@ -32,7 +32,7 @@ typedef struct {
AVRational aspect;
} AspectContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
AspectContext *aspect = ctx->priv;
double ratio;
......
......@@ -51,7 +51,7 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
BlackFrameContext *blackframe = ctx->priv;
......
......@@ -77,7 +77,7 @@ typedef struct {
#define V 2
#define A 3
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
BoxBlurContext *boxblur = ctx->priv;
int e;
......
......@@ -113,7 +113,7 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
CropContext *crop = ctx->priv;
......
......@@ -80,7 +80,7 @@ static int checkline(void *ctx, const unsigned char *src, int stride, int len, i
return total;
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
CropDetectContext *cd = ctx->priv;
......
......@@ -171,7 +171,7 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
DelogoContext *delogo = ctx->priv;
int ret = 0;
......
......@@ -40,7 +40,7 @@ typedef struct {
int vsub, hsub; ///< chroma subsampling
} DrawBoxContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
DrawBoxContext *drawbox= ctx->priv;
char color_str[1024] = "black";
......
......@@ -280,7 +280,7 @@ error:
return ret;
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
int err;
DrawTextContext *dtext = ctx->priv;
......
......@@ -37,7 +37,7 @@ typedef struct {
int hsub, vsub, bpp;
} FadeContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
FadeContext *fade = ctx->priv;
unsigned int nb_frames;
......
......@@ -38,7 +38,7 @@ typedef struct
int line_size[4]; ///< bytes of pixel data per line for each plane
} FieldOrderContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
FieldOrderContext *fieldorder = ctx->priv;
......
......@@ -39,7 +39,7 @@ typedef struct {
#define PIX_FMT_NAME_MAXSIZE 32
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
FormatContext *format = ctx->priv;
const char *cur, *sep;
......
......@@ -63,7 +63,7 @@ static const AVClass class = {
.version = LIBAVUTIL_VERSION_INT,
};
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
FPSContext *s = ctx->priv;
int ret;
......
......@@ -278,7 +278,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
return 0;
}
static av_cold int filter_init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int filter_init(AVFilterContext *ctx, const char *args)
{
Frei0rContext *frei0r = ctx->priv;
char dl_name[1024], c;
......@@ -381,7 +381,7 @@ AVFilter avfilter_vf_frei0r = {
{ .name = NULL}},
};
static av_cold int source_init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int source_init(AVFilterContext *ctx, const char *args)
{
Frei0rContext *frei0r = ctx->priv;
char dl_name[1024], c;
......
......@@ -118,7 +118,7 @@ static void filter(GradFunContext *ctx, uint8_t *dst, uint8_t *src, int width, i
}
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
GradFunContext *gf = ctx->priv;
float thresh = 1.2;
......
......@@ -197,7 +197,7 @@ static void PrecalcCoefs(int *Ct, double Dist25)
#define PARAM2_DEFAULT 3.0
#define PARAM3_DEFAULT 6.0
static int init(AVFilterContext *ctx, const char *args, void *opaque)
static int init(AVFilterContext *ctx, const char *args)
{
HQDN3DContext *hqdn3d = ctx->priv;
double LumSpac, LumTmp, ChromSpac, ChromTmp;
......
......@@ -71,7 +71,7 @@ static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
typedef struct {
const char *name;
int (*init)(AVFilterContext *ctx, const char *args, void *opaque);
int (*init)(AVFilterContext *ctx, const char *args);
void (*uninit)(AVFilterContext *ctx);
void (*end_frame_filter)(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg);
void *priv;
......@@ -83,7 +83,7 @@ typedef struct {
double param3, param4;
} SmoothContext;
static av_cold int smooth_init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int smooth_init(AVFilterContext *ctx, const char *args)
{
OCVContext *ocv = ctx->priv;
SmoothContext *smooth = ocv->priv;
......@@ -249,7 +249,7 @@ typedef struct {
IplConvKernel *kernel;
} DilateContext;
static av_cold int dilate_init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int dilate_init(AVFilterContext *ctx, const char *args)
{
OCVContext *ocv = ctx->priv;
DilateContext *dilate = ocv->priv;
......@@ -303,7 +303,7 @@ static void erode_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplIma
typedef struct {
const char *name;
size_t priv_size;
int (*init)(AVFilterContext *ctx, const char *args, void *opaque);
int (*init)(AVFilterContext *ctx, const char *args);
void (*uninit)(AVFilterContext *ctx);
void (*end_frame_filter)(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg);
} OCVFilterEntry;
......@@ -314,7 +314,7 @@ static OCVFilterEntry ocv_filter_entries[] = {
{ "smooth", sizeof(SmoothContext), smooth_init, NULL, smooth_end_frame_filter },
};
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
OCVContext *ocv = ctx->priv;
char name[128], priv_args[1024];
......@@ -333,7 +333,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if (!(ocv->priv = av_mallocz(entry->priv_size)))
return AVERROR(ENOMEM);
return ocv->init(ctx, priv_args, opaque);
return ocv->init(ctx, priv_args);
}
}
......
......@@ -110,7 +110,7 @@ static const AVClass lut_class = {
lut_options
};
static int init(AVFilterContext *ctx, const char *args, void *opaque)
static int init(AVFilterContext *ctx, const char *args)
{
LutContext *lut = ctx->priv;
int ret;
......@@ -375,7 +375,7 @@ DEFINE_LUT_FILTER(lutrgb, "Compute and apply a lookup table to the RGB input vid
#if CONFIG_NEGATE_FILTER
static int negate_init(AVFilterContext *ctx, const char *args, void *opaque)
static int negate_init(AVFilterContext *ctx, const char *args)
{
LutContext *lut = ctx->priv;
char lut_params[64];
......@@ -388,7 +388,7 @@ static int negate_init(AVFilterContext *ctx, const char *args, void *opaque)
snprintf(lut_params, sizeof(lut_params), "c0=negval:c1=negval:c2=negval:a=%s",
lut->negate_alpha ? "negval" : "val");
return init(ctx, lut_params, opaque);
return init(ctx, lut_params);
}
DEFINE_LUT_FILTER(negate, "Negate input video.", negate_init);
......
......@@ -71,7 +71,7 @@ typedef struct {
char x_expr[256], y_expr[256];
} OverlayContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
OverlayContext *over = ctx->priv;
......
......@@ -108,7 +108,7 @@ typedef struct {
int needs_copy;
} PadContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
PadContext *pad = ctx->priv;
char color_string[128] = "black";
......
......@@ -83,7 +83,7 @@ typedef struct {
char h_expr[256]; ///< height expression string
} ScaleContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
ScaleContext *scale = ctx->priv;
const char *p;
......
......@@ -122,7 +122,7 @@ typedef struct {
AVFifoBuffer *pending_frames; ///< FIFO buffer of video frames
} SelectContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
SelectContext *select = ctx->priv;
int ret;
......
......@@ -67,7 +67,7 @@ typedef struct {
double var_values[VAR_VARS_NB];
} SetPTSContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
SetPTSContext *setpts = ctx->priv;
int ret;
......
......@@ -54,7 +54,7 @@ typedef struct {
double var_values[VAR_VARS_NB];
} SetTBContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
SetTBContext *settb = ctx->priv;
av_strlcpy(settb->tb_expr, "intb", sizeof(settb->tb_expr));
......
......@@ -33,7 +33,7 @@ typedef struct {
unsigned int frame;
} ShowInfoContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
ShowInfoContext *showinfo = ctx->priv;
showinfo->frame = 0;
......
......@@ -35,7 +35,7 @@ typedef struct {
int use_random_h; ///< enable the use of random slice height values
} SliceContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
SliceContext *slice = ctx->priv;
......
......@@ -44,7 +44,7 @@ typedef struct {
int dir;
} TransContext;
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
TransContext *trans = ctx->priv;
trans->dir = 0;
......
......@@ -132,7 +132,7 @@ static void set_filter_param(FilterParam *fp, int msize_x, int msize_y, double a
fp->halfscale = 1 << (fp->scalebits - 1);
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
UnsharpContext *unsharp = ctx->priv;
int lmsize_x = 5, cmsize_x = 5;
......
......@@ -394,7 +394,7 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
YADIFContext *yadif = ctx->priv;
int cpu_flags = av_get_cpu_flags();
......
......@@ -44,7 +44,7 @@ typedef struct {
uint64_t pts;
} ColorContext;
static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int color_init(AVFilterContext *ctx, const char *args)
{
ColorContext *color = ctx->priv;
char color_string[128] = "black";
......
......@@ -162,7 +162,7 @@ static int movie_init(AVFilterContext *ctx)
return 0;
}
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
MovieContext *movie = ctx->priv;
int ret;
......
......@@ -51,7 +51,7 @@ typedef struct {
double var_values[VAR_VARS_NB];
} NullContext;
static int init(AVFilterContext *ctx, const char *args, void *opaque)
static int init(AVFilterContext *ctx, const char *args)
{
NullContext *priv = ctx->priv;
......
......@@ -70,7 +70,7 @@ static const AVOption testsrc_options[] = {
{ NULL },
};
static av_cold int init_common(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int init_common(AVFilterContext *ctx, const char *args)
{
TestSourceContext *test = ctx->priv;
AVRational frame_rate_q;
......@@ -336,13 +336,13 @@ static void test_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref)
}
}
static av_cold int test_init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int test_init(AVFilterContext *ctx, const char *args)
{
TestSourceContext *test = ctx->priv;
test->class = &testsrc_class;
test->fill_picture_fn = test_fill_picture;
return init_common(ctx, args, opaque);
return init_common(ctx, args);
}
static int test_query_formats(AVFilterContext *ctx)
......@@ -442,13 +442,13 @@ static void rgbtest_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref
}
}
static av_cold int rgbtest_init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold int rgbtest_init(AVFilterContext *ctx, const char *args)
{
TestSourceContext *test = ctx->priv;
test->class = &rgbtestsrc_class;
test->fill_picture_fn = rgbtest_fill_picture;
return init_common(ctx, args, opaque);
return init_common(ctx, args);
}
static int rgbtest_query_formats(AVFilterContext *ctx)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment