]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'master' into my-osx
authormaan <maan@Gumbo.local>
Thu, 13 Jul 2006 10:41:40 +0000 (12:41 +0200)
committermaan <maan@Gumbo.local>
Thu, 13 Jul 2006 10:41:40 +0000 (12:41 +0200)
30 files changed:
Makefile.in
NEWS
SFont.c
aac_afh.c
audiod.c
audiod.h
audiod_command.c
client.c
client_common.c
command.c
compress_filter.ggo
daemon.c
dbadm.c
dccp_send.c
fd.c
grab_client.c
gui.c
gui.ggo
http_recv.c
mysql_selector.c
ortp_recv.c
ortp_send.c
para.h
recv.c
sdl_gui.c
sdl_gui.ggo
send.h
stat.c
stdout.c
time.c

index a451e8926021283ef7b8092e1608562ff31fe338..2aece7ceb5013a5e7bdfc1af7df2540a1487ac85 100644 (file)
@@ -6,20 +6,16 @@ exec_prefix = @exec_prefix@
 
 BINDIR = @bindir@
 VARDIR = /var/paraslash
-PKGDATADIR = @datadir@/@PACKAGE_NAME@
+PKGDATADIR = @datarootdir@/@PACKAGE_NAME@
 FONTDIR = $(PKGDATADIR)/fonts
 PICDIR = $(PKGDATADIR)/pics
-MANDIR = @prefix@/share/man/man1
+MANDIR = @datarootdir@/man/man1
 
 install_sh = @install_sh@
-SSL_LIBS = @SSL_LIBS@
-SSL_LDFLAGS = @SSL_LDFLAGS@
 
-extra_binaries = @extra_binaries@
 build_date = $(shell date)
 system = $(shell uname -rs)
 cc_version = $(shell $(CC) --version | head -n 1)
-version = @PACKAGE_VERSION@
 codename = oriented abstraction
 
 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
@@ -45,7 +41,6 @@ CPPFLAGS += -DFONTDIR='"$(PKGDATADIR)/fonts"'
 CPPFLAGS += -DPICDIR='"$(PKGDATADIR)/pics"'
 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
 CPPFLAGS += -DSYSTEM='"$(system)"'
-CPPFLAGS += -DVERSION='"$(version)"'
 CPPFLAGS += -DCODENAME='"$(codename)"'
 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
 CPPFLAGS += -Werror-implicit-function-declaration
@@ -53,7 +48,7 @@ CPPFLAGS += -Wmissing-format-attribute
 CPPFLAGS += -Wunused-macros
 CPPFLAGS += -Wshadow
 
-BINARIES = para_server para_client para_gui para_audiod para_audioc para_recv para_filter para_write $(extra_binaries)
+BINARIES = para_server para_client para_gui para_audiod para_audioc para_recv para_filter para_write @extra_binaries@
 
 FONTS := $(wildcard fonts/*.png)
 PICS := $(wildcard pics/paraslash/*.jpg)
diff --git a/NEWS b/NEWS
index 9c8d2cce702e4ff5e91e3ea41d7306d7690360be..c4e087b5bb721bf2915853d81b88800eb2b08029 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,8 +8,8 @@ NEWS
 A bunch of new features and core changes.
 
        - the new paraslash scheduler, short and sweet.
-       - Support for m4a files via the new aac filter/ and audio
-         format handler (requires libfaad).
+       - Support for m4a/mp4 files via the new aac audio format
+         handler/filter (requires libfaad).
        - each writer has its own command line parser, just like
          para_recv and para_filter.
        - new writer: osxplay (thanks to Gerd Becker)
@@ -18,8 +18,9 @@ A bunch of new features and core changes.
        - para_client is integrated in para_audiod
        - random/playlist selector: improved info strings
        - new audiod commands: tasks, kill
-       - update to libortp-0.10.0
+       - update to libortp-0.10.1
        - para_fade: wake time defaults to 8 hours from now
+       - update to autoconf-2.60
 
 
 ------------------------------------------
diff --git a/SFont.c b/SFont.c
index 8a078c9f26e17d928844004e756abf998f8a6ad1..daed6b51ac834d1a7bf055c9d5361e6411b72102 100644 (file)
--- a/SFont.c
+++ b/SFont.c
@@ -24,7 +24,7 @@
 #include <string.h> /* strlen */
 SFont_FontInfo InternalFont;
 
-Uint32 GetPixel(SDL_Surface * Surface, Sint32 X, Sint32 Y)
+static Uint32 GetPixel(SDL_Surface *Surface, Sint32 X, Sint32 Y)
 {
 
        Uint8 *bits;
@@ -45,8 +45,7 @@ Uint32 GetPixel(SDL_Surface * Surface, Sint32 X, Sint32 Y)
                return *((Uint8 *) Surface->pixels + Y * Surface->pitch + X);
                break;
        case 2:
-               return *((Uint16 *) Surface->pixels + Y * Surface->pitch / 2 +
-                        X);
+               return *((Uint16 *) Surface->pixels + Y * Surface->pitch / 2 + X);
                break;
        case 3:{        /* Format/endian independent  */
                        Uint8 r, g, b;
@@ -57,8 +56,7 @@ Uint32 GetPixel(SDL_Surface * Surface, Sint32 X, Sint32 Y)
                }
                break;
        case 4:
-               return *((Uint32 *) Surface->pixels + Y * Surface->pitch / 4 +
-                        X);
+               return *((Uint32 *) Surface->pixels + Y * Surface->pitch / 4 + X);
                break;
        }
 
@@ -79,12 +77,11 @@ void InitFont2(SFont_FontInfo * Font)
 
        while (x < Font->Surface->w) {
                if (GetPixel(Font->Surface, x, 0) ==
-                   SDL_MapRGB(Font->Surface->format, 255, 0, 255)) {
+                       SDL_MapRGB(Font->Surface->format, 255, 0, 255)) {
                        Font->CharPos[i++] = x;
-                       while ((x < Font->Surface->w - 1)
-                              && (GetPixel(Font->Surface, x, 0) ==
-                                  SDL_MapRGB(Font->Surface->format, 255, 0,
-                                             255)))
+                       while ((x < Font->Surface->w - 1) &&
+                               (GetPixel(Font->Surface, x, 0) ==
+                               SDL_MapRGB(Font->Surface->format, 255, 0, 255)))
                                x++;
                        Font->CharPos[i++] = x;
                }
@@ -98,17 +95,6 @@ void InitFont2(SFont_FontInfo * Font)
                        GetPixel(Font->Surface, 0, Font->Surface->h - 1));
 }
 
-#if 0
-void InitFont(SDL_Surface * Font)
-{
-       InternalFont.Surface = Font;
-       InitFont2(&InternalFont);
-}
-
-#endif
-
-
-
 void PutString2(SDL_Surface * Surface, SFont_FontInfo * Font, int x, int y,
                const char *text)
 {
@@ -124,15 +110,14 @@ void PutString2(SDL_Surface * Surface, SFont_FontInfo * Font, int x, int y,
                        ofs = ((unsigned char) text[i] - 33) * 2 + 1;
                        srcrect.w = dstrect.w = (Font->CharPos[ofs + 2]
                                + Font->CharPos[ofs + 1]) / 2
-                               - (Font->CharPos[ofs] + Font->CharPos[ofs - 1])
-                                        / 2;
+                               - (Font->CharPos[ofs]
+                               + Font->CharPos[ofs - 1]) / 2;
                        srcrect.h = dstrect.h = Font->Surface->h - 1;
-                       srcrect.x =
-                           (Font->CharPos[ofs] + Font->CharPos[ofs - 1]) / 2;
+                       srcrect.x = (Font->CharPos[ofs]
+                               + Font->CharPos[ofs - 1]) / 2;
                        srcrect.y = 1;
-                       dstrect.x =
-                           x - (float) (Font->CharPos[ofs] -
-                                        Font->CharPos[ofs - 1]) / 2;
+                       dstrect.x = x - (float) (Font->CharPos[ofs]
+                               - Font->CharPos[ofs - 1]) / 2;
                        dstrect.y = y;
                        SDL_BlitSurface(Font->Surface, &srcrect, Surface,
                                        &dstrect);
@@ -160,7 +145,7 @@ int TextWidth2(SFont_FontInfo * Font, char *text)
        return x;
 }
 
-void SFont_InternalInput(SDL_Surface * Dest, SFont_FontInfo * Font, int x,
+static void SFont_InternalInput(SDL_Surface * Dest, SFont_FontInfo * Font, int x,
                int y, int PixelWidth, char *text)
 {
        SDL_Event event;
@@ -208,7 +193,7 @@ void SFont_InternalInput(SDL_Surface * Dest, SFont_FontInfo * Font, int x,
                        blinktimer = SDL_GetTicks() + 500;
                        if (blink) {
                                PutString2(Dest, Font,
-                                          x + TextWidth2(Font, text), y, "|");
+                                       x + TextWidth2(Font, text), y, "|");
                                SDL_UpdateRects(Dest, 1, &rect);
                        } else {
                                SDL_BlitSurface(Back, NULL, Dest, &rect);
@@ -226,7 +211,7 @@ void SFont_InternalInput(SDL_Surface * Dest, SFont_FontInfo * Font, int x,
 }
 
 void SFont_Input2(SDL_Surface * Dest, SFont_FontInfo * Font, int x, int y,
-                 int PixelWidth, char *text)
+               int PixelWidth, char *text)
 {
        SFont_InternalInput(Dest, Font, x, y, PixelWidth, text);
 }
index d60588b419ac7b504bd03f490dd64be513ad35ff..a3a24bc0b2f4225050ca90b72a059788f3824249 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
@@ -230,7 +230,7 @@ static char *aac_read_chunk(long unsigned current_chunk, ssize_t *len)
        return (char *)inbuf;
 }
 
-static const char* aac_suffixes[] = {"m4a", NULL};
+static const char* aac_suffixes[] = {"m4a", "mp4", NULL};
 /** the init function of the aac audio format handler */
 void aac_afh_init(struct audio_format_handler *p)
 {
index 3b6111964a8012de6bbdddd4b7ec340a1173ce48..c88facc798506c7ec567be774044780b872a500d 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -400,16 +400,18 @@ static void rn_event_handler(struct task *t)
        }
 }
 
-static void open_receiver(int format)
+static int open_receiver(int format)
 {
        struct audio_format_info *a = &afi[format];
        struct slot_info *s;
        int ret, slot_num;
        struct receiver_node *rn;
+       const struct timeval restart_delay = {1, 0};
 
-       slot_num = get_empty_slot();
-       if (slot_num < 0)
-               clean_exit(EXIT_FAILURE, PARA_STRERROR(-slot_num));
+       ret = get_empty_slot();
+       if (ret < 0)
+               goto err;
+       slot_num = ret;
        s = &slot[slot_num];
        s->format = format;
        s->receiver_node = para_calloc(sizeof(struct receiver_node));
@@ -418,11 +420,9 @@ static void open_receiver(int format)
        rn->conf = a->receiver_conf;
        ret = a->receiver->open(s->receiver_node);
        if (ret < 0) {
-               PARA_ERROR_LOG("failed to open receiver (%s)\n",
-                       PARA_STRERROR(-ret));
                free(s->receiver_node);
                s->receiver_node = NULL;
-               return;
+               goto err;
        }
        PARA_NOTICE_LOG("started %s: %s receiver in slot %d\n",
                audio_formats[s->format], a->receiver->name, slot_num);
@@ -432,6 +432,11 @@ static void open_receiver(int format)
        rn->task.event_handler = rn_event_handler;
        sprintf(rn->task.status, "%s receiver node", rn->receiver->name);
        register_task(&rn->task);
+       return 1;
+err:
+       PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret));
+       tv_add(now, &restart_delay, &afi[format].restart_barrier);
+       return ret;
 }
 
 static int receiver_running(int format)
@@ -463,8 +468,7 @@ static int open_current_receiver(struct sched *s)
                s->timeout = diff;
                return 0;
        }
-       open_receiver(i);
-       return 1;
+       return open_receiver(i) < 0? 0 : 1;
 }
 
 static void compute_time_diff(const struct timeval *status_time)
@@ -657,7 +661,6 @@ static void audiod_post_select(__a_unused struct sched *s,
 {
        int i;
 
-       /* save away the current time for other users */
        t->ret = 1;
        FOR_EACH_SLOT(i)
                try_to_close_slot(i);
@@ -952,8 +955,7 @@ static void command_post_select(struct sched *s, struct task *t)
        struct command_task *ct = t->private_data;
 
        t->ret = 1; /* always successful */
-       if (audiod_status != AUDIOD_OFF)
-               audiod_status_dump();
+       audiod_status_dump();
        if (!FD_ISSET(ct->fd, &s->rfds))
                return;
        ret = handle_connect(ct->fd);
index c8d5fc2ea704d19d77b3db50b399e7d28c0497f5..e4faea4e9dcfbfb9c8be9af441ed550a78cc8556 100644 (file)
--- a/audiod.h
+++ b/audiod.h
@@ -86,6 +86,7 @@ extern const char *status_item_list[NUM_STAT_ITEMS];
 void __noreturn clean_exit(int status, const char *msg);
 int handle_connect(int accept_fd);
 void audiod_status_dump(void);
+void dump_empty_status(void);
 
 /** iterate over all slots */
 #define FOR_EACH_SLOT(_slot) for (_slot = 0; _slot < MAX_STREAM_SLOTS; _slot++)
index fe26b663256aaa8083268bee75ac2f2c5fbb5c68..312cfee1027f21f48291d520c7ee746e7671292d 100644 (file)
@@ -608,33 +608,65 @@ out:
 
 void audiod_status_dump(void)
 {
-       static char *p_ts, *p_us, *p_as, *p_df;
        struct timeval *t = wstime();
-       char *us, *tmp = get_time_string(t);
-
-       if (tmp && (!p_ts || strcmp(tmp, p_ts)))
-               stat_client_write(tmp, SI_PLAY_TIME);
-       free(p_ts);
-       p_ts = tmp;
+       char *old, *new, *tmp;
+
+       old = stat_task->stat_item_values[SI_PLAY_TIME];
+       new = get_time_string(t);
+       if (new) {
+               if (!old || strcmp(old, new)) {
+                       free(old);
+                       stat_client_write(new, SI_PLAY_TIME);
+                       stat_task->stat_item_values[SI_PLAY_TIME] = new;
+               } else
+                       free(new);
+       }
 
-       us = uptime_str();
-       tmp = make_message("%s:%s\n", status_item_list[SI_AUDIOD_UPTIME], us);
-       free(us);
-       if (!p_us || strcmp(p_us, tmp))
+       new = uptime_str();
+       old = stat_task->stat_item_values[SI_AUDIOD_UPTIME];
+       if (!old || strcmp(old, new)) {
+               free(old);
+               tmp = make_message("%s:%s\n",
+                       status_item_list[SI_AUDIOD_UPTIME], new);
                stat_client_write(tmp, SI_AUDIOD_UPTIME);
-       free(p_us);
-       p_us = tmp;
-
-       tmp = audiod_status_string();
-       if (!p_as || strcmp(p_as, tmp))
-               stat_client_write(tmp, SI_AUDIOD_STATUS);
-       free(p_as);
-       p_as = tmp;
-
-       tmp = decoder_flags();
-       if (!p_df || strcmp(p_df, tmp))
-               stat_client_write(tmp, SI_DECODER_FLAGS);
-       free(p_df);
-       p_df = tmp;
+               free(tmp);
+               stat_task->stat_item_values[SI_AUDIOD_UPTIME] = new;
+       } else
+               free(new);
+
+       old = stat_task->stat_item_values[SI_AUDIOD_STATUS];
+       new = audiod_status_string();
+       if (!old || strcmp(old, new)) {
+               free(old);
+               stat_client_write(new, SI_AUDIOD_STATUS);
+               stat_task->stat_item_values[SI_AUDIOD_STATUS] = new;
+       } else
+               free(new);
+
+       old = stat_task->stat_item_values[SI_DECODER_FLAGS];
+       new = decoder_flags();
+       if (!old || strcmp(old, new)) {
+               stat_client_write(new, SI_DECODER_FLAGS);
+               stat_task->stat_item_values[SI_DECODER_FLAGS] = new;
+       } else
+               free(new);
 }
 
+/**
+ * send empty status list
+ *
+ * Send to  each connected client the full status item list
+ * with empty values.
+ */
+void dump_empty_status(void)
+{
+       int i;
+
+       FOR_EACH_STAT_ITEM(i) {
+               char *tmp = make_message("%s:\n", status_item_list[i]);
+               stat_client_write(tmp, i);
+               free(tmp);
+               free(stat_task->stat_item_values[i]);
+               stat_task->stat_item_values[i] = NULL;
+       }
+}
index 95dacd75f8a9d39c0e85f8118481b1600ecc88f8..88ea5af2ca737f2cead9c96fc8c0ec28b523c1da 100644 (file)
--- a/client.c
+++ b/client.c
@@ -42,7 +42,7 @@ void para_log(int ll, const char* fmt,...)
        va_list argp;
 
        /* ignore log message if loglevel is not high enough */
-       if (!pcd || ll < pcd->conf.loglevel_arg)
+       if (pcd && ll < pcd->conf.loglevel_arg)
                return;
        va_start(argp, fmt);
        vfprintf(stderr, fmt, argp);
index b77c192f3a1c31bc0792fd427b39e21518c2fbd1..c738079b6b1f92ab47435bfea9eb6185aa52eef2 100644 (file)
@@ -278,11 +278,8 @@ void client_post_select(struct sched *s, struct task *t)
        case CL_SENDING: /* FIXME: might block */
                PARA_INFO_LOG("loaded: %zd\n", *pcd->in_loaded);
                t->ret = send_bin_buffer(pcd->fd, pcd->inbuf, *pcd->in_loaded);
-               if (t->ret <= 0) {
-                       if (!t->ret)
-                               t->ret = 1;
+               if (t->ret < 0)
                        return;
-               }
                *pcd->in_loaded = 0; /* FIXME: short writes */
                return;
        case CL_RECEIVING:
index ea42ef4318119a13b0fd077fc7500913161bbe93..52d56c9eba015880000db26e4183814434ad6f39 100644 (file)
--- a/command.c
+++ b/command.c
@@ -603,7 +603,8 @@ static int com_version(int socket_fd, int argc, __a_unused char **argv)
 {
        if (argc != 1)
                return -E_COMMAND_SYNTAX;
-       return send_buffer(socket_fd, "para_server-" VERSION ", \"" CODENAME "\"\n"
+       return send_buffer(socket_fd, "para_server-" PACKAGE_VERSION ", \""
+                       CODENAME "\"\n"
                        COPYRIGHT "\n"
                        "built: " BUILD_DATE "\n"
                        SYSTEM ", " CC_VERSION "\n"
@@ -1100,7 +1101,8 @@ int handle_connect(int fd, struct sockaddr_in *addr)
        in_addr = addr;
        challenge_nr = random();
        /* send Welcome message */
-       ret = send_va_buffer(fd, "This is para_server, version " VERSION  ".\n" );
+       ret = send_va_buffer(fd, "This is para_server, version "
+               PACKAGE_VERSION  ".\n" );
        if (ret < 0)
                goto err_out;
        /* recv auth request line */
index a889b0353dba445f65cef9c0a72e4c1d1dbeae46..6c9cfebaec15eb4d0c5e8ce0887d241a99cd0905 100644 (file)
@@ -3,5 +3,5 @@ section "The dynamic audio range compressor"
 option "blocksize" b "larger blocksize means fewer volume adjustments per time unit" int typestr="number" default="16" optional
 option "aggressiveness" a "controls the maximum amount to amplify by" int typestr="number" default="2" optional
 option "inertia" i "how much inertia ramping has" int typestr="number" default="6" optional
-option "target_level" t "target signal level (0-32768)" int typestr="number" default="25000" optional
+option "target_level" t "target signal level (0-32768)" int typestr="number" default="20000" optional
 option "damp" d "if non-zero, scale down after normalizing" int typestr="number" default="0" optional
index d3a43b9a2de32fe50f2a42009cbcfb7830972985..edaf7f9c7872dad1808f941d99a9fb416a9c68f4 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -101,7 +101,8 @@ void close_log(FILE* logfile)
  */
 void log_welcome(const char *whoami, int loglevel)
 {
-       PARA_INFO_LOG("welcome to %s " VERSION " ("BUILD_DATE")\n", whoami);
+       PARA_INFO_LOG("welcome to %s " PACKAGE_VERSION " ("BUILD_DATE")\n",
+               whoami);
        PARA_DEBUG_LOG("using loglevel %d\n", loglevel);
 }
 
diff --git a/dbadm.c b/dbadm.c
index 40ecf0b862a5a2a6d18bc739eacb44bc5d20f123..4772c969d1a6bf71d052121b4c4241426a557d12 100644 (file)
--- a/dbadm.c
+++ b/dbadm.c
@@ -150,6 +150,8 @@ static int commit_changes(char *filename)
 //     ITEM **items;
        int i;
        char buf[MAXLINE] = "para_client sa ";
+       int fds[3] = {0, 0, 0};
+       pid_t pid;
 
        for (i = 0; i < n_choices; ++i) {
                strcat(buf, item_name(my_items[i]));
@@ -162,7 +164,7 @@ static int commit_changes(char *filename)
        strcat(buf, filename);
        //printf("old atts: %s\n", atts);
        //printf("%s\n", buf);
-       return system(buf);
+       return para_exec_cmdline_pid(&pid, buf, fds);
 }
 
 static char *get_current_filename(void)
@@ -330,11 +332,8 @@ repeat:
                        goto repeat;
                /* Enter */
                case 10:
-                       endwin();
                        if (atts_modified)
                                commit_changes(filename);
-                       else
-                               printf("Attributes unchanged\n");
                        goto out;
                default:
                        goto repeat;
@@ -342,7 +341,7 @@ repeat:
 out:
        if (my_items) {
                free_item(my_items[0]);
-               free_item(my_items[1]);
+               free_item(my_items[1]);
        }
        for (i = 0; i < n_choices; i++)
                free(choices[i]);
index aba21a6db1d2e92aa997a964a053d8000df9b2f1..3592a2827a70b2441bc51a1bd6cbe7e1181d7374 100644 (file)
@@ -120,15 +120,22 @@ static void dccp_shutdown_client(struct dccp_client *dc)
        free(dc);
 }
 
+#define DCCP_RETRIES 100
+
 static int dccp_write(int fd, const char *buf, size_t len)
 {
        size_t size, written = 0;
-       int ret;
+       int ret, retries = 0;
 again:
        size = PARA_MIN(1024, len - written);
        ret = write(fd, buf + written, size);
-       if (ret < 0)
-               goto err_out;
+       if (ret < 0) {
+               if (errno != EAGAIN || !retries++ > DCCP_RETRIES)
+                       goto err_out;
+               PARA_DEBUG_LOG("EAGAIN #%d@%d/%d\n", retries, written, len);
+               goto again;
+       }
+       retries = 0;
        written += ret;
        if (written >= len)
                return written;
diff --git a/fd.c b/fd.c
index 36b3769d289a03aa0148aa941a713ba1534a2be0..dd07466cef2623e5aaa053178d7eda9e992e3dcd 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -47,8 +47,8 @@ int file_exists(const char *fn)
  * \param n the highest-numbered descriptor in any of the two sets, plus 1
  * \param readfds fds that should be checked for readability
  * \param writefds fds that should be checked for writablility
- * \param timeout upper bound on the amount of time elapsed before select()
- *  returns
+ * \param timeout_tv upper bound on the amount of time elapsed before select()
+ * returns
  *
  * \return The return value of the underlying select() call.
  *
index efe9cf613b13720684b24cf2a0db85799fcd3aef..70b95f4f655b174db266809428f5f0667e6bc2e2 100644 (file)
@@ -170,7 +170,7 @@ void activate_grab_client(struct grab_client *gc, struct filter_node *fn)
 /**
  * activate inactive grab clients if possible
  *
- * \param slot audiod's slot for the new audio file
+ * \param slot_num audiod's slot for the new audio file
  * \param audio_format_num the number of the audio format of the new audio file
  * \param filter_list the list of activated filters for that new audio file
  *
diff --git a/gui.c b/gui.c
index ffd1ea842039760bd6a1ec268a01423334bbb368..c0588197c553e1728713e0e964c61041eb02e7ef 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -31,7 +31,7 @@ INIT_GUI_ERRLISTS;
 extern const char *status_item_list[NUM_STAT_ITEMS];
 static char *stat_content[NUM_STAT_ITEMS];
 
-#define STANDARD_STATUS_BAR "para_gui " VERSION " (hit ? for help)"
+#define STANDARD_STATUS_BAR "para_gui " PACKAGE_VERSION " (hit ? for help)"
 
 static int signal_pipe;
 
@@ -339,7 +339,7 @@ static void print_status_bar(void)
        if (!curses_active)
                return;
        wmove(sb.win, 0, 0);
-       align_str(sb.win,STANDARD_STATUS_BAR, sb.cols, CENTER);
+       align_str(sb.win, STANDARD_STATUS_BAR, sb.cols, CENTER);
        wrefresh(sb.win);
 }
 
@@ -540,7 +540,7 @@ static void print_welcome(void)
        int ll = conf.loglevel_arg;
        if (ll > NOTICE)
                return;
-       outputf(COLOR_WELCOME, "Welcome to para_gui " VERSION
+       outputf(COLOR_WELCOME, "Welcome to para_gui " PACKAGE_VERSION
                " \"" CODENAME "\". Theme: %s", theme.name);
        wclrtoeol(bot.win);
 }
@@ -1224,7 +1224,8 @@ static void com_enlarge_top_win(void)
 
 static void com_version(void)
 {
-       print_in_bar(COLOR_MSG, "para_gui " VERSION " \"" CODENAME "\"");
+       print_in_bar(COLOR_MSG, "para_gui " PACKAGE_VERSION " \""
+               CODENAME "\"");
 }
 
 static void com_quit(void)
diff --git a/gui.ggo b/gui.ggo
index 34cbdb1978359287291bc0a1a3b5dfd0554c8510..9701c39ee523952a2ecd31c1147ce75a83813a72 100644 (file)
--- a/gui.ggo
+++ b/gui.ggo
@@ -3,7 +3,7 @@ option "auto_decode" a "auto-decode audio stream" flag on
 option "config_file" c "(default='~/.paraslash/gui.conf')" string typestr="filename" optional
 option "loglevel" l "set loglevel (0-6)" int typestr="level" default="4" optional
 option "timeout" t "set timeout" int typestr="milliseconds" default="30" optional
-option "stat_cmd" s "command to read server and audiod status data from" string typestr="command" default="para_audioc -t 100 stat" optional
+option "stat_cmd" s "command to read server and audiod status data from" string typestr="command" default="para_audioc stat" optional
 
 section "mapping keys to commands"
 option "key_map" k "Map key k to command c using mode m. Mode may be d, x or p for display, external and paraslash commands, respectively. Of course, this option may be given multiple times, one for each key mapping." string typestr="k:m:c" optional multiple
index 6a2f60f1b1b945befd179a28d609ea88e54938e4..386aacbcfc2c447e907e97c3bb630504ff87bdf9 100644 (file)
@@ -87,7 +87,7 @@ static char *make_request_msg(void)
 {
        char *ret, *hn = para_hostname();
        ret = make_message("%s1.0\nHost: %s\nUser-Agent: para_recv/%s\n\n\n",
-               HTTP_GET_MSG, hn, VERSION);
+               HTTP_GET_MSG, hn, PACKAGE_VERSION);
        free(hn);
        return ret;
 }
index 054c797ebcd10e66635197b73dc7548449bc6bce..45a10bac0e9264e96b38dda81b7233370c02958e 100644 (file)
@@ -1158,12 +1158,17 @@ static char *get_query(char *streamname, char *filename, int with_path)
        char *select_clause = NULL;
        if (!streamname)
                tmp = get_current_stream();
-       else
+       else {
                tmp = escape_str(streamname);
+               if (!tmp)
+                       return NULL;
+       }
        if (!strcmp(tmp, "(none)")) {
                free(tmp);
                if (filename) {
                        char *ret, *ebn = escaped_basename(filename);
+                       if (!ebn)
+                               return NULL;
                        ret = make_message("select to_days(now()) - "
                                "to_days(lastplayed) from data "
                                "where name = '%s'", ebn);
@@ -2095,14 +2100,21 @@ static int com_sl(int fd, int argc, char *argv[])
        num = atoi(argv[1]);
        if (!num)
                return -E_MYSQL_SYNTAX;
-       stream = (argc == 2)?  get_current_stream() : escape_str(argv[2]);
+       if (argc == 2) {
+               stream = get_current_stream();
+               if (!stream)
+                       return -E_GET_STREAM;
+       } else {
+               stream = escape_str(argv[2]);
+               if (!stream)
+                       return -E_ESCAPE;
+       }
        tmp = get_query(stream, NULL, 0);
+       free(stream);
+       if (!tmp)
+               return -E_GET_QUERY;
        query = make_message("%s limit %d", tmp, num);
        free(tmp);
-       ret = -E_GET_QUERY;
-       free(stream);
-       if (!query)
-               goto out;
        ret = -E_NORESULT;
        result = get_result(query);
        free(query);
@@ -2388,6 +2400,8 @@ static int com_upd(int fd, int argc, __a_unused char *argv[])
                        goto out;
                send_va_buffer(fd, "new entry: %s\n", row[0]);
                erow = escape_str(row[0]);
+               if (!erow)
+                       goto out;
                query = make_message("insert into data (name, pic_id) values "
                        "('%s','%s')", erow, "1");
                free(erow);
@@ -2419,6 +2433,8 @@ static char **server_get_audio_file_list(unsigned int num)
 
        tmp = get_query(stream, NULL, 1);
        free(stream);
+       if (!tmp)
+               goto err_out;
        query = make_message("%s limit %d", tmp, num);
        free(tmp);
        result = get_result(query);
@@ -2509,8 +2525,12 @@ static int com_cdb(int fd, int argc, char *argv[])
                goto out;
        if (argc < 2)
                conf.mysql_database_arg = para_strdup("paraslash");
-       else
+       else {
+               ret = -E_ESCAPE;
                conf.mysql_database_arg = escape_str(argv[1]);
+               if (!conf.mysql_database_arg)
+                       goto out;
+       }
        query = make_message("create database %s", conf.mysql_database_arg);
        ret = real_query(query);
        free(query);
index 1f2f78b7d08322e2d82550fc31335fed1149a2cf..287d7064acd4f2ec9cb67672ad6ed4835181224e 100644 (file)
@@ -282,6 +282,7 @@ static int ortp_recv_open(struct receiver_node *rn)
        pord->session = rtp_session_new(RTP_SESSION_RECVONLY);
        PARA_NOTICE_LOG("receiving from %s:%d\n", c->host_arg, c->port_arg);
        rtp_session_set_local_addr(pord->session, c->host_arg, c->port_arg);
+       rtp_session_set_remote_addr(pord->session, c->host_arg, c->port_arg);
        rtp_session_set_payload_type(pord->session, PAYLOAD_AUDIO_CONTINUOUS);
        if (c->jitter_compensation_arg) {
                rtp_session_enable_adaptive_jitter_compensation(pord->session, TRUE);
index dd4ee88409c3155853150c62736c6fa40ee4573c..b084bb68ac4b89b3a3921c5d002d00444ba14cb3 100644 (file)
@@ -87,6 +87,20 @@ static void ortp_send_buf(char *buf, int len, long unsigned chunks_sent)
        }
 }
 
+static int set_multicast(RtpSession *s)
+{
+       unsigned char loop = 1;
+       int ret;
+
+       ret = setsockopt(s->rtp.socket,
+               IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop));
+       if (ret < 0) {
+               PARA_ERROR_LOG("IP_MULTICAST_LOOP error %d\n", ret);
+
+       }
+       return 1;
+}
+
 static void ortp_init_session(struct ortp_target *ot)
 {
        RtpSession *s;
@@ -108,7 +122,9 @@ static void ortp_init_session(struct ortp_target *ot)
        if (ret < 0) {
                rtp_session_destroy(ot->session);
                ot->session = NULL;
+               return;
        }
+       set_multicast(s);
 }
 
 /* called by afs */
diff --git a/para.h b/para.h
index 26e04c6c435c47c8939f0803fcc62d556c005db1..b5a8f7bb14fe42d022c5d0faafffbd46062116a3 100644 (file)
--- a/para.h
+++ b/para.h
@@ -155,8 +155,8 @@ int stat_item_valid(const char *item);
 int stat_line_valid(const char *);
 void stat_client_write(char *msg, int itemnum);
 int stat_client_add(int fd, long unsigned mask);
-void dump_empty_status(void);
 unsigned for_each_line(char *, int, void (*)(char *));
+#define FOR_EACH_STAT_ITEM(i) for (i = 0; i < NUM_STAT_ITEMS; i++)
 
 struct stat_item_data {
        const char *prefix, *postfix;
diff --git a/recv.c b/recv.c
index bfc7a45d3572fb7c02e19cf9608883723df95e38..3b1c6917bda57f9a5a810b713bb41261dd1ae045 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -60,7 +60,9 @@ static void *parse_config(int argc, char *argv[], int *receiver_num)
 
 void rn_event_handler(struct task *t)
 {
+       struct receiver_node *rn = t->private_data;
        PARA_NOTICE_LOG("%s\n", PARA_STRERROR(-t->ret));
+       rn->eof = 1;
        unregister_task(t);
 }
 
index b67b3d1e48554993f61f836e5bc3a60e23f828a1..97d0573a8e3b455a95e26139a9c1ee30c30682e8 100644 (file)
--- a/sdl_gui.c
+++ b/sdl_gui.c
@@ -356,7 +356,7 @@ static void init_SDL(void)
        SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE);
        /* Set the window manager title bar */
        SDL_WM_SetCaption("The Gui of death that makes you blind (paraslash "
-               VERSION ")", "SFont");
+               PACKAGE_VERSION ")", "SFont");
 }
 
 /*
@@ -739,7 +739,7 @@ static int configfile_exists(void)
  */
 int main(int argc, char *argv[])
 {
-       int i, ret, fd;
+       int i, ret, fd = -1;
        SDLKey sym;
 
        sdl_gui_cmdline_parser(argc, argv, &args_info);
@@ -759,7 +759,6 @@ int main(int argc, char *argv[])
        height = args_info.height_arg;
 //     printf("w=%i,h=%i,ret=%i, cf=%s\n", width, height, ret, args_info.config_file_arg);
        init_stat_items();
-       fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
        init_SDL();
        for (i = 0; fonts[i].name[0]; i++) {
                char buf[MAXLINE];
@@ -775,6 +774,11 @@ int main(int argc, char *argv[])
                update_input();
        }
        for (;;) {
+               if (fd < 0) {
+                       fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
+                       if (fd < 0)
+                               clean_exit(EXIT_FAILURE);
+               }
                ret = draw_status(fd);
                if (ret < 0) {
                        close(fd);
@@ -802,10 +806,6 @@ int main(int argc, char *argv[])
                                || sym == SDLK_COMPOSE
                                )
                                continue;
-                       if (fd < 0) {
-                               kill(0, SIGINT);
-                               close(fd);
-                       }
                        fill_input_rect();
                        update_input();
                        if (!command_handler())
@@ -814,7 +814,6 @@ int main(int argc, char *argv[])
                        print_help();
                        update_pic();
                        SDL_UpdateRect(screen, 0, 0, 0, 0);
-                       fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
                        break;
                }
        }
index 3d04f8a2bb67240bee72c626583095237d7a3a3d..8ea4928784ae97e94afd2886f7f228bf06226bca 100644 (file)
@@ -4,5 +4,5 @@ option "width" x "Specify screen width" int typestr="pixels" default="1024" opti
 option "height" y "Specify screen height" int typestr="pixels" default="768" optional
 option "config_file" c "(default='~/.paraslash/sdl_gui.conf')" string typestr="filename" optional
 option "window-id" w "(currently ignored)" string typestr="filename" optional
-option "stat_cmd" s "command to read server and audiod status data from" string typestr="command" default="para_audioc -t 100 stat" optional
+option "stat_cmd" s "command to read server and audiod status data from" string typestr="command" default="para_audioc stat" optional
 option "pic_cmd" p "command to read pic from" string typestr="command" default="para_client pic" optional
diff --git a/send.h b/send.h
index bf1ca111f7f88cf300f0c18f9c1c93930549ea99..76a35123c8b5b414b45eec935a525e8d906ae22a 100644 (file)
--- a/send.h
+++ b/send.h
@@ -101,6 +101,8 @@ static inline int write_ok(int fd)
 again:
        FD_ZERO(&wfds);
        FD_SET(fd, &wfds);
+       tv.tv_sec = 0;
+       tv.tv_usec = 0;
        ret = select(fd + 1, NULL, &wfds, NULL, &tv);
        if (ret < 0 && errno == EINTR)
                goto again;
diff --git a/stat.c b/stat.c
index 33fdb8c1d0fec0596482820f447fb57c3754b003..8220fd27f3233499baa9d40035af1cbb2f797995 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -90,7 +90,6 @@ const char *status_item_list[NUM_STAT_ITEMS] = {
        [SI_AUDIOD_UPTIME] = "audiod_uptime",
        [SI_SELECTOR] = "dbtool"
 };
-#define FOR_EACH_STAT_ITEM(i) for (i = 0; i < NUM_STAT_ITEMS; i++)
 
 static void dump_stat_client_list(void)
 {
@@ -174,24 +173,6 @@ void stat_client_write(char *msg, int itemnum)
        PARA_DEBUG_LOG("%d client(s)\n", num_clients);
 }
 
-/**
- * send empty status list
- *
- * Send to  each connected client the full status item list
- * with empty values.
- */
-void dump_empty_status(void)
-{
-       int i;
-
-       if (!initialized)
-               return;
-       FOR_EACH_STAT_ITEM(i) {
-               char *tmp = make_message("%s:\n", status_item_list[i]);
-               stat_client_write(tmp, i);
-               free(tmp);
-       }
-}
 
 /**
  * check if string is a known status item.
index 2e86fe965a022ac099c6c2effe5f582d10611c5a..1656bcc94d886c712ce5b584a84f2dcf5e15e74a 100644 (file)
--- a/stdout.c
+++ b/stdout.c
@@ -82,6 +82,8 @@ void stdout_post_select(struct sched *s, struct task *t)
        if (ret <= 0)
                return;
        *sot->loaded -= ret;
+       if (*sot->loaded)
+               memmove(sot->buf, sot->buf + ret, *sot->loaded);
        t->ret = 1;
 }
 
diff --git a/time.c b/time.c
index d6e070809e527fba5437f59e0fe7976893432b9e..49b941bb004b959367a1d319dae7cead37d312df 100644 (file)
--- a/time.c
+++ b/time.c
@@ -106,7 +106,7 @@ void tv_scale(const unsigned long mult, const struct timeval *tv,
 /**
  * compute fraction of given struct timeval
  *
- * \param divider the integer value to divide by
+ * \param divisor the integer value to divide by
  * \param tv the timevalue to divide
  * \param result holds (1 / mult) * tv upon return
  */