2 * factory.c -- the factory method interfaces
3 * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
4 * Author: Charles Yates <charles.yates@pandora.be>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <framework/mlt.h>
29 extern mlt_filter filter_sox_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
31 static mlt_properties metadata( mlt_service_type type, const char *id, void *data )
33 char file[ PATH_MAX ];
34 mlt_properties result = NULL;
37 snprintf( file, PATH_MAX, "%s/sox/filter_%s.yml", mlt_environment( "MLT_DATA" ), "sox" );
38 result = mlt_properties_parse_yaml( file );
41 if ( result && ( type == filter_type ) )
43 // Annotate the yaml properties with sox effect usage.
44 mlt_properties params = mlt_properties_get_data( result, "parameters", NULL );
45 const sox_effect_handler_t *e;
48 for ( i = 0; sox_effect_fns[i]; i++ )
50 e = sox_effect_fns[i]();
51 if ( e && e->name && !strcmp( e->name, id + 4 ) )
53 mlt_properties p = mlt_properties_get_data( params, "0", NULL );
55 mlt_properties_set( result, "identifier", e->name );
56 mlt_properties_set( result, "title", e->name );
57 mlt_properties_set( p, "type", "string" );
58 mlt_properties_set( p, "title", "Options" );
60 mlt_properties_set( p, "format", e->usage );
71 MLT_REGISTER( filter_type, "sox", filter_sox_init );
72 MLT_REGISTER_METADATA( filter_type, "sox", metadata, NULL );
75 const sox_effect_handler_t *e;
76 char name[64] = "sox.";
77 for ( i = 0; sox_effect_fns[i]; i++ )
79 e = sox_effect_fns[i]();
80 if ( e && e->name && !( e->flags & SOX_EFF_DEPRECATED )
81 #if (SOX_LIB_VERSION_CODE >= SOX_LIB_VERSION(14,3,0))
82 && !( e->flags & SOX_EFF_INTERNAL )
86 strcpy( name + 4, e->name );
87 MLT_REGISTER( filter_type, name, filter_sox_init );
88 MLT_REGISTER_METADATA( filter_type, name, metadata, NULL );