Changeset 2103

Show
Ignore:
Timestamp:
06/14/09 10:18:12 (15 months ago)
Author:
drobilla
Message:

Updated lv2 dynamic manifest discovery (still discovery only).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/slv2/src/world.c

    r2090 r2103  
    209209 
    210210#ifdef SLV2_DYN_MANIFEST 
     211        LV2_Dyn_Manifest_Handle               handle    = NULL; 
     212        const LV2_Dyn_Manifest_Feature* const features = { NULL }; 
     213 
    211214        const unsigned char* const query_str = (const unsigned char* const) 
    212215                "PREFIX : <http://lv2plug.in/ns/lv2core#>\n" 
    213                 "PREFIX dynman: <http://naspro.atheme.org/rdf/dman#>\n" 
     216                "PREFIX dynman: <http://lv2plug.in/ns/ext/dynmanifest#>\n" 
    214217                "SELECT DISTINCT ?dynman ?binary WHERE {\n" 
    215218                "?dynman a       dynman:DynManifest ;\n" 
     
    229232                        if (lib_path) { 
    230233                                void* lib = dlopen(lib_path, RTLD_NOW); 
    231                                 typedef int (*DynManifestGetFunc)(FILE*); 
    232                                 DynManifestGetFunc func = (DynManifestGetFunc)dlsym(lib, "lv2_dyn_manifest_write"); 
    233                                 if (func) { 
     234 
     235                                // Open dynamic manifest 
     236                                typedef int (*OpenFunc)(LV2_Dyn_Manifest_Handle*, 
     237                                                const LV2_Dyn_Manifest_Feature *const *); 
     238                                OpenFunc open_func = (OpenFunc)dlsym(lib, "lv2_dyn_manifest_open"); 
     239                                open_func(&handle, &features); 
     240 
     241                                // Get subjects (what would be in the manifest) 
     242                                typedef int (*GetSubjectsFunc)(LV2_Dyn_Manifest_Handle, FILE*); 
     243                                GetSubjectsFunc get_subjects_func = (GetSubjectsFunc)dlsym(lib, 
     244                                                "lv2_dyn_manifest_get_subjects"); 
     245                                if (get_subjects_func) { 
    234246                                        printf("DYNAMIC MANIFEST <%s> @ <%s> {\n", 
    235247                                                        librdf_uri_as_string(librdf_node_get_uri(dynman_node)), 
    236248                                                        librdf_uri_as_string(librdf_node_get_uri(binary_node))); 
    237                                         FILE* dyn_manifest = tmpfile(); 
    238                                         func(dyn_manifest); 
     249                                        //FILE* dyn_manifest = tmpfile(); 
     250                                        FILE* dyn_manifest = fopen("/tmp/naspro.ttl", "w+"); 
     251                                        get_subjects_func(handle, dyn_manifest); 
    239252                                        rewind(dyn_manifest); 
    240253                                        librdf_parser_parse_file_handle_into_model(world->parser, 
     
    250263        librdf_free_query_results(query_results); 
    251264        librdf_free_query(query); 
    252 #endif 
     265#endif // SLV2_DYN_MANIFEST 
    253266 
    254267        /* ?plugin a lv2:Plugin */