Merge ../paraslash.fml/paraslash
authorAndre <maan@meins.(none)>
Tue, 10 Oct 2006 17:53:31 +0000 (19:53 +0200)
committerAndre <maan@meins.(none)>
Tue, 10 Oct 2006 17:53:31 +0000 (19:53 +0200)
Makefile.in
http_send.c
net.c
osx_write.c
scripts/demo-script [deleted file]
server.c
web/demo.in.html

index 4ac0de935090977b2e14dddde937cce9abc46d7f..e5e8a4428e4a67115c735266ddaeb7aa6b6431fb 100644 (file)
@@ -73,7 +73,7 @@ shots += para_krell-2005-02.png para_server-startup.txt
 shots += para_slider-2004-12.png sdl_gui.jpg para_krell-2005-02.png
 shots := $(patsubst %,web/sync/%,$(shots))
 web_pics := web/sync/paraslash.png web/sync/paraslash.ico
-web_misc := demo-script overview.pdf versions/paraslash-git.tar.bz2 PUBLIC_KEY key.anonymous para.css doc
+web_misc := overview.pdf versions/paraslash-git.tar.bz2 PUBLIC_KEY key.anonymous para.css doc
 web_misc := $(patsubst %,web/sync/%,$(web_misc))
 
 autocrap := config.h.in configure
@@ -286,8 +286,6 @@ web/sync/%.png: pics/web/%.png web/sync
        cp $< $@
 web/sync/%.ico: pics/web/%.ico web/sync
        cp $< $@
-web/sync/demo-script: scripts/demo-script web/sync
-       cp $< $@
 web/sync/para.css: web/para.css web/sync
        cp $< $@
 web/sync/versions/paraslash-git.tar.bz2: paraslash-git.tar.bz2 web/sync
index 111c49baf82aa58e9bb9172ad0a8deb86b9ee571..1d970a5df561a3395effa19abf0960a70af9c3ef 100644 (file)
@@ -371,12 +371,19 @@ static void http_pre_select(int *max_fileno, fd_set *rfds, fd_set *wfds)
 
 static int open_tcp_port(int port)
 {
+       int ret;
+
        server_fd = init_tcp_socket(port);
        if (server_fd < 0) {
                http_shutdown_clients();
                self->status = SENDER_OFF;
                return server_fd;
        }
+       ret = mark_fd_nonblock(server_fd);
+       if (ret < 0) {
+               PARA_EMERG_LOG("%s\n", PARA_STRERROR(-ret));
+               exit(EXIT_FAILURE);
+       }
        self->status = SENDER_ON;
        add_close_on_fork_list(server_fd);
        return 1;
diff --git a/net.c b/net.c
index e7c7724b4143e33ac7fbd7d79ba8ee1c5fd38bdf..0105ef6902114ae108da577186c1d58d8e52c0fb 100644 (file)
--- a/net.c
+++ b/net.c
@@ -135,7 +135,7 @@ static int sendall(int fd, const char *buf, size_t *len)
  * @param buf the buffer to be encrypted and sent
  * @param len the length of \a buf
  *
- * Check if encrytion is available. If yes, encrypt the given buffer.  Send out
+ * Check if encrytpion is available. If yes, encrypt the given buffer.  Send out
  * the buffer, encrypted or not, and try to resend the remaing part in case of
  * short writes.
  *
@@ -201,7 +201,7 @@ __printf_2_3 int send_va_buffer(int fd, const char *fmt, ...)
  * @param buf the buffer to write the decrypted data to
  * @param size the size of @param buf
  *
- * Receive at most \a size bytes from filedescriptor fd. If encrytion is
+ * Receive at most \a size bytes from filedescriptor fd. If encryption is
  * available, decrypt the received buffer.
  *
  * @return the number of bytes received on success. On receive errors, -E_RECV
index 4d0bfbdf4f4f9aa300364aa3d53dcee40bb8ba14..f2e5c485e52dada412c0e2c8e7b6bc3971720b7b 100644 (file)
@@ -52,13 +52,19 @@ struct osx_buffer {
        struct osx_buffer *next;
 };
 
+/** data specific to the osx writer */
 struct private_osx_write_data {
-       long size;
-       AudioUnit output;
+       /** the main control structure for audio data manipulation */
+       AudioUnit audio_unit;
+       /** non-zero if playback has started */
        char play;
-       struct osx_buffer *from; /* Current buffers */
+       /** callback reads audio data from this buffer */
+       struct osx_buffer *from;
+       /* the post_select writes audio data here */
        struct osx_buffer *to;
+       /** sample rate of the current audio stream */
        unsigned samplerate;
+       /** number of channels of the current audio stream */
        unsigned channels;
 };
 
@@ -186,12 +192,11 @@ static int osx_write_open(struct writer_node *wn)
        if (!comp)
                goto e0;
        ret = -E_OPEN_COMP;
-       if (OpenAComponent(comp, &powd->output))
+       if (OpenAComponent(comp, &powd->audio_unit))
                goto e0;
        ret = -E_UNIT_INIT;
-       if (AudioUnitInitialize(powd->output))
+       if (AudioUnitInitialize(powd->audio_unit))
                goto e1;
-       powd->size = 0;
        powd->play = 0;
        /* Hmmm, let's choose PCM format */
        /* We tell the Output Unit what format we're going to supply data to it.
@@ -221,13 +226,13 @@ static int osx_write_open(struct writer_node *wn)
        /* one of the most constant constants of the whole computer history */
        format.mBitsPerChannel = sizeof(float) * 8;
        ret = -E_STREAM_FORMAT;
-       if (AudioUnitSetProperty(powd->output, kAudioUnitProperty_StreamFormat,
+       if (AudioUnitSetProperty(powd->audio_unit, kAudioUnitProperty_StreamFormat,
                        kAudioUnitScope_Input, 0, &format,
                        sizeof(AudioStreamBasicDescription)))
                goto e2;
        init_buffers(wn);
        ret = -E_ADD_CALLBACK;
-       if (AudioUnitSetProperty(powd->output, kAudioUnitProperty_SetRenderCallback,
+       if (AudioUnitSetProperty(powd->audio_unit, kAudioUnitProperty_SetRenderCallback,
                        kAudioUnitScope_Input, 0, &inputCallback,
                        sizeof(inputCallback)) < 0)
                goto e3;
@@ -235,9 +240,9 @@ static int osx_write_open(struct writer_node *wn)
 e3:
        destroy_buffers(powd);
 e2:
-       AudioUnitUninitialize(powd->output);
+       AudioUnitUninitialize(powd->audio_unit);
 e1:
-       CloseComponent(powd->output);
+       CloseComponent(powd->audio_unit);
 e0:
        return ret;
 }
@@ -262,9 +267,9 @@ static void osx_write_close(struct writer_node *wn)
        struct private_osx_write_data *powd = wn->private_data;
 
        PARA_INFO_LOG("closing writer node %p\n", wn);
-       AudioOutputUnitStop(powd->output);
-       AudioUnitUninitialize(powd->output);
-       CloseComponent(powd->output);
+       AudioOutputUnitStop(powd->audio_unit);
+       AudioUnitUninitialize(powd->audio_unit);
+       CloseComponent(powd->audio_unit);
        destroy_buffers(powd);
        free(powd);
 }
@@ -294,7 +299,7 @@ static int osx_write_post_select(__a_unused struct sched *s,
        powd->to = powd->to->next;
        wn->written = *wng->loaded;
        if (!powd->play) {
-               if (AudioOutputUnitStart(powd->output))
+               if (AudioOutputUnitStart(powd->audio_unit))
                        return -E_UNIT_START;
                powd->play = 1;
        }
@@ -328,6 +333,7 @@ min_delay:
        return 1;
 }
 
+/** the init function of the osx writer */
 void osx_write_init(struct writer *w)
 {
        w->open = osx_write_open;
diff --git a/scripts/demo-script b/scripts/demo-script
deleted file mode 100755 (executable)
index a6e29fc..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/bash
-
-bin="para_client para_audioc para_audiod para_gui" # the binaries we need
-log="`pwd`/demo-log.$$.log"
-dir="$HOME/.paraslash"
-client_conf="$dir/client.conf"
-audioc_conf="$dir/audioc.conf"
-server=www.paraslash.org
-proj=paraslash-0.2.13
-df=$proj.tar.bz2 # download file
-url=http://$server/versions/$df
-kf="$dir/key.anonymous" # key file
-key_url=http://$server/key.anonymous
-socket="$dir/socket"
-receiver_opts="mp3:http -i $server -p 8009"
-audiod_log="$dir/audiod.log"
-audiod_opts="-FDd -L $audiod_log -s $socket"
-msg()
-{
-       echo "`date`: $1"
-}
-
-go()
-{
-       msg "downloading $df"
-       wget -N -q $url || return 1
-       msg "decompressing"
-       rm -rf $proj; tar xjf $df
-       cd $proj || return 1
-       msg "configuring (be patient, ignore warnings but not errors)"
-       ./configure --prefix "$HOME" >> "$log"
-       msg "building $bin"
-       make $bin >> "$log"
-       msg "installing"
-       mkdir -p $HOME/bin && install -c -s -m 755 $bin $HOME/bin || return 1
-       export PATH=$HOME/bin:$PATH
-       msg "retrieving anonymous key"
-       mkdir -p $dir || return 1
-       wget -q --directory-prefix=$dir $key_url || return 1
-       msg "writing $client_conf"
-       cat << EOF > "$client_conf"
-               user "anonymous"
-               hostname "$server"
-               key_file "$kf"
-EOF
-       msg "writing $audioc_conf"
-       echo "socket \"$socket\"" > "$audioc_conf"
-       (para_audioc term; killall para_audiod para_client) >> "$log" 2>&1
-       msg "para_audiod $audiod_opts -r '$receiver_opts'"
-       para_audiod $audiod_opts -r "$receiver_opts" -w "mp3:mpg123 -"
-       echo "hit return to start para_gui, hit ctrl+c to abort"
-       read
-       para_gui
-}
-
-go
index c7e681264cddcd3fe7223b2492485be97869f4cc..9688c6ccf2cb4ac29723b0a8dd6f40627c16d934 100644 (file)
--- a/server.c
+++ b/server.c
@@ -302,11 +302,18 @@ random:
 
 static unsigned init_network(void)
 {
-       int sockfd = init_tcp_socket(conf.port_arg);
+       int fd, ret = init_tcp_socket(conf.port_arg);
 
-       if (sockfd < 0)
-               exit(EXIT_FAILURE);
-       return sockfd;
+       if (ret < 0)
+               goto err;
+       fd = ret;
+       ret = mark_fd_nonblock(fd);
+       if (ret < 0)
+               goto err;
+       return fd;
+err:
+       PARA_EMERG_LOG("%s\n", PARA_STRERROR(-ret));
+       exit(EXIT_FAILURE);
 }
 
 static void init_random_seed(void)
index 17ab21a89affce7e17c3a92886a0d05cfa578ea4..1306c3c232081d2f93bcead55b6e11b04cae5861 100644 (file)
@@ -8,22 +8,45 @@ streaming
 
 
 You can listen to the stream with any mp3 player that supports
-http streaming. Both </p>
+http streaming.</p>
 
        <p>mpg123 -Z http://www.paraslash.org:8009/</p>
 
-and
 
        <p>xmms http://www.paraslash.org:8009/</p>
 
-<p> are known to work.</p>
-
-<p> Moreover, there is an anonymous paraslash account
-available which you can use to have a look at paraslash
-without configuring and running para_server on your own box.
-Just download and run
-
-       <a href="demo-script">this shell script</a>
-
-on your Unix system.  No root-privileges are required.</p>
-
+<p>and iTunes are known to work.</p>
+
+<p> Moreover, there is an anonymous paraslash account available which you can
+use to have a look at paraslash without configuring and running para_server on
+your own box. There's no need to install the paraslash package and no
+root-privileges are required for the demo. </p>
+
+<p>Download the
+
+       <a href="key.anonymous">public key</a>
+
+for the anonymous user and the latest paraslash
+
+       <a href="versions">tarball</a>
+or the
+       <a href="versions/paraslash-git.tar.bz2">current snapshot</a>.
+
+Next, compile para_audiod (./configure && make para_audiod) and use the
+following configuration options:</p>
+<ul>
+       <li> ~/.paraslash/client.conf:
+       <ul>
+               <li>user anonymous</li>
+               <li>hostname www.paraslash.org</li>
+               <li>key_file key.anonymous</li>
+       </ul>
+       <li> ~/.paraslash/audiod.conf:</li>
+       <ul>
+               <li>receiver "mp3:http -i www.paraslash.org -p 8009"</li>
+               <li>loglevel 1</li>
+       </ul>
+</ul>
+<p>Finally, type "./para_audiod" to start streaming. If this works, try out
+para_client, para_gui and para_audioc. Otherwise, use para_recv, para_filter
+and para_write to find out why.</p>