50 typedef void (*
f0r_update_f)(f0r_instance_t instance,
double time,
const uint32_t *inframe, uint32_t *outframe);
51 typedef void (*
f0r_update2_f)(f0r_instance_t instance,
double time,
const uint32_t *inframe1,
const uint32_t *inframe2,
const uint32_t *inframe3, uint32_t *outframe);
82 void *sym = dlsym(s->
dl_handle, sym_name);
93 f0r_param_color_t col;
94 f0r_param_position_t pos;
101 if (!strcmp(param,
"y"))
val.d = 1.0;
102 else if (!strcmp(param,
"n"))
val.d = 0.0;
106 case F0R_PARAM_DOUBLE:
108 if (*tail ||
val.d == HUGE_VAL)
112 case F0R_PARAM_COLOR:
113 if (sscanf(param,
"%f/%f/%f", &
val.col.r, &
val.col.g, &
val.col.b) != 3) {
116 val.col.r = rgba[0] / 255.0;
117 val.col.g = rgba[1] / 255.0;
118 val.col.b = rgba[2] / 255.0;
122 case F0R_PARAM_POSITION:
123 if (sscanf(param,
"%lf/%lf", &
val.pos.x, &
val.pos.y) != 2)
146 f0r_param_info_t info;
164 "idx:%d name:'%s' type:%s explanation:'%s' ",
166 info.type == F0R_PARAM_BOOL ?
"bool" :
167 info.type == F0R_PARAM_DOUBLE ?
"double" :
168 info.type == F0R_PARAM_COLOR ?
"color" :
169 info.type == F0R_PARAM_POSITION ?
"position" :
170 info.type == F0R_PARAM_STRING ?
"string" :
"unknown",
179 f0r_param_color_t col;
180 f0r_param_position_t pos;
187 case F0R_PARAM_DOUBLE:
189 s->get_param_value(s->instance, v, i);
192 case F0R_PARAM_COLOR:
194 s->get_param_value(s->instance, v, i);
197 case F0R_PARAM_POSITION:
199 s->get_param_value(s->instance, v, i);
204 s->get_param_value(s->instance, v, i);
217 char *path =
av_asprintf(
"%s%s%s", prefix, name, SLIBSUF);
221 *handle_ptr = dlopen(path, RTLD_NOW|RTLD_LOCAL);
227 const char *dl_name,
int type)
232 f0r_plugin_info_t *pi;
236 static const char*
const frei0r_pathlist[] = {
237 "/usr/local/lib/frei0r-1/",
238 "/usr/lib/frei0r-1/",
239 "/usr/local/lib64/frei0r-1/",
240 "/usr/lib64/frei0r-1/"
249 if ((path =
av_strdup(getenv(
"FREI0R_PATH")))) {
251 const char *separator =
";";
253 const char *separator =
":";
255 char *p, *ptr = NULL;
256 for (p = path; p =
av_strtok(p, separator, &ptr); p = NULL) {
276 if (!s->
dl_handle && (path = getenv(
"HOME"))) {
277 char *prefix =
av_asprintf(
"%s/.frei0r-1/lib/", path);
295 if (!(f0r_init =
load_sym(ctx,
"f0r_init" )) ||
296 !(f0r_get_plugin_info =
load_sym(ctx,
"f0r_get_plugin_info")) ||
306 if (f0r_init() < 0) {
313 if (pi->plugin_type != type) {
315 "Invalid type '%s' for this plugin\n",
316 pi->plugin_type == F0R_PLUGIN_TYPE_FILTER ?
"filter" :
317 pi->plugin_type == F0R_PLUGIN_TYPE_SOURCE ?
"source" :
318 pi->plugin_type == F0R_PLUGIN_TYPE_MIXER2 ?
"mixer2" :
319 pi->plugin_type == F0R_PLUGIN_TYPE_MIXER3 ?
"mixer3" :
"unknown");
324 "name:%s author:'%s' explanation:'%s' color_model:%s "
325 "frei0r_version:%d version:%d.%d num_params:%d\n",
326 pi->name, pi->author, pi->explanation,
327 pi->color_model == F0R_COLOR_MODEL_BGRA8888 ?
"bgra8888" :
328 pi->color_model == F0R_COLOR_MODEL_RGBA8888 ?
"rgba8888" :
329 pi->color_model == F0R_COLOR_MODEL_PACKED32 ?
"packed32" :
"unknown",
330 pi->frei0r_version, pi->major_version, pi->minor_version, pi->num_params);
374 if (s->
plugin_info.color_model == F0R_COLOR_MODEL_BGRA8888) {
376 }
else if (s->
plugin_info.color_model == F0R_COLOR_MODEL_RGBA8888) {
406 (
const uint32_t *)in->
data[0],
407 (uint32_t *)out->
data[0]);
414 #define OFFSET(x) offsetof(Frei0rContext, x)
415 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
449 .priv_class = &frei0r_class,
450 .
inputs = avfilter_vf_frei0r_inputs,
451 .
outputs = avfilter_vf_frei0r_outputs,
528 .
name =
"frei0r_src",
531 .priv_class = &frei0r_src_class,
536 .
outputs = avfilter_vsrc_frei0r_src_outputs,