]> git.sesse.net Git - mlt/blob - src/modules/core/factory.c
framework: remove global profile, rather share one mlt_profile across a service netwo...
[mlt] / src / modules / core / 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 #include <string.h>
23
24 extern mlt_consumer consumer_null_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
25 extern mlt_filter filter_brightness_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
26 extern mlt_filter filter_channelcopy_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
27 extern mlt_filter filter_data_feed_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
28 extern mlt_filter filter_data_show_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
29 extern mlt_filter filter_gamma_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
30 extern mlt_filter filter_greyscale_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
31 extern mlt_filter filter_luma_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
32 extern mlt_filter filter_mirror_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
33 extern mlt_filter filter_mono_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
34 extern mlt_filter filter_obscure_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
35 extern mlt_filter filter_region_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
36 extern mlt_filter filter_rescale_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
37 extern mlt_filter filter_resize_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
38 extern mlt_filter filter_transition_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
39 extern mlt_filter filter_watermark_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
40 extern mlt_producer producer_colour_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
41 extern mlt_producer producer_noise_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
42 extern mlt_producer producer_ppm_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
43 #include "transition_composite.h"
44 extern mlt_transition transition_luma_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
45 extern mlt_transition transition_mix_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );
46 #include "transition_region.h"
47
48 void *mlt_create_producer( mlt_profile profile, mlt_service_type type, const char *id, void *arg )
49 {
50         if ( !strcmp( id, "color" ) )
51                 return producer_colour_init( profile, type, id, arg );
52         if ( !strcmp( id, "colour" ) )
53                 return producer_colour_init( profile, type, id, arg );
54         if ( !strcmp( id, "noise" ) )
55                 return producer_noise_init( profile, type, id, arg );
56         if ( !strcmp( id, "ppm" ) )
57                 return producer_ppm_init( profile, type, id, arg );
58         return NULL;
59 }
60
61 void *mlt_create_filter( mlt_profile profile, mlt_service_type type, const char *id, void *arg )
62 {
63         if ( !strcmp( id, "brightness" ) )
64                 return filter_brightness_init( profile, type, id, arg );
65         if ( !strcmp( id, "channelcopy" ) )
66                 return filter_channelcopy_init( profile, type, id, arg );
67         if ( !strcmp( id, "data_feed" ) )
68                 return filter_data_feed_init( profile, type, id, arg );
69         if ( !strcmp( id, "data_show" ) )
70                 return filter_data_show_init( profile, type, id, arg );
71         if ( !strcmp( id, "gamma" ) )
72                 return filter_gamma_init( profile, type, id, arg );
73         if ( !strcmp( id, "greyscale" ) )
74                 return filter_greyscale_init( profile, type, id, arg );
75         if ( !strcmp( id, "luma" ) )
76                 return filter_luma_init( profile, type, id, arg );
77         if ( !strcmp( id, "mirror" ) )
78                 return filter_mirror_init( profile, type, id, arg );
79         if ( !strcmp( id, "mono" ) )
80                 return filter_mono_init( profile, type, id, arg );
81         if ( !strcmp( id, "obscure" ) )
82                 return filter_obscure_init( profile, type, id, arg );
83         if ( !strcmp( id, "region" ) )
84                 return filter_region_init( profile, type, id, arg );
85         if ( !strcmp( id, "rescale" ) )
86                 return filter_rescale_init( profile, type, id, arg );
87         if ( !strcmp( id, "resize" ) )
88                 return filter_resize_init( profile, type, id, arg );
89         if ( !strcmp( id, "transition" ) )
90                 return filter_transition_init( profile, type, id, arg );
91         if ( !strcmp( id, "watermark" ) )
92                 return filter_watermark_init( profile, type, id, arg );
93         return NULL;
94 }
95
96 void *mlt_create_transition( mlt_profile profile, mlt_service_type type, const char *id, void *arg )
97 {
98         if ( !strcmp( id, "composite" ) )
99                 return transition_composite_init( profile, type, id, arg );
100         if ( !strcmp( id, "luma" ) )
101                 return transition_luma_init( profile, type, id, arg );
102         if ( !strcmp( id, "mix" ) )
103                 return transition_mix_init( profile, type, id, arg );
104         if ( !strcmp( id, "region" ) )
105                 return transition_region_init( profile, type, id, arg );
106         return NULL;
107 }
108
109 void *mlt_create_consumer( mlt_profile profile, mlt_service_type type, const char *id, void *arg )
110 {
111         if ( !strcmp( id, "null" ) )
112                 return consumer_null_init( profile, type, id, arg );
113         return NULL;
114 }