]> git.sesse.net Git - mlt/blobdiff - src/modules/jackrack/plugin.c
Remove a debug line.
[mlt] / src / modules / jackrack / plugin.c
index 753910b8fd7968c832921bb05be8f48a3d309e48..04f8bd56d47845b3ddb06dc7b0ba0cb30b5974cf 100644 (file)
@@ -1,21 +1,26 @@
 /*
- *   jack-ladspa-host
- *    
- *   Copyright (C) Robert Ham 2002, 2003 (node@users.sourceforge.net)
- *    
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
+ * JACK Rack
  *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ * Original:
+ * Copyright (C) Robert Ham 2002, 2003 (node@users.sourceforge.net)
  *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Modification for MLT:
+ * Copyright (C) 2004 Ushodaya Enterprises Limited
+ * Author: Dan Dennedy <dan@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include <stdio.h>
@@ -29,7 +34,7 @@
 #include "plugin.h"
 #include "jack_rack.h"
 #include "process.h"
-#include "ui.h"
+#include "framework/mlt_log.h"
 
 #define CONTROL_FIFO_SIZE   128
 
@@ -138,7 +143,7 @@ process_remove_plugin (process_info_t * procinfo, plugin_t *plugin)
     procinfo->chain_end = plugin->prev;
     
   /* sort out the aux ports */
-  if (plugin->desc->aux_channels > 0)
+  if (procinfo->jack_client && plugin->desc->aux_channels > 0)
     {
       plugin_t * other;
       
@@ -227,7 +232,7 @@ process_move_plugin (process_info_t * procinfo, plugin_t *plugin, gint up)
        procinfo->chain_end = plugin;
     }
   
-  if (plugin->desc->aux_channels > 0)
+  if (procinfo->jack_client && plugin->desc->aux_channels > 0)
     {
       plugin_t * other;
       other = up ? plugin->next : plugin->prev;
@@ -257,7 +262,7 @@ process_change_plugin (process_info_t * procinfo,
     procinfo->chain_end = new_plugin;
 
   /* sort out the aux ports */
-  if (plugin->desc->aux_channels > 0)
+  if (procinfo->jack_client && plugin->desc->aux_channels > 0)
     {
       plugin_t * other;
       
@@ -288,7 +293,7 @@ plugin_open_plugin (plugin_desc_t * desc,
   dl_handle = dlopen (desc->object_file, RTLD_NOW|RTLD_GLOBAL);
   if (!dl_handle)
     {
-      fprintf (stderr, "%s: error opening shared object file '%s': %s\n",
+      mlt_log_warning( NULL, "%s: error opening shared object file '%s': %s\n",
                __FUNCTION__, desc->object_file, dlerror());
       return 1;
     }
@@ -303,7 +308,7 @@ plugin_open_plugin (plugin_desc_t * desc,
   dlerr = dlerror();
   if (dlerr)
     {
-      fprintf (stderr, "%s: error finding descriptor symbol in object file '%s': %s\n",
+      mlt_log_warning( NULL, "%s: error finding descriptor symbol in object file '%s': %s\n",
                __FUNCTION__, desc->object_file, dlerr);
       dlclose (dl_handle);
       return 1;
@@ -392,7 +397,7 @@ plugin_create_aux_ports (plugin_t * plugin, guint copy, jack_rack_t * jack_rack)
                aux_channel);
       
       holder->aux_ports[i] =
-        jack_port_register (jack_rack->ui->procinfo->jack_client,
+        jack_port_register (jack_rack->procinfo->jack_client,
                             port_name,
                             JACK_DEFAULT_AUDIO_TYPE,
                             desc->aux_are_input ? JackPortIsInput : JackPortIsOutput,
@@ -400,8 +405,7 @@ plugin_create_aux_ports (plugin_t * plugin, guint copy, jack_rack_t * jack_rack)
       
       if (!holder->aux_ports[i])
         {
-          fprintf (stderr, "Could not register jack port '%s'; aborting\n", port_name);
-          abort ();
+          mlt_log_panic( NULL, "Could not register jack port '%s'; aborting\n", port_name);
         }
     }
   
@@ -455,7 +459,7 @@ plugin_init_holder (plugin_t * plugin,
         plugin->descriptor-> connect_port (instance, i, &unused_control_port_output);
     }
   
-  if (plugin->desc->aux_channels > 0)
+  if (jack_rack->procinfo->jack_client && plugin->desc->aux_channels > 0)
     plugin_create_aux_ports (plugin, copy, jack_rack);
   
   if (plugin->descriptor->activate)
@@ -502,6 +506,7 @@ plugin_new (plugin_desc_t * desc, jack_rack_t * jack_rack)
   plugin->next = NULL;
   plugin->prev = NULL;
   plugin->wet_dry_enabled = FALSE;
+  plugin->jack_rack = jack_rack;
   
   /* create audio memory and wet/dry stuff */
   plugin->audio_output_memory   = g_malloc (sizeof (LADSPA_Data *) * jack_rack->channels);
@@ -525,7 +530,7 @@ plugin_new (plugin_desc_t * desc, jack_rack_t * jack_rack)
 
 
 void
-plugin_destroy (plugin_t * plugin, ui_t *ui)
+plugin_destroy (plugin_t * plugin)
 {
   unsigned long i, j;
   int err;
@@ -550,15 +555,15 @@ plugin_destroy (plugin_t * plugin, ui_t *ui)
         }
       
       /* aux ports */
-      if (plugin->desc->aux_channels > 0)
+      if (plugin->jack_rack->procinfo->jack_client && plugin->desc->aux_channels > 0)
         {
           for (j = 0; j < plugin->desc->aux_channels; j++)
             {
-              err = jack_port_unregister (ui->procinfo->jack_client,
+              err = jack_port_unregister (plugin->jack_rack->procinfo->jack_client,
                                           plugin->holders[i].aux_ports[j]);
           
               if (err)
-                fprintf (stderr, "%s: could not unregister jack port\n", __FUNCTION__);
+                mlt_log_warning( NULL, "%s: could not unregister jack port\n", __FUNCTION__);
             }
        
           g_free (plugin->holders[i].aux_ports);
@@ -567,7 +572,7 @@ plugin_destroy (plugin_t * plugin, ui_t *ui)
     
   g_free (plugin->holders);
   
-  for (i = 0; i < ui->jack_rack->channels; i++)
+  for (i = 0; i < plugin->jack_rack->channels; i++)
     {
       g_free (plugin->audio_output_memory[i]);
       lff_free (plugin->wet_dry_fifos + i);
@@ -580,7 +585,7 @@ plugin_destroy (plugin_t * plugin, ui_t *ui)
   err = dlclose (plugin->dl_handle);
   if (err)
     {
-      fprintf (stderr, "%s: error closing shared object '%s': %s\n",
+      mlt_log_warning( NULL, "%s: error closing shared object '%s': %s\n",
                __FUNCTION__, plugin->desc->object_file, dlerror ());
     }