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);
78 void *sym = dlsym(frei0r->
dl_handle, sym_name);
89 f0r_param_color_t col;
90 f0r_param_position_t pos;
97 if (!strcmp(param,
"y")) val.d = 1.0;
98 else if (!strcmp(param,
"n")) val.d = 0.0;
102 case F0R_PARAM_DOUBLE:
103 val.d =
strtod(param, &tail);
104 if (*tail || val.d == HUGE_VAL)
108 case F0R_PARAM_COLOR:
109 if (sscanf(param,
"%f/%f/%f", &val.col.r, &val.col.g, &val.col.b) != 3) {
112 val.col.r = rgba[0] / 255.0;
113 val.col.g = rgba[1] / 255.0;
114 val.col.b = rgba[2] / 255.0;
118 case F0R_PARAM_POSITION:
119 if (sscanf(param,
"%lf/%lf", &val.pos.x, &val.pos.y) != 2)
138 for (i = 0; i < frei0r->
plugin_info.num_params; i++) {
139 f0r_param_info_t info;
156 "idx:%d name:'%s' type:%s explanation:'%s' ",
158 info.type == F0R_PARAM_BOOL ?
"bool" :
159 info.type == F0R_PARAM_DOUBLE ?
"double" :
160 info.type == F0R_PARAM_COLOR ?
"color" :
161 info.type == F0R_PARAM_POSITION ?
"position" :
162 info.type == F0R_PARAM_STRING ?
"string" :
"unknown",
171 f0r_param_color_t col;
172 f0r_param_position_t pos;
179 case F0R_PARAM_DOUBLE:
184 case F0R_PARAM_COLOR:
189 case F0R_PARAM_POSITION:
209 char *path =
av_asprintf(
"%s%s%s", prefix, name, SLIBSUF);
213 *handle_ptr = dlopen(path, RTLD_NOW|RTLD_LOCAL);
219 const char *dl_name,
int type)
224 f0r_plugin_info_t *pi;
229 if ((path =
av_strdup(getenv(
"FREI0R_PATH")))) {
231 const char *separator =
";";
233 const char *separator =
":";
235 char *p, *ptr =
NULL;
236 for (p = path; p =
av_strtok(p, separator, &ptr); p =
NULL) {
256 if (!frei0r->
dl_handle && (path = getenv(
"HOME"))) {
257 char *prefix =
av_asprintf(
"%s/.frei0r-1/lib/", path);
280 if (!(f0r_init =
load_sym(ctx,
"f0r_init" )) ||
281 !(f0r_get_plugin_info =
load_sym(ctx,
"f0r_get_plugin_info")) ||
291 if (f0r_init() < 0) {
298 if (pi->plugin_type != type) {
300 "Invalid type '%s' for the plugin\n",
301 pi->plugin_type == F0R_PLUGIN_TYPE_FILTER ?
"filter" :
302 pi->plugin_type == F0R_PLUGIN_TYPE_SOURCE ?
"source" :
303 pi->plugin_type == F0R_PLUGIN_TYPE_MIXER2 ?
"mixer2" :
304 pi->plugin_type == F0R_PLUGIN_TYPE_MIXER3 ?
"mixer3" :
"unknown");
309 "name:%s author:'%s' explanation:'%s' color_model:%s "
310 "frei0r_version:%d version:%d.%d num_params:%d\n",
311 pi->name, pi->author, pi->explanation,
312 pi->color_model == F0R_COLOR_MODEL_BGRA8888 ?
"bgra8888" :
313 pi->color_model == F0R_COLOR_MODEL_RGBA8888 ?
"rgba8888" :
314 pi->color_model == F0R_COLOR_MODEL_PACKED32 ?
"packed32" :
"unknown",
315 pi->frei0r_version, pi->major_version, pi->minor_version, pi->num_params);
323 char dl_name[1024],
c;
327 sscanf(args,
"%1023[^:=]%c%255c", dl_name, &c, frei0r->
params);
329 return frei0r_init(ctx, dl_name, F0R_PLUGIN_TYPE_FILTER);
343 memset(frei0r, 0,
sizeof(*frei0r));
364 if (frei0r->
plugin_info.color_model == F0R_COLOR_MODEL_BGRA8888) {
366 }
else if (frei0r->
plugin_info.color_model == F0R_COLOR_MODEL_RGBA8888) {
396 (
const uint32_t *)in->
data[0],
397 (uint32_t *)out->
data[0]);
433 .
inputs = avfilter_vf_frei0r_inputs,
435 .
outputs = avfilter_vf_frei0r_outputs,
441 char dl_name[1024],
c;
443 char frame_rate[128] =
"";
449 sscanf(args,
"%127[^:]:%127[^:]:%1023[^:=]%c%255c",
450 frame_size, frame_rate, dl_name, &c, frei0r->
params);
464 return frei0r_init(ctx, dl_name, F0R_PLUGIN_TYPE_SOURCE);
474 outlink->
w = frei0r->
w;
475 outlink->
h = frei0r->
h;
496 picref->
pts = frei0r->
pts++;
500 NULL, (uint32_t *)picref->data[0]);
516 .
name =
"frei0r_src",
527 .
outputs = avfilter_vsrc_frei0r_src_outputs,