1487ec95d9996c01d4b7e07c17875fe2b0b6ab12
[melted] / src / framework / mlt_repository.h
1 /*
2 * repository.h -- provides a map between service and shared objects
3 * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
4 * Author: Charles Yates <charles.yates@pandora.be>
5 * Contributor: Dan Dennedy <dan@dennedy.org>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 #ifndef _MLT_REPOSITORY_H_
23 #define _MLT_REPOSITORY_H_
24
25 #include "mlt_types.h"
26 #include "mlt_profile.h"
27
28 /** Repository structure forward reference.
29 */
30
31 typedef struct mlt_repository_s *mlt_repository;
32
33 /** This callback is the main entry point into a module, which must be exported
34 with the symbol "mlt_register".
35 Inside the callback, the module registers the additional callbacks below.
36 */
37
38 typedef void ( *mlt_repository_callback )( mlt_repository );
39
40 /** These are callback functions that modules implement to construct services
41 and metadata.
42 */
43 typedef void *( *mlt_register_callback )( mlt_profile, mlt_service_type, const char * /* service name */, void * /* arg */ );
44 typedef mlt_properties ( *mlt_metadata_callback )( mlt_service_type, const char * /* service name */, void * /* callback_data */ );
45
46 /** These convenience macros can be used to register services in a more declarative manner.
47 */
48 #define MLT_REPOSITORY void mlt_register( mlt_repository repository )
49 #define MLT_REGISTER( type, service, symbol ) ( mlt_repository_register( repository, (type), (service), ( mlt_register_callback )(symbol) ) )
50 #define MLT_REGISTER_METADATA( type, service, callback, data ) ( mlt_repository_register_metadata( repository, (type), (service), ( mlt_metadata_callback )(callback), (data) ) )
51
52 /** Public functions.
53 */
54
55 extern mlt_repository mlt_repository_init( const char *directory );
56 extern void mlt_repository_register( mlt_repository self, mlt_service_type service_type, const char *service, mlt_register_callback );
57 extern void *mlt_repository_create( mlt_repository self, mlt_profile profile, mlt_service_type type, const char *service, void *arg );
58 extern void mlt_repository_close( mlt_repository self );
59 extern mlt_properties mlt_repository_consumers( mlt_repository self );
60 extern mlt_properties mlt_repository_filters( mlt_repository self );
61 extern mlt_properties mlt_repository_producers( mlt_repository self );
62 extern mlt_properties mlt_repository_transitions( mlt_repository self );
63 extern void mlt_repository_register_metadata( mlt_repository self, mlt_service_type type, const char *service, mlt_metadata_callback, void *callback_data );
64 extern mlt_properties mlt_repository_metadata( mlt_repository self, mlt_service_type type, const char *service );
65 extern mlt_properties mlt_repository_languages( mlt_repository self );
66
67 #endif
68