Changeset 684
- Timestamp:
- 12/24/09 15:22:43 (2 years ago)
- Files:
-
- sweep/trunk/plugins/ladspa/ladspameta.c (modified) (9 diffs)
- sweep/trunk/src/main.c (modified) (1 diff)
- sweep/trunk/src/plugin.c (modified) (5 diffs)
- sweep/trunk/src/plugin.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sweep/trunk/plugins/ladspa/ladspameta.c
r683 r684 62 62 63 63 static GList * modules_list = NULL; 64 static GList * proc_list = NULL; 65 64 66 static gboolean ladspa_meta_initialised = FALSE; 65 67 … … 654 656 */ 655 657 static void 656 ladspa_meta_add_procs (gchar * dir, gchar * name , GList ** gl)658 ladspa_meta_add_procs (gchar * dir, gchar * name) 657 659 { 658 660 #define PATH_LEN 256 … … 722 724 proc->custom_data = lm_custom_new (d, proc->param_specs); 723 725 724 *gl = g_list_append (*gl, proc);726 proc_list = g_list_append (proc_list, proc); 725 727 } 726 728 } … … 734 736 */ 735 737 static void 736 ladspa_meta_init_dir (gchar * dirname , GList ** gl)738 ladspa_meta_init_dir (gchar * dirname) 737 739 { 738 740 DIR * dir; … … 750 752 name = dirent->d_name; 751 753 if (strcmp (name, ".") && strcmp (name, "..")) 752 ladspa_meta_add_procs (dirname, dirent->d_name , gl);754 ladspa_meta_add_procs (dirname, dirent->d_name); 753 755 } 754 756 … … 759 761 ladspa_meta_init (void) 760 762 { 761 GList * gl = NULL;762 763 char * ladspa_path=NULL; 763 764 char * next_sep=NULL; … … 778 779 if (next_sep != NULL) *next_sep = '\0'; 779 780 780 ladspa_meta_init_dir (ladspa_path , &gl);781 ladspa_meta_init_dir (ladspa_path); 781 782 782 783 if (next_sep != NULL) ladspa_path = ++next_sep; … … 789 790 if (saved_lp != NULL) free(saved_lp); 790 791 791 return gl;792 return proc_list; 792 793 } 793 794 … … 799 800 if (!ladspa_meta_initialised) return; 800 801 802 for (gl = proc_list; gl; gl = gl->next) { 803 sw_procedure * p = (sw_procedure *) gl->data; 804 if (p && p->custom_data) { 805 int j; 806 807 g_free (p->custom_data); 808 p->custom_data = NULL; 809 810 for (j=0; j < p->nr_params; j++) { 811 if (p->param_specs[j].constraint_type == SW_PARAM_CONSTRAINED_RANGE) 812 g_free (p->param_specs[j].constraint.range); 813 } 814 815 g_free (p->param_specs); 816 p->param_specs = NULL; 817 } 818 819 g_free (p); 820 gl->data = NULL; 821 } 822 823 g_list_free (proc_list); 824 proc_list = NULL; 825 801 826 for (gl = modules_list; gl; gl = gl->next) { 802 827 dlclose(gl->data); 803 } 828 gl->data = NULL; 829 } 830 g_list_free (modules_list); 831 modules_list = NULL; 832 804 833 } 805 834 sweep/trunk/src/main.c
r670 r684 259 259 save_accels (); 260 260 261 /* initialise plugins */ 262 release_plugins (); 263 261 264 exit (0); 262 265 } sweep/trunk/src/plugin.c
r683 r684 42 42 GList * plugins = NULL; 43 43 44 static GList * module_list = NULL; 45 44 46 static gint 45 47 cmp_proc_names (sw_procedure * a, sw_procedure * b) … … 48 50 } 49 51 50 void52 static void 51 53 sweep_plugin_init (const gchar * path) 52 54 { … … 68 70 if (g_module_symbol (module, "plugin", &m_plugin_ptr)) { 69 71 m_plugin = (sw_plugin *)m_plugin_ptr; 72 module_list = g_list_append (module_list, m_plugin); 70 73 for (gl = m_plugin->plugin_init (); gl; gl = gl->next) { 71 74 plugins = g_list_insert_sorted (plugins, (sw_procedure *)gl->data, … … 73 76 } 74 77 } 75 }76 77 /* Initialise statically linked plugins */78 static void79 init_static_plugins (void)80 {81 #if 082 plugins = g_list_append (plugins, &proc_normalise);83 plugins = g_list_append (plugins, &proc_reverse);84 #endif85 78 } 86 79 … … 119 112 } 120 113 114 static void 115 release_one (gpointer data, gpointer user_data) 116 { 117 sw_plugin *p = (sw_plugin *) data; 118 if (p && p->plugin_cleanup) 119 p->plugin_cleanup (); 120 } 121 122 121 123 void 122 124 init_plugins (void) 123 125 { 124 init_static_plugins ();125 126 126 if (g_module_supported ()) { 127 127 init_dynamic_plugins (); 128 128 } 129 } 129 130 130 131 void 132 release_plugins (void) 133 { 134 g_list_foreach (module_list, release_one, NULL); 135 g_list_free (plugins); 136 plugins = NULL; 131 137 } sweep/trunk/src/plugin.h
r7 r684 26 26 init_plugins (void); 27 27 28 void 29 release_plugins (void); 30 28 31 #endif /* __PLUGIN_H__ */
