]> git.sesse.net Git - mlt/blob - src/modules/sox/factory.c
Set glsl_supported property to result of init_movit().
[mlt] / src / modules / sox / factory.c
1 /*
2  * factory.c -- the factory method interfaces
3  * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
4  * Author: Charles Yates <charles.yates@pandora.be>
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include <framework/mlt.h>
22
23 #include <string.h>
24 #include <limits.h>
25 #ifdef SOX14
26 #include <sox.h>
27 #endif
28
29 extern mlt_filter filter_sox_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
30
31 static mlt_properties metadata( mlt_service_type type, const char *id, void *data )
32 {
33         char file[ PATH_MAX ];
34         mlt_properties result = NULL;
35
36         // Load the yaml file
37         snprintf( file, PATH_MAX, "%s/sox/filter_%s.yml", mlt_environment( "MLT_DATA" ), strcmp( id, "sox" ) ? "sox_effect" : "sox" );
38         result = mlt_properties_parse_yaml( file );
39
40 #ifdef SOX14
41         if ( result && ( type == filter_type ) && strcmp( id, "sox" ) )
42         {
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;
46                 int i;
47
48                 for ( i = 0; sox_effect_fns[i]; i++ )
49                 {
50                         e = sox_effect_fns[i]();
51                         if ( e && e->name && !strcmp( e->name, id + 4 ) )
52                         {
53                                 mlt_properties p = mlt_properties_get_data( params, "0", NULL );
54
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" );
59                                 if ( e->usage )
60                                         mlt_properties_set( p, "format", e->usage );
61                                 break;
62                         }
63                 }
64         }
65 #endif
66         return result;
67 }
68
69 MLT_REPOSITORY
70 {
71         MLT_REGISTER( filter_type, "sox", filter_sox_init );
72         MLT_REGISTER_METADATA( filter_type, "sox", metadata, NULL );
73 #ifdef SOX14
74         int i;
75         const sox_effect_handler_t *e;
76         char name[64] = "sox.";
77         for ( i = 0; sox_effect_fns[i]; i++ )
78         {
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 )
83 #endif
84                         )
85                 {
86                         strcpy( name + 4, e->name );
87                         MLT_REGISTER( filter_type, name, filter_sox_init );
88                         MLT_REGISTER_METADATA( filter_type, name, metadata, NULL );
89                 }
90         }
91 #endif
92 }