]> git.sesse.net Git - mlt/commitdiff
Convert jackrack printfs to mlt_log (3301094).
authorDan Dennedy <dan@dennedy.org>
Fri, 13 May 2011 02:54:10 +0000 (19:54 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 13 May 2011 02:54:10 +0000 (19:54 -0700)
src/modules/jackrack/jack_rack.c
src/modules/jackrack/plugin.c
src/modules/jackrack/plugin_mgr.c
src/modules/jackrack/process.c

index e16244ba619175d5044c02832e8742f9a8f6b0ef..d1070676840772b420abfbf2329fea7566012c5d 100644 (file)
@@ -35,6 +35,7 @@
 #include "jack_rack.h"
 #include "lock_free_fifo.h"
 #include "plugin_settings.h"
+#include "framework/mlt_log.h"
 
 #ifndef _
 #define _(x) x
@@ -79,7 +80,7 @@ jack_rack_instantiate_plugin (jack_rack_t * jack_rack, plugin_desc_t * desc)
   
   /* check whether or not the plugin is RT capable and confirm with the user if it isn't */
   if (!LADSPA_IS_HARD_RT_CAPABLE(desc->properties)) {
-    fprintf (stderr, "Plugin not RT capable. The plugin '%s' does not describe itself as being capable of real-time operation. You may experience drop outs or jack may even kick us out if you use it.\n",
+    mlt_log_info( NULL, "Plugin not RT capable. The plugin '%s' does not describe itself as being capable of real-time operation. You may experience drop outs or jack may even kick us out if you use it.\n",
                desc->name);
   }
 
@@ -87,7 +88,7 @@ jack_rack_instantiate_plugin (jack_rack_t * jack_rack, plugin_desc_t * desc)
   plugin = plugin_new (desc, jack_rack);
 
   if (!plugin) {
-   fprintf (stderr, "Error loading file plugin '%s' from file '%s'\n",
+   mlt_log_error( NULL, "Error loading file plugin '%s' from file '%s'\n",
                desc->name, desc->object_file);
   }
   
@@ -139,7 +140,7 @@ jack_rack_add_plugin (jack_rack_t * jack_rack, plugin_t * plugin)
       {
         value = settings_get_control_value (saved_plugin->settings, copy, control);
         plugin->holders[copy].control_memory[control] = value;
-//printf("setting control value %s (%d) = %f\n", saved_plugin->settings->desc->port_names[control], copy, value);
+//mlt_log_debug( NULL, "setting control value %s (%d) = %f\n", saved_plugin->settings->desc->port_names[control], copy, value);
 //        lff_write (plugin->holders[copy].ui_control_fifos + control, &value);
       }
   if (plugin->wet_dry_enabled)
@@ -147,7 +148,7 @@ jack_rack_add_plugin (jack_rack_t * jack_rack, plugin_t * plugin)
       {
         value = settings_get_wet_dry_value (saved_plugin->settings, channel);
         plugin->wet_dry_values[channel] = value;
-//printf("setting wet/dry value %d = %f\n", channel, value);
+//mlt_log_debug( NULL, "setting wet/dry value %d = %f\n", channel, value);
 //        lff_write (plugin->wet_dry_fifos + channel, &value);
       }
 }
@@ -180,7 +181,7 @@ saved_rack_parse_plugin (jack_rack_t * jack_rack, saved_rack_t * saved_rack, sav
           desc = plugin_mgr_get_any_desc (jack_rack->plugin_mgr, num);
           if (!desc)
             {
-              fprintf (stderr, _("The file '%s' contains an unknown plugin with ID '%ld'; skipping\n"), filename, num);
+              mlt_log_verbose( NULL, _("The file '%s' contains an unknown plugin with ID '%ld'; skipping\n"), filename, num);
               return;
             }
           
@@ -333,13 +334,13 @@ jack_rack_open_file (jack_rack_t * jack_rack, const char * filename)
   doc = xmlParseFile (filename);
   if (!doc)
     {
-      fprintf (stderr, _("Could not parse file '%s'\n"), filename);
+      mlt_log_error( NULL, _("Could not parse file '%s'\n"), filename);
       return 1;
     }
   
   if (xmlStrcmp ( ((xmlDtdPtr)doc->children)->name, _x("jackrack")) != 0)
     {
-      fprintf (stderr, _("The file '%s' is not a JACK Rack settings file\n"), filename);
+      mlt_log_error( NULL, _("The file '%s' is not a JACK Rack settings file\n"), filename);
       return 1;
     }
   
index 6a483a88ab0424613146633c58220d0006be1ae4..592107be9eaae40f87e9f027825078f24932bf24 100644 (file)
@@ -34,6 +34,7 @@
 #include "plugin.h"
 #include "jack_rack.h"
 #include "process.h"
+#include "framework/mlt_log.h"
 
 #define CONTROL_FIFO_SIZE   128
 
@@ -292,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;
     }
@@ -307,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;
@@ -404,7 +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);
+          mlt_log_panic( NULL, "Could not register jack port '%s'; aborting\n", port_name);
           abort ();
         }
     }
@@ -563,7 +564,7 @@ plugin_destroy (plugin_t * plugin)
                                           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);
@@ -585,7 +586,7 @@ plugin_destroy (plugin_t * plugin)
   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 ());
     }
    
index de93853445067743d26ccd43b2fc92176d6d93e0..303326aece02d7f0f1c8b0d0aba458cf2f623b5e 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "plugin_mgr.h"
 #include "plugin_desc.h"
+#include "framework/mlt_log.h"
 
 
 static gboolean
@@ -82,8 +83,8 @@ plugin_mgr_get_object_file_plugins (plugin_mgr_t * plugin_mgr, const char * file
   dl_handle = dlopen (filename, RTLD_NOW|RTLD_GLOBAL);
   if (!dl_handle)
     {
-//      fprintf (stderr, "%s: error opening shared object file '%s': %s\n",
-//               __FUNCTION__, filename, dlerror());
+      mlt_log_warning( NULL, "%s: error opening shared object file '%s': %s\n",
+               __FUNCTION__, filename, dlerror());
       return;
     }
   
@@ -96,7 +97,7 @@ plugin_mgr_get_object_file_plugins (plugin_mgr_t * plugin_mgr, const char * file
   
   dlerr = dlerror();
   if (dlerr) {
-    fprintf (stderr, "%s: error finding ladspa_descriptor symbol in object file '%s': %s\n",
+    mlt_log_warning( NULL, "%s: error finding ladspa_descriptor symbol in object file '%s': %s\n",
              __FUNCTION__, filename, dlerr);
     dlclose (dl_handle);
     return;
@@ -127,7 +128,7 @@ plugin_mgr_get_object_file_plugins (plugin_mgr_t * plugin_mgr, const char * file
       
       if (exists)
         {
-          printf ("Plugin %ld exists in both '%s' and '%s'; using version in '%s'\n",
+          mlt_log_info( NULL, "Plugin %ld exists in both '%s' and '%s'; using version in '%s'\n",
                   descriptor->UniqueID, other_desc->object_file, filename, other_desc->object_file);
           plugin_index++;
           continue;
@@ -140,13 +141,13 @@ plugin_mgr_get_object_file_plugins (plugin_mgr_t * plugin_mgr, const char * file
       plugin_mgr->plugin_count++;
       
       /* print in the splash screen */
-      /* printf ("Loaded plugin '%s'\n", desc->name); */
+      /* mlt_log_verbose( NULL, "Loaded plugin '%s'\n", desc->name); */
     }
   
   err = dlclose (dl_handle);
   if (err)
     {
-      fprintf (stderr, "%s: error closing object file '%s': %s\n",
+      mlt_log_warning( NULL, "%s: error closing object file '%s': %s\n",
                __FUNCTION__, filename, dlerror ());
     }
 }
@@ -163,7 +164,7 @@ plugin_mgr_get_dir_plugins (plugin_mgr_t * plugin_mgr, const char * dir)
   dir_stream = opendir (dir);
   if (!dir_stream)
     {
-/*      fprintf (stderr, "%s: error opening directory '%s': %s\n",
+/*      mlt_log_warning( NULL, "%s: error opening directory '%s': %s\n",
                __FUNCTION__, dir, strerror (errno)); */
       return;
     }
@@ -200,7 +201,7 @@ plugin_mgr_get_dir_plugins (plugin_mgr_t * plugin_mgr, const char * dir)
 
   err = closedir (dir_stream);
   if (err)
-    fprintf (stderr, "%s: error closing directory '%s': %s\n",
+    mlt_log_warning( NULL, "%s: error closing directory '%s': %s\n",
              __FUNCTION__, dir, strerror (errno));
 }
 
@@ -250,7 +251,7 @@ plugin_mgr_new ()
   
   if (!pm->all_plugins)
     {
-      fprintf (stderr, "No LADSPA plugins were found!\n\nCheck your LADSPA_PATH environment variable.\n");
+      mlt_log_warning( NULL, "No LADSPA plugins were found!\n\nCheck your LADSPA_PATH environment variable.\n");
       abort ();
     }
   
index 0e0f2dab3d36457142f2317db83770739e42f8f6..1b62755c13f7dae2b2e2121bb3434b53caeb99c1 100644 (file)
@@ -37,6 +37,7 @@
 #include "lock_free_fifo.h"
 #include "plugin.h"
 #include "jack_rack.h"
+#include "framework/mlt_log.h"
 
 #ifndef _
 #define _(x) x
@@ -94,14 +95,14 @@ int get_jack_buffers (process_info_t * procinfo, jack_nframes_t frames) {
       procinfo->jack_input_buffers[channel] = jack_port_get_buffer (procinfo->jack_input_ports[channel], frames);
       if (!procinfo->jack_input_buffers[channel])
         {
-          fprintf (stderr, "%s: no jack buffer for input port %ld\n", __FUNCTION__, channel);
+          mlt_log_verbose( NULL, "%s: no jack buffer for input port %ld\n", __FUNCTION__, channel);
           return 1;
         }
 
       procinfo->jack_output_buffers[channel] = jack_port_get_buffer (procinfo->jack_output_ports[channel], frames);
       if (!procinfo->jack_output_buffers[channel])
         {
-          fprintf (stderr, "%s: no jack buffer for output port %ld\n", __FUNCTION__, channel);
+          mlt_log_verbose( NULL, "%s: no jack buffer for output port %ld\n", __FUNCTION__, channel);
           return 1;
         }
     }
@@ -299,7 +300,7 @@ int process_ladspa (process_info_t * procinfo, jack_nframes_t frames,
   
   if (!procinfo)
     {
-      fprintf (stderr, "%s: no process_info from jack!\n", __FUNCTION__);
+      mlt_log_error( NULL, "%s: no process_info from jack!\n", __FUNCTION__);
       return 1;
     }
   
@@ -313,14 +314,14 @@ int process_ladspa (process_info_t * procinfo, jack_nframes_t frames,
       procinfo->jack_input_buffers[channel] = inputs[channel];
       if (!procinfo->jack_input_buffers[channel])
         {
-          fprintf (stderr, "%s: no jack buffer for input port %ld\n", __FUNCTION__, channel);
+          mlt_log_verbose( NULL, "%s: no jack buffer for input port %ld\n", __FUNCTION__, channel);
           return 1;
         }
 
       procinfo->jack_output_buffers[channel] = outputs[channel];
       if (!procinfo->jack_output_buffers[channel])
         {
-          fprintf (stderr, "%s: no jack buffer for output port %ld\n", __FUNCTION__, channel);
+          mlt_log_verbose( NULL, "%s: no jack buffer for output port %ld\n", __FUNCTION__, channel);
           return 1;
         }
     }
@@ -340,7 +341,7 @@ int process_jack (jack_nframes_t frames, void * data) {
   
   if (!procinfo)
     {
-      fprintf (stderr, "%s: no process_info from jack!\n", __FUNCTION__);
+      mlt_log_error( NULL, "%s: no process_info from jack!\n", __FUNCTION__);
       return 1;
     }
   
@@ -355,7 +356,7 @@ int process_jack (jack_nframes_t frames, void * data) {
   err = get_jack_buffers (procinfo, frames);
   if (err)
     {
-      fprintf(stderr, "%s: failed to get jack ports, not processing\n", __FUNCTION__);
+      mlt_log_warning( NULL, "%s: failed to get jack ports, not processing\n", __FUNCTION__);
       return 0;
     }
   
@@ -375,17 +376,17 @@ int process_jack (jack_nframes_t frames, void * data) {
 static int
 process_info_connect_jack (process_info_t * procinfo)
 {
-  printf (_("Connecting to JACK server with client name '%s'\n"), procinfo->jack_client_name);
+  mlt_log_info( NULL, _("Connecting to JACK server with client name '%s'\n"), procinfo->jack_client_name);
 
   procinfo->jack_client = jack_client_new (procinfo->jack_client_name);
 
   if (!procinfo->jack_client)
     {
-      fprintf (stderr, "%s: could not create jack client; is the jackd server running?\n", __FUNCTION__);
+      mlt_log_warning( NULL, "%s: could not create jack client; is the jackd server running?\n", __FUNCTION__);
       return 1;
     }
 
-  printf (_("Connected to JACK server\n"));
+  mlt_log_verbose( NULL, _("Connected to JACK server\n"));
 
   jack_set_process_callback (procinfo->jack_client, process_jack, procinfo);
   jack_on_shutdown (procinfo->jack_client, jack_shutdown_cb, procinfo);
@@ -419,17 +420,17 @@ process_info_connect_port (process_info_t * procinfo,
         
       full_port_name = g_strdup_printf ("%s:%s", procinfo->jack_client_name, port_name);
 
-      printf (_("Connecting ports '%s' and '%s'\n"), full_port_name, jack_ports[jack_port_index]);
+      mlt_log_debug( NULL, _("Connecting ports '%s' and '%s'\n"), full_port_name, jack_ports[jack_port_index]);
 
       err = jack_connect (procinfo->jack_client,
                           in ? jack_ports[jack_port_index] : full_port_name,
                           in ? full_port_name : jack_ports[jack_port_index]);
 
       if (err)
-        fprintf (stderr, "%s: error connecting ports '%s' and '%s'\n",
+        mlt_log_warning( NULL, "%s: error connecting ports '%s' and '%s'\n",
                  __FUNCTION__, full_port_name, jack_ports[jack_port_index]);
       else
-        printf (_("Connected ports '%s' and '%s'\n"), full_port_name, jack_ports[jack_port_index]);
+        mlt_log_info( NULL, _("Connected ports '%s' and '%s'\n"), full_port_name, jack_ports[jack_port_index]);
       
       free (full_port_name);
     }
@@ -472,7 +473,7 @@ process_info_set_port_count (process_info_t * procinfo,
       {
         port_name = g_strdup_printf ("%s_%ld", in ? "in" : "out", i + 1);
        
-        //printf (_("Creating %s port %s\n"), in ? "input" : "output", port_name);
+        //mlt_log_debug( NULL, _("Creating %s port %s\n"), in ? "input" : "output", port_name);
         
         port_ptr = (in ? &procinfo->jack_input_ports[i]
                        : &procinfo->jack_output_ports[i]);
@@ -485,12 +486,12 @@ process_info_set_port_count (process_info_t * procinfo,
         
         if (!*port_ptr)
           {
-            fprintf (stderr, "%s: could not register port '%s'; aborting\n",
+            mlt_log_error( NULL, "%s: could not register port '%s'; aborting\n",
                      __FUNCTION__, port_name);
             return 1;
           }
 
-        //printf (_("Created %s port %s\n"), in ? "input" : "output", port_name);
+        //mlt_log_debug( NULL, _("Created %s port %s\n"), in ? "input" : "output", port_name);
         
         if ((in && connect_inputs) || (!in && connect_outputs))
           process_info_connect_port (procinfo, in, i, port_name);