From: Andre Noll
Date: Sat, 22 Jun 2013 13:58:29 +0000 (+0200)
Subject: Merge branch 't/interactive'
X-Git-Tag: v0.4.13~26
X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;h=3b7cc768deb62e635bd06541418d22b59d35883c;hp=f8931d4607fdf8cb98761b9814d068256d2925a3;p=paraslash.git
Merge branch 't/interactive'
Was cooking for almost two weeks.
f8931d Simplify i9e_line_handler.
f99dbe i9e: Fix a prompt display issue
cf39e4 audioc: Abstract out connection code.
---
diff --git a/Makefile.in b/Makefile.in
index f3dfea00..698599e5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -182,6 +182,10 @@ $(object_dir)/mp3dec_filter.o: mp3dec_filter.c | $(object_dir)
@[ -z "$(Q)" ] || echo 'CC $<'
$(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @mad_cppflags@ $<
+$(object_dir)/compress_filter.o: compress_filter.c | $(object_dir)
+ @[ -z "$(Q)" ] || echo 'CC $<'
+ $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) -O3 $<
+
$(object_dir)/aacdec_filter.o: aacdec_filter.c | $(object_dir)
@[ -z "$(Q)" ] || echo 'CC $<'
$(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $<
diff --git a/NEWS b/NEWS
index a93fb2e3..8a400d6f 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,10 @@
- The obsolete gettimeofday() function has been replaced
by clock_gettime() on systems which support it.
- Speed and usability improvements for para_gui.
+ - para_client now restores the fd flags of stdin and stdout
+ on shutdown.
+ - Performance improvements for the compress filter.
+ - Improved downloads web page.
-----------------------------------------
0.4.12 (2012-12-20) "volatile relativity"
diff --git a/afs.cmd b/afs.cmd
index f0bd26f1..82b6dc48 100644
--- a/afs.cmd
+++ b/afs.cmd
@@ -210,7 +210,7 @@ H: normalize the volume of the audio file. A value of zero means
H: no amplification, 64 means the amplitude should be multiplied
H: by a factor of two, 128 by three and so on.
H:
-H: This value is used by the compress filter.
+H: This value is used by the amp filter.
H:
H: -v Verbose mode. Explain what is being done.
H:
diff --git a/compress_filter.c b/compress_filter.c
index d7162791..f591123a 100644
--- a/compress_filter.c
+++ b/compress_filter.c
@@ -74,18 +74,23 @@ next_buffer:
op = para_malloc(length);
for (i = 0; i < length / 2; i++) {
/* be careful in that heat, my dear */
- int sample = *ip++, adjusted_sample = (PARA_ABS(sample) *
- pcd->current_gain) >> gain_shift;
- if (adjusted_sample > 32767) { /* clip */
- PARA_NOTICE_LOG("clip: sample: %d, adjusted sample: %d\n",
- sample, adjusted_sample);
- adjusted_sample = 32767;
+ int sample = *ip++;
+ bool neg = false;
+
+ if (sample < 0) {
+ sample = -sample;
+ neg = true;
+ }
+ sample *= pcd->current_gain;
+ sample >>= gain_shift;
+ if (sample > 32767) { /* clip */
+ sample = 32767;
pcd->current_gain = (3 * pcd->current_gain +
(1 << pcd->conf->inertia_arg)) / 4;
pcd->peak = 0;
- } else
- pcd->peak = PARA_MAX(pcd->peak, adjusted_sample);
- op[i] = sample >= 0? adjusted_sample : -adjusted_sample;
+ } else if (sample > pcd->peak)
+ pcd->peak = sample;
+ op[i] = neg? -sample : sample;
if (++pcd->num_samples & mask)
continue;
// PARA_DEBUG_LOG("gain: %u, peak: %u\n", pcd->current_gain,
diff --git a/gui.c b/gui.c
index 096beb93..0361347e 100644
--- a/gui.c
+++ b/gui.c
@@ -293,7 +293,7 @@ static char *configfile_exists(void)
static void add_spaces(WINDOW* win, unsigned int num)
{
char space[] = " ";
- unsigned sz = sizeof(space);
+ unsigned sz = sizeof(space) - 1; /* number of spaces */
while (num >= sz) {
waddstr(win, space);
diff --git a/oss_mix.c b/oss_mix.c
index 9fe86504..5182ad23 100644
--- a/oss_mix.c
+++ b/oss_mix.c
@@ -56,8 +56,10 @@ static int oss_mix_open(const char *dev, struct mixer_handle **handle)
dev = "/dev/mixer";
PARA_INFO_LOG("opening %s\n", dev);
ret = para_open(dev, O_RDWR, 42);
- if (ret < 0)
+ if (ret < 0) {
+ PARA_ERROR_LOG("could not open %s\n", dev);
return ret;
+ }
h = para_malloc(sizeof(*h));
h->fd = ret;
*handle = h;
diff --git a/stdin.c b/stdin.c
index b25a0ba0..20b9250e 100644
--- a/stdin.c
+++ b/stdin.c
@@ -69,6 +69,12 @@ static int stdin_post_select(struct sched *s, struct task *t)
sz = btr_pool_get_buffer(sit->btrp, &buf);
if (sz == 0)
return 0;
+ if (sit->must_set_nonblock_flag) {
+ ret = mark_fd_nonblocking(STDIN_FILENO);
+ if (ret < 0)
+ goto err;
+ sit->must_set_nonblock_flag = false;
+ }
/*
* Do not use the maximal size to avoid having only a single buffer
* reference for the whole pool. This is bad because if that single
@@ -82,6 +88,8 @@ static int stdin_post_select(struct sched *s, struct task *t)
return 0;
err:
btr_remove_node(&sit->btrn);
+ /* Revert to blocking mode if necessary. */
+ fcntl(STDIN_FILENO, F_SETFL, sit->fd_flags);
//btr_pool_free(sit->btrp);
return ret;
}
@@ -92,8 +100,7 @@ err:
* \param sit The stdin task structure.
*
* This fills in the pre/post select function pointers of the task structure
- * given by \a sit. Moreover, the stdin file desctiptor is set to nonblocking
- * mode, and a buffer tree is created.
+ * given by \a sit and creates a buffer tree for I/O.
*/
void stdin_set_defaults(struct stdin_task *sit)
{
@@ -103,9 +110,18 @@ void stdin_set_defaults(struct stdin_task *sit)
sit->task.post_select = stdin_post_select;
sit->btrp = btr_pool_new("stdin", 128 * 1024);
sprintf(sit->task.status, "stdin reader");
- ret = mark_fd_nonblocking(STDIN_FILENO);
- if (ret >= 0)
- return;
- PARA_EMERG_LOG("%s\n", para_strerror(-ret));
- exit(EXIT_FAILURE);
+ /*
+ * Both STDIN_FILENO and STDOUT_FILENO may refer to the same open file
+ * description (the terminal), and thus share the same file status
+ * flags. In order to not interfere with the stdout task, we only get
+ * the file status flags for STDIN here and save a copy. The nonblock
+ * flag is set later on the first read.
+ */
+ ret = fcntl(STDIN_FILENO, F_GETFL);
+ if (ret < 0) {
+ PARA_EMERG_LOG("F_GETFL: %s\n", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ sit->fd_flags = ret;
+ sit->must_set_nonblock_flag = (sit->fd_flags & O_NONBLOCK) == 0;
}
diff --git a/stdin.h b/stdin.h
index 54710ae5..cdf0c67f 100644
--- a/stdin.h
+++ b/stdin.h
@@ -14,6 +14,10 @@ struct stdin_task {
struct btr_node *btrn;
/** Use a buffer pool to minimize memcpy due to alignment problems. */
struct btr_pool *btrp;
+ /** The descriptor flags of STDIN at startup. */
+ int fd_flags;
+ /** Whether we have to set STDIN to nonblocking mode. */
+ bool must_set_nonblock_flag;
};
void stdin_set_defaults(struct stdin_task *sit);
diff --git a/stdout.c b/stdout.c
index abf3d06f..cf33bf6d 100644
--- a/stdout.c
+++ b/stdout.c
@@ -62,6 +62,12 @@ static int stdout_post_select(struct sched *s, struct task *t)
if (!FD_ISSET(STDOUT_FILENO, &s->wfds))
return 0;
+ if (sot->must_set_nonblock_flag) {
+ ret = mark_fd_nonblocking(STDOUT_FILENO);
+ if (ret < 0)
+ goto out;
+ sot->must_set_nonblock_flag = false;
+ }
for (;;) {
sz = btr_next_buffer(btrn, &buf);
if (sz == 0)
@@ -72,8 +78,11 @@ static int stdout_post_select(struct sched *s, struct task *t)
btr_consume(btrn, ret);
}
out:
- if (ret < 0)
+ if (ret < 0) {
btr_remove_node(&sot->btrn);
+ /* Revert to blocking mode if necessary. */
+ fcntl(STDOUT_FILENO, F_SETFL, sot->fd_flags);
+ }
return ret;
}
/**
@@ -82,7 +91,7 @@ out:
* \param sot The stdout task structure.
*
* This fills in the pre/post select function pointers of the task structure
- * given by \a sot and sets the stdout file descriptor to nonblocking mode.
+ * given by \a sot.
*/
void stdout_set_defaults(struct stdout_task *sot)
{
@@ -91,9 +100,13 @@ void stdout_set_defaults(struct stdout_task *sot)
sot->task.pre_select = stdout_pre_select;
sot->task.post_select = stdout_post_select;
sprintf(sot->task.status, "stdout");
- ret = mark_fd_nonblocking(STDOUT_FILENO);
- if (ret >= 0)
- return;
- PARA_EMERG_LOG("%s\n", para_strerror(-ret));
- exit(EXIT_FAILURE);
+
+ /* See stdin.c for details. */
+ ret = fcntl(STDOUT_FILENO, F_GETFL);
+ if (ret < 0) {
+ PARA_EMERG_LOG("F_GETFL: %s\n", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ sot->fd_flags = ret;
+ sot->must_set_nonblock_flag = (sot->fd_flags & O_NONBLOCK) == 0;
}
diff --git a/stdout.h b/stdout.h
index cc1f2626..a21b7ced 100644
--- a/stdout.h
+++ b/stdout.h
@@ -16,6 +16,10 @@ struct stdout_task {
struct task task;
/** Stdout is always a leaf node in the buffer tree. */
struct btr_node *btrn;
+ /** The descriptor flags of STDOUT at startup. */
+ int fd_flags;
+ /** Whether we have to set STDOUT to nonblocking mode. */
+ bool must_set_nonblock_flag;
};
void stdout_set_defaults(struct stdout_task *sot);
diff --git a/web/download.in.html b/web/download.in.html
index 563b61af..393fce93 100644
--- a/web/download.in.html
+++ b/web/download.in.html
@@ -1,13 +1,73 @@
Download
- Clone the git repository by executing
+Paraslash is only available as source code, no binary packages are
+provided at this point. There are several ways to download the source:
- git clone git://paraslash.systemlinux.org/git paraslash
+
+ - git.
-
Or grab the tarball
-of the current master branch, or download the latest version from the
-download directory. All regular releases are
-cryptographically signed. Since development
-takes place in separate topic branches the master branch is expected
-to be more stable than any of the released versions.
+ Clone the git repository by executing
+
+
git clone git://paraslash.systemlinux.org/git paraslash
+
+ The repository contains the full history of the
+ project since 2006, all work in progress and the source
+ code for the web pages. Choosing this option allows to
+ check out any of the four integration branches maint,
+ master, next, pu (see the
+
+ git_branches
+
+ section of the manual). All previous releases
+ correspond to tagged commits and may be checked out
+ as well. Since development takes place in separate
+ topic branches the master branch is expected to be
+ more stable than any of the released versions.
+
+ Compiling from git requires additional tools,
+ notably the autoconf package must be installed.
+
+
+
+ regular releases.
+
+ All released versions can be downloaded as compressed
+ tarballs from the
+
+ download directory.
+
+ These tarballs are
+
+ cryptographically signed
+
+ and contain a pre-generated configure script. They
+ can be compiled and installed without autoconf.
+
+
+
+ master tarballs.
+
+ Whenever significant changes are incorporated a
+
+ tarball
+
+ of the current master branch is created. All changes in
+ this tarball will be included in the next release. Like
+ for regular releases, a configure script is provided
+ for convenience.
+
+
+
+ gitweb snapshots.
+
+ The
+
+ gitweb
+
+ page contains a snapshot link for each revision. This
+ allows to get a specific revision without downloading
+ the full history.
+
+
+