[xiph-commits] r8981 - icecast/branches/kh/ices/src

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Thu Feb 24 08:48:48 PST 2005


Author: karl
Date: 2005-02-24 08:48:43 -0800 (Thu, 24 Feb 2005)
New Revision: 8981

Modified:
   icecast/branches/kh/ices/src/cfgparse.c
   icecast/branches/kh/ices/src/encode.c
   icecast/branches/kh/ices/src/encode.h
   icecast/branches/kh/ices/src/ices.c
   icecast/branches/kh/ices/src/input.c
   icecast/branches/kh/ices/src/runner.c
   icecast/branches/kh/ices/src/runner.h
   icecast/branches/kh/ices/src/signals.c
   icecast/branches/kh/ices/src/stream.c
Log:
small cleanups


Modified: icecast/branches/kh/ices/src/cfgparse.c
===================================================================
--- icecast/branches/kh/ices/src/cfgparse.c	2005-02-24 16:46:19 UTC (rev 8980)
+++ icecast/branches/kh/ices/src/cfgparse.c	2005-02-24 16:48:43 UTC (rev 8981)
@@ -88,7 +88,6 @@
         else
             *(int*)x = strtol (str, NULL, 0)==0 ? 0 : 1;
     xmlFree (str);
-    xmlMemoryDump();
     return 0;
 }
 
@@ -100,7 +99,6 @@
         return -1;
     *(int*)x = strtol(tmp, NULL, 0);
     xmlFree(tmp);
-    xmlMemoryDump();
     return 0;
 }
 
@@ -114,12 +112,9 @@
     if (p)
     {
         dprintf ("freeing \"%s\" (%p) alloc \"%s\"\n", p, p, str);
-        xmlMemoryDump();
         xmlFree (p);
     }
     *(char **)x = str;
-    xmlMemoryDump();
-    // xmlMemoryStrdup (str);
     return 0;
 }
 
@@ -391,6 +386,9 @@
     if (ices_config->stream_description != DEFAULT_STREAM_DESCRIPTION) 
         xmlFree (ices_config->stream_description);
 
+    if (ices_config->stream_url) 
+        xmlFree (ices_config->stream_url);
+
     if (ices_config->user)
         xmlFree (ices_config->user);
 

Modified: icecast/branches/kh/ices/src/encode.c
===================================================================
--- icecast/branches/kh/ices/src/encode.c	2005-02-24 16:46:19 UTC (rev 8980)
+++ icecast/branches/kh/ices/src/encode.c	2005-02-24 16:48:43 UTC (rev 8981)
@@ -88,11 +88,6 @@
     long nom_br, max_br, min_br, rate, channels;
 
     /* do some sanity check */
-    if (settings->quality < -1)
-    {
-        LOG_WARN1 ("Quality setting of %f is too low, setting to -1.0", settings->quality);
-        settings->quality = -1.0;
-    }
     if (settings->quality > 10.0)
     {
         LOG_WARN1 ("Quality setting of %f is too high, setting to 10.0", settings->quality);
@@ -109,8 +104,8 @@
     if (settings->nom_br < 0 && min_br < 0 && max_br < 0)
         settings->managed = 0;
 
-    if (settings->managed == 0 && nom_br >= 0)
-        if (min_br >= 0 || max_br >= 0)
+    if (settings->managed == 0 && nom_br > 0)
+        if (min_br >= 0 || max_br > 0)
             settings->managed = 1;
 
     quality = settings->quality;
@@ -134,7 +129,7 @@
             if (nom_br < 0)
             {
                 LOG_INFO3 ("Encoder initialising in VBR mode: %d channel(s), "
-                        "%d Hz, quality %f", channels, rate, quality);
+                        "%d Hz, quality %.2f", channels, rate, quality);
                 if (min_br > 0 || max_br > 0)
                     LOG_WARN0 ("ignoring min/max bitrate, not supported in VBR "
                             "mode, use nominal-bitrate instead");
@@ -244,6 +239,8 @@
     struct encoder_settings *enc = x;
     struct cfg_tag encode_tags[] =
     {
+        { "passthru",        get_xml_bool,  &enc->passthru},
+        { "passthrough",     get_xml_bool,  &enc->passthru},
         { "nominal-bitrate", get_xml_int,   &enc->nom_br },
         { "quality",         get_xml_float, &enc->quality },
         { "minimum-bitrate", get_xml_int,   &enc->min_br },
@@ -255,6 +252,8 @@
     enc->min_br = -1;
     enc->max_br = -1;
     enc->nom_br = -1;
+    if (enc->passthru > 1) /* handle default setting */
+        enc->passthru = 0;
 
     return parse_xml_tags ("encode", node->xmlChildrenNode, encode_tags);
 }

Modified: icecast/branches/kh/ices/src/encode.h
===================================================================
--- icecast/branches/kh/ices/src/encode.h	2005-02-24 16:46:19 UTC (rev 8980)
+++ icecast/branches/kh/ices/src/encode.h	2005-02-24 16:48:43 UTC (rev 8981)
@@ -24,6 +24,7 @@
 
 struct encoder_settings
 {
+    int passthru;
     int managed;
     int min_br;
     int max_br;

Modified: icecast/branches/kh/ices/src/ices.c
===================================================================
--- icecast/branches/kh/ices/src/ices.c	2005-02-24 16:46:19 UTC (rev 8980)
+++ icecast/branches/kh/ices/src/ices.c	2005-02-24 16:48:43 UTC (rev 8981)
@@ -25,7 +25,6 @@
 #include <grp.h>
 #endif
 
-#include "net/resolver.h"
 #include "thread/thread.h"
 
 #include "cfgparse.h"

Modified: icecast/branches/kh/ices/src/input.c
===================================================================
--- icecast/branches/kh/ices/src/input.c	2005-02-24 16:46:19 UTC (rev 8980)
+++ icecast/branches/kh/ices/src/input.c	2005-02-24 16:48:43 UTC (rev 8981)
@@ -335,6 +335,7 @@
                 if (next_mod->open_module (next_mod) == 0)
                 {
                     next_mod->start = start;
+                    next_mod->failures = 0;
                     ices_config->next_track = 0;
                     return next_mod;
                 }

Modified: icecast/branches/kh/ices/src/runner.c
===================================================================
--- icecast/branches/kh/ices/src/runner.c	2005-02-24 16:46:19 UTC (rev 8980)
+++ icecast/branches/kh/ices/src/runner.c	2005-02-24 16:48:43 UTC (rev 8981)
@@ -29,7 +29,6 @@
 #include "cfgparse.h"
 #include "runner.h"
 #include "stream.h"
-#include "net/resolver.h"
 #include "signals.h"
 #include "thread/thread.h"
 #include "reencode.h"
@@ -185,9 +184,10 @@
         return NULL;
 
     instance->resampleoutrate = DEFAULT_RESAMPLE;
-    instance->passthru = 0;
 
+    instance->encode_settings.passthru = 2;
     instance->encode_settings.quality = DEFAULT_QUALITY;
+    instance->encode_settings.nom_br = -1;
     instance->downmix = DEFAULT_DOWNMIX;
 
     instance->id = id++;
@@ -212,8 +212,8 @@
             { "description",    get_xml_string,     &instance->output.description },
             { "url",            get_xml_string,     &instance->output.url },
             { "downmix",        get_xml_bool,       &instance->downmix },
-            { "passthru",       get_xml_bool,       &instance->passthru},
-            { "passthrough",    get_xml_bool,       &instance->passthru},
+            { "passthru",       get_xml_bool,       &instance->encode_settings.passthru},
+            { "passthrough",    get_xml_bool,       &instance->encode_settings.passthru},
             { "resample",       parse_resample,     &instance->resampleoutrate },
             { "encode",         parse_encode,       &instance->encode_settings },
             { "savestream",     parse_savefile,     &instance->output },
@@ -223,7 +223,6 @@
         };
 
         /* config should be derived from runner */
-        xmlMemoryDump();
         if (ices_config->stream_name)
             instance->output.name = xmlStrdup (ices_config->stream_name);
         if (ices_config->stream_genre)
@@ -320,6 +319,7 @@
     {
         next = instance->next;
         /* reencode_free (instance->reenc); */
+        free (instance->ops);
         free (instance);
     }
     return next;

Modified: icecast/branches/kh/ices/src/runner.h
===================================================================
--- icecast/branches/kh/ices/src/runner.h	2005-02-24 16:46:19 UTC (rev 8980)
+++ icecast/branches/kh/ices/src/runner.h	2005-02-24 16:48:43 UTC (rev 8981)
@@ -34,7 +34,6 @@
     struct codec_ops *ops;
 
     int downmix;
-    int passthru;
 
     struct output_state output;
 

Modified: icecast/branches/kh/ices/src/signals.c
===================================================================
--- icecast/branches/kh/ices/src/signals.c	2005-02-24 16:46:19 UTC (rev 8980)
+++ icecast/branches/kh/ices/src/signals.c	2005-02-24 16:48:43 UTC (rev 8981)
@@ -50,10 +50,9 @@
 
 void signal_hup_handler(int signum __attribute__((unused)))
 {
-    LOG_INFO0("Flushing logs");
-    log_flush(ices_config->log_id);
+    log_reopen(ices_config->log_id);
 
-    ices_config->next_track = 1;
+    LOG_INFO0 ("logs reopened");
     signal(SIGHUP, signal_hup_handler);
 }
 
@@ -67,6 +66,7 @@
 
 void signals_setup(void)
 {
+	signal(SIGHUP, signal_hup_handler);
 	signal(SIGINT, signal_int_handler);
 	signal(SIGTERM, signal_int_handler);
 	signal(SIGUSR1, signal_usr1_handler);

Modified: icecast/branches/kh/ices/src/stream.c
===================================================================
--- icecast/branches/kh/ices/src/stream.c	2005-02-24 16:46:19 UTC (rev 8980)
+++ icecast/branches/kh/ices/src/stream.c	2005-02-24 16:48:43 UTC (rev 8981)
@@ -231,7 +231,8 @@
     downmix_clear (s->downmix);
     resample_clear (s->resamp);
     free (s);
-    stream->ops->data = NULL;
+    free (stream->ops);
+    stream->ops = NULL;
 }
 
 
@@ -391,7 +392,7 @@
 
 static int process_ogg_init (struct instance *stream, input_buffer *buffer)
 {
-    if (stream->passthru)
+    if (stream->encode_settings.passthru)
         stream->ops = &passthru_ptks_ops;
     else
     {



More information about the commits mailing list