49 typedef void (*
f0r_update_f)(f0r_instance_t instance,
double time,
const uint32_t *inframe, uint32_t *outframe);
50 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;
163 "idx:%d name:'%s' type:%s explanation:'%s' ",
165 info.type == F0R_PARAM_BOOL ?
"bool" :
166 info.type == F0R_PARAM_DOUBLE ?
"double" :
167 info.type == F0R_PARAM_COLOR ?
"color" :
168 info.type == F0R_PARAM_POSITION ?
"position" :
169 info.type == F0R_PARAM_STRING ?
"string" :
"unknown",
178 f0r_param_color_t col;
179 f0r_param_position_t pos;
186 case F0R_PARAM_DOUBLE:
188 s->get_param_value(s->instance, v, i);
191 case F0R_PARAM_COLOR:
193 s->get_param_value(s->instance, v, i);
196 case F0R_PARAM_POSITION:
198 s->get_param_value(s->instance, v, i);
203 s->get_param_value(s->instance, v, i);
216 char *path =
av_asprintf(
"%s%s%s", prefix, name, SLIBSUF);
220 *handle_ptr = dlopen(path, RTLD_NOW|RTLD_LOCAL);
226 const char *dl_name,
int type)
231 f0r_plugin_info_t *pi;
241 if ((path =
av_strdup(getenv(
"FREI0R_PATH")))) {
243 const char *separator =
";";
245 const char *separator =
":";
247 char *p, *ptr = NULL;
248 for (p = path; p =
av_strtok(p, separator, &ptr); p = NULL) {
268 if (!s->
dl_handle && (path = getenv(
"HOME"))) {
269 char *prefix =
av_asprintf(
"%s/.frei0r-1/lib/", path);
292 if (!(f0r_init =
load_sym(ctx,
"f0r_init" )) ||
293 !(f0r_get_plugin_info =
load_sym(ctx,
"f0r_get_plugin_info")) ||
303 if (f0r_init() < 0) {
310 if (pi->plugin_type != type) {
312 "Invalid type '%s' for the plugin\n",
313 pi->plugin_type == F0R_PLUGIN_TYPE_FILTER ?
"filter" :
314 pi->plugin_type == F0R_PLUGIN_TYPE_SOURCE ?
"source" :
315 pi->plugin_type == F0R_PLUGIN_TYPE_MIXER2 ?
"mixer2" :
316 pi->plugin_type == F0R_PLUGIN_TYPE_MIXER3 ?
"mixer3" :
"unknown");
321 "name:%s author:'%s' explanation:'%s' color_model:%s "
322 "frei0r_version:%d version:%d.%d num_params:%d\n",
323 pi->name, pi->author, pi->explanation,
324 pi->color_model == F0R_COLOR_MODEL_BGRA8888 ?
"bgra8888" :
325 pi->color_model == F0R_COLOR_MODEL_RGBA8888 ?
"rgba8888" :
326 pi->color_model == F0R_COLOR_MODEL_PACKED32 ?
"packed32" :
"unknown",
327 pi->frei0r_version, pi->major_version, pi->minor_version, pi->num_params);
371 if (s->
plugin_info.color_model == F0R_COLOR_MODEL_BGRA8888) {
373 }
else if (s->
plugin_info.color_model == F0R_COLOR_MODEL_RGBA8888) {
403 (
const uint32_t *)in->
data[0],
404 (uint32_t *)out->
data[0]);
411 #define OFFSET(x) offsetof(Frei0rContext, x)
412 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
448 .priv_class = &frei0r_class,
450 .
inputs = avfilter_vf_frei0r_inputs,
452 .
outputs = avfilter_vf_frei0r_outputs,
535 .
name =
"frei0r_src",
539 .priv_class = &frei0r_src_class,
547 .
outputs = avfilter_vsrc_frei0r_src_outputs,