]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 't/interactive'
authorAndre Noll <maan@systemlinux.org>
Sat, 22 Jun 2013 13:58:29 +0000 (15:58 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 22 Jun 2013 13:58:29 +0000 (15:58 +0200)
Was cooking for almost two weeks.

f8931d Simplify i9e_line_handler.
f99dbe i9e: Fix a prompt display issue
cf39e4 audioc: Abstract out connection code.

Makefile.in
NEWS
afs.cmd
compress_filter.c
gui.c
oss_mix.c
stdin.c
stdin.h
stdout.c
stdout.h
web/download.in.html

index f3dfea0065c31a564156000d0b1842eedc24e6c7..698599e5fcc4522ce54d1c2ba70d5080b30755a8 100644 (file)
@@ -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 a93fb2e3315839de57daef32cf5166cd3852579c..8a400d6fc19f78efb25f047f5f1a1f5d8ec35953 100644 (file)
--- 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 f0bd26f1a1bef059126b362478526081e68e3743..82b6dc485cd00683b58a4ec79bd1e69c5602690f 100644 (file)
--- 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:
index d7162791b86d372562f690b464779b250519cbeb..f591123aeeb73f3e6c5f2c1234450645e974c2c3 100644 (file)
@@ -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 096beb93bfd82f91a68c454779edaa6c59e8a565..0361347e54375b18165a16f7d8dc747499561a6b 100644 (file)
--- 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);
index 9fe865045a8e96006813d48b4dc0ff59164dd460..5182ad238b81f706ebac2f6abdcaec3859b809dc 100644 (file)
--- 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 b25a0ba013fb03b19cb757d07ff483c9389a0d70..20b9250e9b7fbf3c252e20dff8891bfeeb5112dd 100644 (file)
--- 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 54710ae561105bd7ad0ce907cf078d58d49a80f1..cdf0c67fd57a1078f38a9f175d598adf65ece520 100644 (file)
--- 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);
index abf3d06f17a64249671ffbfb0470aa995a599578..cf33bf6d0b67cf49625d27b4d602dec35922d32d 100644 (file)
--- 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;
 }
index cc1f2626db049232601375688c8206ba24486177..a21b7cedfb699d9402f666a1a754a26d12cdcec1 100644 (file)
--- 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);
index 563b61af5586402880d252cddcff5df1ebb4ce57..393fce9352d65a48f751735b886f5f57473dbfe3 100644 (file)
@@ -1,13 +1,73 @@
 <h1>Download</h1>
 <hr>
 
-<p> Clone the git repository by executing </p>
+Paraslash is only available as source code, no binary packages are
+provided at this point. There are several ways to download the source:
 
-<p> <b> git clone git://paraslash.systemlinux.org/git paraslash </b> </p>
+<ul>
+       <li> <em> git</em>.
 
-<p> Or grab the <a href="releases/paraslash-git.tar.bz2">tarball</a>
-of the current master branch, or download the latest version from the
-<a href="releases/">download directory</a>. All regular releases are
-<a href="PUBLIC_KEY">cryptographically signed</a>. Since development
-takes place in separate topic branches the master branch is expected
-to be more stable than any of the released versions. </p>
+               Clone the git repository by executing
+
+               <p> <pre> <kbd> git clone git://paraslash.systemlinux.org/git paraslash </kbd> </pre> </p>
+
+               <p> 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
+
+               <a href="manual.html#git_branches">git_branches</a>
+
+               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. </p>
+
+               <p> Compiling from git requires additional tools,
+               notably the autoconf package must be installed. </p>
+
+       </li>
+
+       <li> <em> regular releases</em>.
+
+               All released versions can be downloaded as compressed
+               tarballs from the
+
+               <a href="releases/">download directory</a>.
+
+               These tarballs are
+
+               <a href="PUBLIC_KEY">cryptographically signed</a>
+
+               and contain a pre-generated configure script. They
+               can be compiled and installed without autoconf.
+
+       </li>
+
+       <li> <em>master tarballs</em>.
+
+               Whenever significant changes are incorporated a
+
+               <a href="releases/paraslash-git.tar.bz2">tarball</a>
+
+               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.
+
+       </li>
+
+       <li> <em>gitweb snapshots</em>.
+
+               The
+
+                       <a href="/gitweb/gitweb.cgi?p=.git;a=summary">gitweb</a>
+
+               page contains a snapshot link for each revision. This
+               allows to get a specific revision without downloading
+               the full history.
+
+       </li>
+</ul>