|
| 1 | +/* |
| 2 | + * factory.c -- module registration for libplacebo filters |
| 3 | + * Copyright (C) 2025 D-Ogi |
| 4 | + * |
| 5 | + * This library is free software; you can redistribute it and/or |
| 6 | + * modify it under the terms of the GNU Lesser General Public |
| 7 | + * License as published by the Free Software Foundation; either |
| 8 | + * version 2.1 of the License, or (at your option) any later version. |
| 9 | + * |
| 10 | + * This library is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | + * Lesser General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU Lesser General Public |
| 16 | + * License along with this library; if not, write to the Free Software |
| 17 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | + */ |
| 19 | + |
| 20 | +#include "mltplacebo_export.h" |
| 21 | +#include <framework/mlt.h> |
| 22 | +#include <limits.h> |
| 23 | +#include <string.h> |
| 24 | + |
| 25 | +extern mlt_filter filter_placebo_render_init(mlt_profile profile, |
| 26 | + mlt_service_type type, |
| 27 | + const char *id, |
| 28 | + char *arg); |
| 29 | +extern mlt_filter filter_placebo_shader_init(mlt_profile profile, |
| 30 | + mlt_service_type type, |
| 31 | + const char *id, |
| 32 | + char *arg); |
| 33 | + |
| 34 | +static mlt_properties metadata(mlt_service_type type, const char *id, void *data) |
| 35 | +{ |
| 36 | + char file[PATH_MAX]; |
| 37 | + snprintf(file, PATH_MAX, "%s/placebo/%s", mlt_environment("MLT_DATA"), (char *) data); |
| 38 | + return mlt_properties_parse_yaml(file); |
| 39 | +} |
| 40 | + |
| 41 | +MLTPLACEBO_EXPORT MLT_REPOSITORY |
| 42 | +{ |
| 43 | + MLT_REGISTER(mlt_service_filter_type, "placebo.render", filter_placebo_render_init); |
| 44 | + MLT_REGISTER(mlt_service_filter_type, "placebo.shader", filter_placebo_shader_init); |
| 45 | + MLT_REGISTER_METADATA(mlt_service_filter_type, |
| 46 | + "placebo.render", |
| 47 | + metadata, |
| 48 | + "filter_placebo_render.yml"); |
| 49 | + MLT_REGISTER_METADATA(mlt_service_filter_type, |
| 50 | + "placebo.shader", |
| 51 | + metadata, |
| 52 | + "filter_placebo_shader.yml"); |
| 53 | +} |
0 commit comments