From dc4030458f9af07d5719cfbff0a47cd16f1847f7 Mon Sep 17 00:00:00 2001 From: Andre Date: Sat, 6 Jan 2007 16:05:38 +0100 Subject: [PATCH] rename afs to vss (the virtual streaming system) --- aac_afh.c | 4 +- command.c | 104 ++++++++++++++++++++++----------------------- configure.ac | 2 +- db.c | 4 +- dccp_send.c | 6 +-- error.h | 8 ++-- http_send.c | 10 ++--- mp3_afh.c | 4 +- mysql_selector.c | 16 +++---- ogg_afh.c | 4 +- ortp_send.c | 10 ++--- server.c | 20 ++++----- server.h | 6 +-- user_list.c | 10 ++--- user_list.h | 8 ++-- afs.c => vss.c | 108 +++++++++++++++++++++++------------------------ afs.h => vss.h | 32 +++++++------- 17 files changed, 178 insertions(+), 178 deletions(-) rename afs.c => vss.c (84%) rename afs.h => vss.h (63%) diff --git a/aac_afh.c b/aac_afh.c index a3a24bc0..a2347065 100644 --- a/aac_afh.c +++ b/aac_afh.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Andre Noll + * Copyright (C) 2006-2007 Andre Noll * * 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 @@ -24,7 +24,7 @@ #include "server.cmdline.h" #include "server.h" -#include "afs.h" +#include "vss.h" #include "afh.h" #include "error.h" #include "string.h" diff --git a/command.c b/command.c index 66c658ac..ebc0a5fe 100644 --- a/command.c +++ b/command.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2006 Andre Noll + * Copyright (C) 1997-2007 Andre Noll * * 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 @@ -22,7 +22,7 @@ #include "server.cmdline.h" #include "db.h" #include "server.h" -#include "afs.h" +#include "vss.h" #include "send.h" #include "rc4.h" #include @@ -79,13 +79,13 @@ static struct server_command cmd_struct[] = { { .name = "ff", .handler = com_ff, -.perms = AFS_READ | AFS_WRITE, +.perms = VSS_READ | VSS_WRITE, .description = "jmp amount of time forwards or backwards " "in current audio file", .synopsis = "ff n[-]", .help = -"\tSet the 'R' (reposition request) bit of the afs status flags\n" +"\tSet the 'R' (reposition request) bit of the vss status flags\n" "\tand enqueue a request to jump n seconds forwards or backwards\n" "\tin the current audio file.\n" "\n" @@ -114,7 +114,7 @@ static struct server_command cmd_struct[] = { { .name = "hup", .handler = com_hup, -.perms = AFS_WRITE, +.perms = VSS_WRITE, .description = "force reload of config file and log file", .synopsis = "hup", .help = @@ -127,12 +127,12 @@ static struct server_command cmd_struct[] = { { .name = "jmp", .handler = com_jmp, -.perms = AFS_READ | AFS_WRITE, +.perms = VSS_READ | VSS_WRITE, .description = "jmp to given position in current audio file", .synopsis = "jmp [n]", .help = -"\tSet the 'R' (reposition request) bit of the afs status flags\n" +"\tSet the 'R' (reposition request) bit of the vss status flags\n" "\tand enqueue a request to jump to n% of the current audio file,\n" "\twhere 0 <= n <= 100.\n" @@ -141,12 +141,12 @@ static struct server_command cmd_struct[] = { { .name = "next", .handler = com_next, -.perms = AFS_READ | AFS_WRITE, +.perms = VSS_READ | VSS_WRITE, .description = "skip rest of current audio file", .synopsis = "next", .help = -"\tSet the 'N' (next audio file) bit of the afs status flags. When\n" +"\tSet the 'N' (next audio file) bit of the vss status flags. When\n" "\tplaying, change audio file immediately. Equivalent to stop\n" "\tif paused, NOP if stopped.\n" @@ -156,12 +156,12 @@ static struct server_command cmd_struct[] = { { .name = "nomore", .handler = com_nomore, -.perms = AFS_READ | AFS_WRITE, +.perms = VSS_READ | VSS_WRITE, .description = "stop playing after current audio file", .synopsis = "nomore", .help = -"Set the 'O' (no more) bit of the afs status flags. This instructs\n" +"Set the 'O' (no more) bit of the vss status flags. This instructs\n" "para_server to clear the 'P' (playing) bit as soon as it encounters\n" "the 'N' (next audio file) bit being set.\n" "\n" @@ -173,24 +173,24 @@ static struct server_command cmd_struct[] = { { .name ="pause", .handler = com_pause, -.perms = AFS_READ | AFS_WRITE, +.perms = VSS_READ | VSS_WRITE, .description = "pause current audio file", .synopsis = "pause", .help = -"\tClear the 'P' (playing) bit of the afs status flags.\n" +"\tClear the 'P' (playing) bit of the vss status flags.\n" }, { .name = "play", .handler = com_play, -.perms = AFS_READ | AFS_WRITE, +.perms = VSS_READ | VSS_WRITE, .description = "start playing or resume playing when paused", .synopsis = "play", .help = -"\tSet the 'P' (playing) bit of the afs status flags. This\n" +"\tSet the 'P' (playing) bit of the vss status flags. This\n" "\tresults in starting/continuing to stream.\n" }, @@ -198,7 +198,7 @@ static struct server_command cmd_struct[] = { { .name = "sb", .handler = com_sb, -.perms = AFS_READ, +.perms = VSS_READ, .description = "print status bar for current audio file", .synopsis = "sb [n]", .help = @@ -215,7 +215,7 @@ static struct server_command cmd_struct[] = { { .name = "sc", .handler = com_sc, -.perms = AFS_READ, +.perms = VSS_READ, .description = "print name of audio file whenever it changes", .synopsis = "sc [n]", .help = @@ -228,7 +228,7 @@ static struct server_command cmd_struct[] = { { .name = "sender", .handler = com_sender, -.perms = AFS_READ | AFS_WRITE, +.perms = VSS_READ | VSS_WRITE, .description = "control paraslash internal senders", .synopsis = "sender [s cmd [arguments]]", .help = @@ -253,7 +253,7 @@ static struct server_command cmd_struct[] = { { .name = "stat", .handler = com_stat, -.perms = AFS_READ, +.perms = VSS_READ, .description = "print status info for current audio file", .synopsis = "stat [n]", .help = @@ -267,19 +267,19 @@ static struct server_command cmd_struct[] = { { .name = "stop", .handler = com_stop, -.perms = AFS_READ | AFS_WRITE, +.perms = VSS_READ | VSS_WRITE, .description = "stop playing", .synopsis = "stop", .help = -"\tClear the 'P' (play) bit and set the 'N' bit of the afs status\n" +"\tClear the 'P' (play) bit and set the 'N' bit of the vss status\n" "\tflags.\n" }, { .name = "term", .handler = com_term, -.perms = AFS_READ | AFS_WRITE, +.perms = VSS_READ | VSS_WRITE, .description = "terminate para_server", .synopsis = "term", .help = @@ -315,13 +315,13 @@ static void mmd_dup(struct misc_meta_data *new_mmd) /* * compute human readable string containing - * afs_status for given integer value + * vss status for given integer value */ -static char *afs_status_tohuman(unsigned int flags) +static char *vss_status_tohuman(unsigned int flags) { - if (flags & AFS_PLAYING) + if (flags & VSS_PLAYING) return para_strdup("playing"); - else if (flags & AFS_NEXT) + else if (flags & VSS_NEXT) return para_strdup("stopped"); else return para_strdup("paused"); @@ -336,8 +336,8 @@ char *cmd_perms_itohuman(unsigned int perms) msg[0] = perms & DB_READ? 'd' : '-'; msg[1] = perms & DB_WRITE? 'D' : '-'; - msg[2] = perms & AFS_READ? 'a' : '-'; - msg[3] = perms & AFS_WRITE? 'A' : '-'; + msg[2] = perms & VSS_READ? 'a' : '-'; + msg[3] = perms & VSS_WRITE? 'A' : '-'; msg[4] = '\0'; return msg; } @@ -345,14 +345,14 @@ char *cmd_perms_itohuman(unsigned int perms) /* * Never returns NULL. */ -static char *afs_get_status_flags(unsigned int flags) +static char *vss_get_status_flags(unsigned int flags) { char *msg = para_malloc(5 * sizeof(char)); - msg[0] = (flags & AFS_PLAYING)? 'P' : '_'; - msg[1] = (flags & AFS_NOMORE)? 'O' : '_'; - msg[2] = (flags & AFS_NEXT)? 'N' : '_'; - msg[3] = (flags & AFS_REPOS)? 'R' : '_'; + msg[0] = (flags & VSS_PLAYING)? 'P' : '_'; + msg[1] = (flags & VSS_NOMORE)? 'O' : '_'; + msg[2] = (flags & VSS_NEXT)? 'N' : '_'; + msg[3] = (flags & VSS_REPOS)? 'R' : '_'; msg[4] = '\0'; return msg; } @@ -392,7 +392,7 @@ char *get_sb_string(struct misc_meta_data *nmmd) static char *get_status(struct misc_meta_data *nmmd) { char *bar, *ret, mtime[30] = ""; - char *status, *flags; /* afs status info */ + char *status, *flags; /* vss status info */ char *ut = uptime_str(); long offset = (nmmd->offset + 500) / 1000; struct timeval now; @@ -403,8 +403,8 @@ static char *get_status(struct misc_meta_data *nmmd) strftime(mtime, 29, "%a %b %d %Y", &mtime_tm); } /* report real status */ - status = afs_status_tohuman(nmmd->afs_status_flags); - flags = afs_get_status_flags(nmmd->afs_status_flags); + status = vss_status_tohuman(nmmd->vss_status_flags); + flags = vss_get_status_flags(nmmd->vss_status_flags); bar = para_basename(nmmd->filename); gettimeofday(&now, NULL); ret = make_message( @@ -811,8 +811,8 @@ static int com_play(__a_unused int socket_fd, int argc, __a_unused char **argv) if (argc != 1) return -E_COMMAND_SYNTAX; mmd_lock(); - mmd->new_afs_status_flags |= AFS_PLAYING; - mmd->new_afs_status_flags &= ~AFS_NOMORE; + mmd->new_vss_status_flags |= VSS_PLAYING; + mmd->new_vss_status_flags &= ~VSS_NOMORE; mmd_unlock(); return 1; @@ -824,9 +824,9 @@ static int com_stop(__a_unused int socket_fd, int argc, __a_unused char **argv) if (argc != 1) return -E_COMMAND_SYNTAX; mmd_lock(); - mmd->new_afs_status_flags &= ~AFS_PLAYING; - mmd->new_afs_status_flags &= ~AFS_REPOS; - mmd->new_afs_status_flags |= AFS_NEXT; + mmd->new_vss_status_flags &= ~VSS_PLAYING; + mmd->new_vss_status_flags &= ~VSS_REPOS; + mmd->new_vss_status_flags |= VSS_NEXT; mmd_unlock(); return 1; } @@ -837,10 +837,10 @@ static int com_pause(__a_unused int socket_fd, int argc, __a_unused char **argv) if (argc != 1) return -E_COMMAND_SYNTAX; mmd_lock(); - if (!afs_paused()) + if (!vss_paused()) mmd->events++; - mmd->new_afs_status_flags &= ~AFS_PLAYING; - mmd->new_afs_status_flags &= ~AFS_NEXT; + mmd->new_vss_status_flags &= ~VSS_PLAYING; + mmd->new_vss_status_flags &= ~VSS_NEXT; mmd_unlock(); return 1; } @@ -877,7 +877,7 @@ static int com_next(__a_unused int socket_fd, int argc, __a_unused char **argv) return -E_COMMAND_SYNTAX; mmd_lock(); mmd->events++; - mmd->new_afs_status_flags |= AFS_NEXT; + mmd->new_vss_status_flags |= VSS_NEXT; mmd_unlock(); return 1; } @@ -888,8 +888,8 @@ static int com_nomore(__a_unused int socket_fd, int argc, __a_unused char **argv if (argc != 1) return -E_COMMAND_SYNTAX; mmd_lock(); - if (afs_playing() || afs_paused()) - mmd->new_afs_status_flags |= AFS_NOMORE; + if (vss_playing() || vss_paused()) + mmd->new_vss_status_flags |= VSS_NOMORE; mmd_unlock(); return 1; } @@ -920,12 +920,12 @@ static int com_ff(__a_unused int socket_fd, int argc, char **argv) if (promille < 0) promille = 0; if (promille > 1000) { - mmd->new_afs_status_flags |= AFS_NEXT; + mmd->new_vss_status_flags |= VSS_NEXT; goto out; } mmd->repos_request = (mmd->chunks_total * promille) / 1000; - mmd->new_afs_status_flags |= AFS_REPOS; - mmd->new_afs_status_flags &= ~AFS_NEXT; + mmd->new_vss_status_flags |= VSS_REPOS; + mmd->new_vss_status_flags &= ~VSS_NEXT; mmd->events++; ret = 1; out: @@ -953,8 +953,8 @@ static int com_jmp(__a_unused int socket_fd, int argc, char **argv) mmd->repos_request = (mmd->chunks_total * i + 50)/ 100; PARA_INFO_LOG("sent: %lu, offset before jmp: %lu\n", mmd->chunks_sent, mmd->offset); - mmd->new_afs_status_flags |= AFS_REPOS; - mmd->new_afs_status_flags &= ~AFS_NEXT; + mmd->new_vss_status_flags |= VSS_REPOS; + mmd->new_vss_status_flags &= ~VSS_NEXT; ret = 1; mmd->events++; out: diff --git a/configure.ac b/configure.ac index faa5d4ad..49770573 100644 --- a/configure.ac +++ b/configure.ac @@ -81,7 +81,7 @@ audiod_ldflags="" audiod_audio_formats="" server_cmdline_objs="server.cmdline" -server_errlist_objs="server mp3_afh afs command net string signal random_selector +server_errlist_objs="server mp3_afh vss command net string signal random_selector time daemon stat crypt http_send db close_on_fork playlist_selector ipc dccp dccp_send fd user_list" server_ldflags="" diff --git a/db.c b/db.c index 8b066726..2e4ffbda 100644 --- a/db.c +++ b/db.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2006 Andre Noll + * Copyright (C) 2005-2007 Andre Noll * * 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 @@ -21,7 +21,7 @@ #include "server.cmdline.h" #include "server.h" -#include "afs.h" +#include "vss.h" #include /* readdir() */ #include /* stat */ #include /* mode_t */ diff --git a/dccp_send.c b/dccp_send.c index 273961fc..128d45b7 100644 --- a/dccp_send.c +++ b/dccp_send.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Andre Noll + * Copyright (C) 2006-2007 Andre Noll * * 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 @@ -26,7 +26,7 @@ #include "server.h" #include "net.h" #include "list.h" -#include "afs.h" +#include "vss.h" #include "send.h" #include "dccp.h" #include "error.h" @@ -165,7 +165,7 @@ static void dccp_send(long unsigned current_chunk, if (!ret) continue; if (!dc->header_sent && current_chunk) { - header_buf = afs_get_header(&header_len); + header_buf = vss_get_header(&header_len); if (header_buf && header_len > 0) { ret = dccp_write(dc->fd, header_buf, header_len); if (ret != header_len) { diff --git a/error.h b/error.h index b94139e3..9563303f 100644 --- a/error.h +++ b/error.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Andre Noll + * Copyright (C) 2006-2007 Andre Noll * * 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 @@ -63,7 +63,7 @@ enum para_subsystem { SS_AACDEC, SS_AAC_COMMON, SS_SERVER, - SS_AFS, + SS_VSS, SS_MYSQL_SELECTOR, SS_IPC, SS_DCCP, @@ -300,7 +300,7 @@ extern const char **para_errlist[]; PARA_ERROR(OGG_REPOS, "ogg repositioning error"), \ -#define AFS_ERRORS \ +#define VSS_ERRORS \ PARA_ERROR(AUDIO_FORMAT, "audio format not recognized"), \ PARA_ERROR(FSTAT, "failed to fstat() audio file"), \ @@ -552,7 +552,7 @@ SS_ENUM(OGG_AFH); SS_ENUM(AAC_AFH); SS_ENUM(AAC_COMMON); SS_ENUM(SERVER); -SS_ENUM(AFS); +SS_ENUM(VSS); SS_ENUM(COMMAND); SS_ENUM(RANDOM_SELECTOR); SS_ENUM(PLAYLIST_SELECTOR); diff --git a/http_send.c b/http_send.c index f06a5ac2..6c912951 100644 --- a/http_send.c +++ b/http_send.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2006 Andre Noll + * Copyright (C) 2005-2007 Andre Noll * * 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 @@ -22,7 +22,7 @@ #include "server.cmdline.h" #include "server.h" #include "http.h" -#include "afs.h" +#include "vss.h" #include "send.h" #include "list.h" #include "close_on_fork.h" @@ -128,7 +128,7 @@ static void http_shutdown_clients(void) { struct http_client *hc, *tmp; list_for_each_entry_safe(hc, tmp, &clients, node) - http_shutdown_client(hc, "afs request"); + http_shutdown_client(hc, "vss request"); } static int http_send_msg(struct http_client *hc, const char *msg) @@ -208,7 +208,7 @@ static void http_send( long unsigned current_chunk, continue; if (hc->status == HTTP_READY_TO_STREAM) { int hlen; - char *hbuf = afs_get_header(&hlen); + char *hbuf = vss_get_header(&hlen); if (hbuf && hlen > 0 && current_chunk) { /* need to send header */ PARA_INFO_LOG("queueing header: %d\n", hlen); @@ -360,7 +360,7 @@ static void http_pre_select(int *max_fileno, fd_set *rfds, fd_set *wfds) hc->check_w = 1; break; case HTTP_SENT_OK_MSG: - if (!afs_playing()) + if (!vss_playing()) break; /* wait until server starts playing */ para_fd_set(hc->fd, wfds, max_fileno); hc->check_w = 1; diff --git a/mp3_afh.c b/mp3_afh.c index d38e4359..530f36ff 100644 --- a/mp3_afh.c +++ b/mp3_afh.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2006 Andre Noll + * Copyright (C) 2003-2007 Andre Noll * * 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 @@ -30,7 +30,7 @@ #include "server.cmdline.h" #include "server.h" -#include "afs.h" +#include "vss.h" #include "afh.h" #include "error.h" #include "fd.h" diff --git a/mysql_selector.c b/mysql_selector.c index 7a3b0a7d..a2a5bcdd 100644 --- a/mysql_selector.c +++ b/mysql_selector.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1999-2006 Andre Noll + * Copyright (C) 1999-2007 Andre Noll * * 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 @@ -24,7 +24,7 @@ /** \endcond */ #include "server.cmdline.h" #include "server.h" -#include "afs.h" +#include "vss.h" #include "db.h" #include #include @@ -113,7 +113,7 @@ static struct server_command cmds[] = { { .name = "cs", .handler = com_cs, -.perms = AFS_WRITE | DB_READ | DB_WRITE, +.perms = VSS_WRITE | DB_READ | DB_WRITE, .description = "change stream", .synopsis = "cs [s]", .help = @@ -124,7 +124,7 @@ static struct server_command cmds[] = { { .name = "csp", .handler = com_cs, -.perms = AFS_WRITE | DB_READ, +.perms = VSS_WRITE | DB_READ, .description = "change stream and play", .synopsis = "csp s", .help = @@ -289,7 +289,7 @@ static struct server_command cmds[] = { { .name = "ns", .handler = com_ps, -.perms = AFS_WRITE | DB_READ | DB_WRITE, +.perms = VSS_WRITE | DB_READ | DB_WRITE, .description = "change to next stream", .synopsis = "ns", .help = @@ -377,7 +377,7 @@ static struct server_command cmds[] = { { .name = "ps", .handler = com_ps, -.perms = AFS_WRITE | DB_READ | DB_WRITE, +.perms = VSS_WRITE | DB_READ | DB_WRITE, .description = "change to previous stream", .synopsis = "ps", .help = @@ -2074,9 +2074,9 @@ static int com_cs(int fd, int argc, char *argv[]) } if (csp) { mmd_lock(); - mmd->new_afs_status_flags |= AFS_PLAYING; + mmd->new_vss_status_flags |= VSS_PLAYING; if (stream_change) - mmd->new_afs_status_flags |= AFS_NEXT; + mmd->new_vss_status_flags |= VSS_NEXT; mmd_unlock(); } ret = 1; diff --git a/ogg_afh.c b/ogg_afh.c index 5aaf53f7..14163fe6 100644 --- a/ogg_afh.c +++ b/ogg_afh.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2006 Andre Noll + * Copyright (C) 2004-2007 Andre Noll * * 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 @@ -24,7 +24,7 @@ #include "server.cmdline.h" #include "server.h" -#include "afs.h" +#include "vss.h" #include "afh.h" #include "error.h" #include "string.h" diff --git a/ortp_send.c b/ortp_send.c index 4dd19d7d..b06a1b84 100644 --- a/ortp_send.c +++ b/ortp_send.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2006 Andre Noll + * Copyright (C) 2005-2007 Andre Noll * * 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 @@ -22,7 +22,7 @@ #include "server.cmdline.h" #include "server.h" -#include "afs.h" +#include "vss.h" #include "send.h" #include "list.h" #include "ortp.h" @@ -128,7 +128,7 @@ static void ortp_init_session(struct ortp_target *ot) set_multicast(s); } -/* called by afs */ +/* called by vss */ static void ortp_shutdown_targets(void) { unsigned char buf[ORTP_AUDIO_HEADER_LEN]; @@ -175,7 +175,7 @@ static void ortp_send(long unsigned current_chunk, long unsigned chunks_sent, if (self->status != SENDER_ON) return; - chunk_tv = afs_chunk_time(); + chunk_tv = vss_chunk_time(); if (!chunk_tv) return; list_for_each_entry_safe(ot, tmp, &targets, node) { @@ -193,7 +193,7 @@ static void ortp_send(long unsigned current_chunk, long unsigned chunks_sent, } if (list_empty(&targets)) return; - header_buf = afs_get_header(&header_len); + header_buf = vss_get_header(&header_len); if (!need_extra_header(current_chunk)) header_len = 0; sendbuf_len = ORTP_AUDIO_HEADER_LEN + header_len + len; diff --git a/server.c b/server.c index 6195266b..b67c7e29 100644 --- a/server.c +++ b/server.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2006 Andre Noll + * Copyright (C) 1997-2007 Andre Noll * * 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 @@ -32,7 +32,7 @@ #include "server.cmdline.h" #include "db.h" #include "server.h" -#include "afs.h" +#include "vss.h" #include "config.h" #include "close_on_fork.h" #include "send.h" @@ -51,7 +51,7 @@ INIT_SERVER_ERRLISTS; /** shut down non-authorized connections after that many seconds */ #define ALARM_TIMEOUT 10 -/* these are exported to afs.c. command.c and to all selectors */ +/* these are exported to vss.c. command.c and to all selectors */ struct misc_meta_data *mmd; /** the configuration of para_server * @@ -182,8 +182,8 @@ static void shm_init(void) mmd->active_connections = 0; strcpy(mmd->filename, "(none)"); mmd->audio_format = -1; - mmd->afs_status_flags = AFS_NEXT; - mmd->new_afs_status_flags = AFS_NEXT; + mmd->vss_status_flags = VSS_NEXT; + mmd->new_vss_status_flags = VSS_NEXT; mmd->sender_cmd_data.cmd_num = -1; return; err_out: @@ -362,7 +362,7 @@ static unsigned do_inits(int argc, char **argv) init_selector(); PARA_NOTICE_LOG("%s", "initializing audio file sender\n"); /* audio file sender */ - afs_init(); + vss_init(); mmd->server_pid = getpid(); setup_signal_handling(); mmd_lock(); @@ -411,7 +411,7 @@ static void status_refresh(void) if (prev_events != mmd->events) goto out; - if (mmd->new_afs_status_flags != mmd->afs_status_flags) + if (mmd->new_vss_status_flags != mmd->vss_status_flags) goto out; if (uptime / 60 != prev_uptime / 60) goto out; @@ -419,7 +419,7 @@ static void status_refresh(void) out: prev_uptime = uptime; prev_events = mmd->events; - mmd->afs_status_flags = mmd->new_afs_status_flags; + mmd->vss_status_flags = mmd->new_vss_status_flags; if (ret) { PARA_DEBUG_LOG("%d events, forcing status update, af = %d\n", mmd->events, mmd->audio_format); @@ -449,7 +449,7 @@ repeat: /* check socket and signal pipe in any case */ para_fd_set(sockfd, &rfds, &max_fileno); para_fd_set(signal_pipe, &rfds, &max_fileno); - timeout = afs_preselect(); + timeout = vss_preselect(); status_refresh(); for (i = 0; senders[i].name; i++) { if (senders[i].status != SENDER_ON) @@ -478,7 +478,7 @@ repeat: continue; senders[i].post_select(&rfds, &wfds); } - afs_send_chunk(); + vss_send_chunk(); status_refresh(); if (FD_ISSET(signal_pipe, &rfds)) { int sig; diff --git a/server.h b/server.h index 8bec74fd..bd2b0500 100644 --- a/server.h +++ b/server.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2006 Andre Noll + * Copyright (C) 1997-2007 Andre Noll * * 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 @@ -82,9 +82,9 @@ struct misc_meta_data{ /* the number of the current audio format */ int audio_format; /** the "old" status flags -- commands may only read them */ - unsigned int afs_status_flags; + unsigned int vss_status_flags; /** the new status flags -- commands may set them **/ - unsigned int new_afs_status_flags; + unsigned int new_vss_status_flags; /** the number of data chunks sent for the current audio file */ long unsigned chunks_sent; /** the number of chunks this audio file contains */ diff --git a/user_list.c b/user_list.c index abd47e18..75dca081 100644 --- a/user_list.c +++ b/user_list.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Andre Noll + * Copyright (C) 2006-2007 Andre Noll * * 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 @@ -70,10 +70,10 @@ static void populate_user_list(char *user_list_file) u->perms = 0; while (num > 0) { num--; - if (!strcmp(tmp[num], "AFS_READ")) - u->perms |= AFS_READ; - else if (!strcmp(tmp[num], "AFS_WRITE")) - u->perms |= AFS_WRITE; + if (!strcmp(tmp[num], "VSS_READ")) + u->perms |= VSS_READ; + else if (!strcmp(tmp[num], "VSS_WRITE")) + u->perms |= VSS_WRITE; else if (!strcmp(tmp[num], "DB_READ")) u->perms |= DB_READ; else if (!strcmp(tmp[num], "DB_WRITE")) diff --git a/user_list.h b/user_list.h index 507ea02c..1ee73521 100644 --- a/user_list.h +++ b/user_list.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Andre Noll + * Copyright (C) 2006-2007 Andre Noll * * 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 @@ -26,10 +26,10 @@ * * - DB_READ: command reads from the database * - DB_WRITE: command changes the contents of the database - * - AFS_READ: command reads information about the current audio stream - * - AFS_WRITE: command changes the current audio stream + * - VSS_READ: command reads information about the current audio stream + * - VSS_WRITE: command changes the current audio stream */ -enum {DB_READ = 1, DB_WRITE = 2, AFS_READ = 4, AFS_WRITE = 8}; +enum {DB_READ = 1, DB_WRITE = 2, VSS_READ = 4, VSS_WRITE = 8}; /** * data needed to authenticate the user diff --git a/afs.c b/vss.c similarity index 84% rename from afs.c rename to vss.c index 2d4184d2..f9e2d6c2 100644 --- a/afs.c +++ b/vss.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2006 Andre Noll + * Copyright (C) 1997-2007 Andre Noll * * 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 @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ -/** \file afs.c audio file sending functions +/** \file vss.c the virtual streaming system * * This contains the audio sending part of para_server which is independent of * the current audio format, audio file selector and of the activated senders. @@ -27,7 +27,7 @@ #include "server.cmdline.h" #include "db.h" #include "afh.h" -#include "afs.h" +#include "vss.h" #include "send.h" #include "error.h" #include "string.h" @@ -85,25 +85,25 @@ static struct audio_format_handler afl[] = { #define FOR_EACH_AUDIO_FORMAT(i) for (i = 0; afl[i].name; i++) /** - * check if audio file sender is playing + * check if vss status flag \a P (playing) is set * * \return greater than zero if playing, zero otherwise. * */ -unsigned int afs_playing(void) +unsigned int vss_playing(void) { - return mmd->new_afs_status_flags & AFS_PLAYING; + return mmd->new_vss_status_flags & VSS_PLAYING; } /** - * check if 'next' flag is set afs_status_flags + * check if \a N (next) status flag is set * * \return greater than zero if set, zero if not. * */ -unsigned int afs_next(void) +unsigned int vss_next(void) { - return mmd->new_afs_status_flags & AFS_NEXT; + return mmd->new_vss_status_flags & VSS_NEXT; } /** @@ -112,21 +112,21 @@ unsigned int afs_next(void) * \return greater than zero if true, zero otherwise. * */ -unsigned int afs_repos(void) +unsigned int vss_repos(void) { - return mmd->new_afs_status_flags & AFS_REPOS; + return mmd->new_vss_status_flags & VSS_REPOS; } /** - * check if audio file sender is paused + * check if the vss is currently paused * * \return greater than zero if paused, zero otherwise. * */ -unsigned int afs_paused(void) +unsigned int vss_paused(void) { - return !(mmd->new_afs_status_flags & AFS_NEXT) - && !(mmd->new_afs_status_flags & AFS_PLAYING); + return !(mmd->new_vss_status_flags & VSS_NEXT) + && !(mmd->new_vss_status_flags & VSS_PLAYING); } /** @@ -142,12 +142,12 @@ const char *audio_format_name(int i) } /** - * initialize the audio file sender + * initialize the virtual streaming system * * Call the init functions of all supported audio format handlers and * initialize all supported senders. */ -void afs_init(void) +void vss_init(void) { int i; char *hn = para_hostname(), *home = para_homedir(); @@ -169,8 +169,8 @@ void afs_init(void) free(home); if (conf.autoplay_given) { struct timeval now, tmp; - mmd->afs_status_flags |= AFS_PLAYING; - mmd->new_afs_status_flags |= AFS_PLAYING; + mmd->vss_status_flags |= VSS_PLAYING; + mmd->new_vss_status_flags |= VSS_PLAYING; gettimeofday(&now, NULL); ms2tv(conf.autoplay_delay_arg, &tmp); tv_add(&now, &tmp, &autoplay_barrier); @@ -279,7 +279,7 @@ static void get_song(void) if (selectors[mmd->selector_num].update_audio_file) selectors[mmd->selector_num].update_audio_file(sl[i]); PARA_DEBUG_LOG("%s", "success\n"); - mmd->new_afs_status_flags &= (~AFS_NEXT); + mmd->new_vss_status_flags &= (~VSS_NEXT); gettimeofday(&now, NULL); tv_add(&now, &announce_tv, &data_send_barrier); @@ -287,7 +287,7 @@ static void get_song(void) } PARA_ERROR_LOG("%s", "no valid files found\n"); err_out: - mmd->new_afs_status_flags = AFS_NEXT; + mmd->new_vss_status_flags = VSS_NEXT; free: if (sl) { for (i = 0; sl[i]; i++) @@ -310,7 +310,7 @@ static int chk_barrier(const char *bname, const struct timeval *now, return -1; } -static void afs_next_chunk_time(struct timeval *due) +static void vss_next_chunk_time(struct timeval *due) { struct timeval tmp; @@ -322,12 +322,12 @@ static void afs_next_chunk_time(struct timeval *due) * != NULL: timeout for next chunk * NULL: nothing to do */ -static struct timeval *afs_compute_timeout(void) +static struct timeval *vss_compute_timeout(void) { static struct timeval the_timeout; struct timeval now, next_chunk; - if (afs_next() && mmd->audio_format >= 0) { + if (vss_next() && mmd->audio_format >= 0) { /* only sleep a bit, nec*/ the_timeout.tv_sec = 0; the_timeout.tv_usec = 100; @@ -342,9 +342,9 @@ static struct timeval *afs_compute_timeout(void) if (chk_barrier("data send", &now, &data_send_barrier, &the_timeout, 1) < 0) return &the_timeout; - if (mmd->audio_format < 0 || !afs_playing() || !audio_file) + if (mmd->audio_format < 0 || !vss_playing() || !audio_file) return NULL; - afs_next_chunk_time(&next_chunk); + vss_next_chunk_time(&next_chunk); if (chk_barrier(afl[mmd->audio_format].name, &now, &next_chunk, &the_timeout, 0) < 0) return &the_timeout; @@ -354,7 +354,7 @@ static struct timeval *afs_compute_timeout(void) return &the_timeout; } -static void afs_eof(struct audio_format_handler *af) +static void vss_eof(struct audio_format_handler *af) { struct timeval now; int i; @@ -397,7 +397,7 @@ static void afs_eof(struct audio_format_handler *af) * treamtment. * */ -char *afs_get_header(int *header_len) +char *vss_get_header(int *header_len) { *header_len = 0; if (mmd->audio_format < 0) @@ -417,7 +417,7 @@ const char *supported_audio_formats(void) * \return a pointer to a struct containing the chunk time, or NULL, * if currently no audio file is selected. */ -struct timeval *afs_chunk_time(void) +struct timeval *vss_chunk_time(void) { if (mmd->audio_format < 0) return NULL; @@ -430,7 +430,7 @@ struct timeval *afs_chunk_time(void) * This function gets called from para_server to determine the timeout value * for its main select loop. * - * Before the timeout is computed, the current afs status flags are evaluated + * Before the timeout is computed, the current vss status flags are evaluated * and acted upon by calling appropriate functions from the lower layers. * Possible actions include * @@ -441,7 +441,7 @@ struct timeval *afs_chunk_time(void) * \return A pointer to a struct timeval containing the timeout for the next * chunk of data to be sent, or NULL if we're not sending right now. */ -struct timeval *afs_preselect(void) +struct timeval *vss_preselect(void) { struct audio_format_handler *af = NULL; int i, format; @@ -453,34 +453,34 @@ again: else for (i = 0; senders[i].name; i++) senders[i].shutdown_clients(); - if (afs_next() && af) { - afs_eof(af); - return afs_compute_timeout(); + if (vss_next() && af) { + vss_eof(af); + return vss_compute_timeout(); } - if (afs_paused() || afs_repos()) { + if (vss_paused() || vss_repos()) { for (i = 0; senders[i].name; i++) senders[i].shutdown_clients(); if (af) { struct timeval now; gettimeofday(&now, NULL); - if (!afs_paused() || mmd->chunks_sent) + if (!vss_paused() || mmd->chunks_sent) tv_add(&af->eof_tv, &now, &eof_barrier); - if (afs_repos()) + if (vss_repos()) tv_add(&now, &announce_tv, &data_send_barrier); - if (mmd->new_afs_status_flags & AFS_NOMORE) - mmd->new_afs_status_flags = AFS_NEXT; + if (mmd->new_vss_status_flags & VSS_NOMORE) + mmd->new_vss_status_flags = VSS_NEXT; } mmd->chunks_sent = 0; } - if (af && afs_repos() && mmd->current_chunk != mmd->repos_request) + if (af && vss_repos() && mmd->current_chunk != mmd->repos_request) af->reposition_stream(mmd->repos_request); - if (afs_repos()) { - mmd->new_afs_status_flags &= ~(AFS_REPOS); + if (vss_repos()) { + mmd->new_vss_status_flags &= ~(VSS_REPOS); mmd->current_chunk = mmd->repos_request; } - ret = afs_compute_timeout(); - if (!ret && !audio_file && afs_playing() && - !(mmd->new_afs_status_flags & AFS_NOMORE)) { + ret = vss_compute_timeout(); + if (!ret && !audio_file && vss_playing() && + !(mmd->new_vss_status_flags & VSS_NOMORE)) { PARA_DEBUG_LOG("%s", "ready and playing, but no audio file\n"); get_song(); goto again; @@ -489,7 +489,7 @@ again: } /** - * afs_send_chunk - paraslash's main sending function + * main sending function * * This function gets called from para_server as soon as the next chunk of * data should be pushed out. It first calls the read_chunk() function of @@ -501,7 +501,7 @@ again: * on errors. */ -void afs_send_chunk(void) +void vss_send_chunk(void) { int i; struct audio_format_handler *af; @@ -509,11 +509,11 @@ void afs_send_chunk(void) ssize_t ret; struct timeval now, due; - if (mmd->audio_format < 0 || !audio_file || !afs_playing()) + if (mmd->audio_format < 0 || !audio_file || !vss_playing()) return; af = &afl[mmd->audio_format]; gettimeofday(&now, NULL); - afs_next_chunk_time(&due); + vss_next_chunk_time(&due); if (tv_diff(&due, &now, NULL) > 0) return; if (chk_barrier("eof", &now, &eof_barrier, &due, 1) < 0) @@ -522,13 +522,13 @@ void afs_send_chunk(void) &due, 1) < 0) return; buf = af->read_chunk(mmd->current_chunk, &ret); - mmd->new_afs_status_flags &= ~AFS_REPOS; + mmd->new_vss_status_flags &= ~VSS_REPOS; if (!buf) { if (ret < 0) - mmd->new_afs_status_flags = AFS_NEXT; + mmd->new_vss_status_flags = VSS_NEXT; else - mmd->new_afs_status_flags |= AFS_NEXT; - afs_eof(af); + mmd->new_vss_status_flags |= VSS_NEXT; + vss_eof(af); return; } if (!mmd->chunks_sent) { @@ -540,7 +540,7 @@ void afs_send_chunk(void) } for (i = 0; senders[i].name; i++) senders[i].send(mmd->current_chunk, mmd->chunks_sent, buf, ret); - mmd->new_afs_status_flags |= AFS_PLAYING; + mmd->new_vss_status_flags |= VSS_PLAYING; mmd->chunks_sent++; mmd->current_chunk++; } diff --git a/afs.h b/vss.h similarity index 63% rename from afs.h rename to vss.h index 3f4d1d7c..545647b7 100644 --- a/afs.h +++ b/vss.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2006 Andre Noll + * Copyright (C) 2005-2007 Andre Noll * * 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 @@ -16,22 +16,22 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ -/** \file afs.h exported functions from afs.c (para_server) */ -void afs_init(void); -void afs_send_chunk(void); -struct timeval *afs_preselect(void); +/** \file vss.h exported functions from vss.c (para_server) */ +void vss_init(void); +void vss_send_chunk(void); +struct timeval *vss_preselect(void); const char *audio_format_name(int); -unsigned int afs_playing(void); -unsigned int afs_next(void); -unsigned int afs_repos(void); -unsigned int afs_paused(void); -char *afs_get_header(int *header_len); -struct timeval *afs_chunk_time(void); +unsigned int vss_playing(void); +unsigned int vss_next(void); +unsigned int vss_repos(void); +unsigned int vss_paused(void); +char *vss_get_header(int *header_len); +struct timeval *vss_chunk_time(void); int guess_audio_format(const char *name); const char *supported_audio_formats(void); /* status flags */ -#define AFS_NOMORE 1 -#define AFS_NEXT 2 -#define AFS_REPOS 4 -#define AFS_PLAYING 8 -#define DBT_CHANGE 16 +#define VSS_NOMORE 1 +#define VSS_NEXT 2 +#define VSS_REPOS 4 +#define VSS_PLAYING 8 +#define VSS_CHANGE 16 -- 2.39.5