Mercurial > audlegacy
comparison src/audacious/pluginenum.c @ 3934:e924c9ee3958
when "Detect file formats on demand" is specified, filter unplayable files on loading by the hash table of all available extensions.
| author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
|---|---|
| date | Thu, 15 Nov 2007 16:34:09 +0900 |
| parents | bf6b1c5091d5 |
| children | a575c29cee05 |
comparison
equal
deleted
inserted
replaced
| 3933:5a4ef76b1f42 | 3934:e924c9ee3958 |
|---|---|
| 66 const gchar *plugin_dir_list[] = { | 66 const gchar *plugin_dir_list[] = { |
| 67 PLUGINSUBS, | 67 PLUGINSUBS, |
| 68 NULL | 68 NULL |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 GHashTable *ext_hash = NULL; | |
| 72 | |
| 71 /*****************************************************************/ | 73 /*****************************************************************/ |
| 72 | 74 |
| 73 static struct _AudaciousFuncTableV1 _aud_papi_v1 = { | 75 static struct _AudaciousFuncTableV1 _aud_papi_v1 = { |
| 74 .vfs_fopen = vfs_fopen, | 76 .vfs_fopen = vfs_fopen, |
| 75 .vfs_fclose = vfs_fclose, | 77 .vfs_fclose = vfs_fclose, |
| 515 p->enabled = TRUE; | 517 p->enabled = TRUE; |
| 516 | 518 |
| 517 /* XXX: we need something better than p->filename if plugins | 519 /* XXX: we need something better than p->filename if plugins |
| 518 will eventually provide multiple plugins --nenolod */ | 520 will eventually provide multiple plugins --nenolod */ |
| 519 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); | 521 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 522 | |
| 523 /* build the extension hash table */ | |
| 524 gint i; | |
| 525 if(p->vfs_extensions) { | |
| 526 for(i = 0; p->vfs_extensions[i] != NULL; i++) { | |
| 527 g_hash_table_replace(ext_hash, g_strdup(p->vfs_extensions[i]), g_strdup(p->description)); | |
| 528 } | |
| 529 } | |
| 520 } | 530 } |
| 521 | 531 |
| 522 static void | 532 static void |
| 523 output_plugin_init(Plugin * plugin) | 533 output_plugin_init(Plugin * plugin) |
| 524 { | 534 { |
| 749 report_error("Module loading not supported! Plugins will not be loaded.\n"); | 759 report_error("Module loading not supported! Plugins will not be loaded.\n"); |
| 750 return; | 760 return; |
| 751 } | 761 } |
| 752 | 762 |
| 753 plugin_dict = mowgli_dictionary_create(g_ascii_strcasecmp); | 763 plugin_dict = mowgli_dictionary_create(g_ascii_strcasecmp); |
| 764 | |
| 765 /* make extension hash */ | |
| 766 ext_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
| 754 | 767 |
| 755 #ifndef DISABLE_USER_PLUGIN_DIR | 768 #ifndef DISABLE_USER_PLUGIN_DIR |
| 756 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]); | 769 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]); |
| 757 /* | 770 /* |
| 758 * This is in a separate lo | 771 * This is in a separate lo |
| 1028 g_list_free(vfs_transports); | 1041 g_list_free(vfs_transports); |
| 1029 vfs_transports = NULL; | 1042 vfs_transports = NULL; |
| 1030 } | 1043 } |
| 1031 | 1044 |
| 1032 mowgli_dictionary_destroy(plugin_dict, NULL, NULL); | 1045 mowgli_dictionary_destroy(plugin_dict, NULL, NULL); |
| 1033 } | 1046 g_hash_table_remove_all(ext_hash); |
| 1047 } |
