paraslash.git
11 years agoMerge branch 't/mood_fix'
Andre Noll [Tue, 26 Mar 2013 00:07:08 +0000 (00:07 +0000)]
Merge branch 't/mood_fix'

11 years agoChange copyright year to 2013.
Andre Noll [Sun, 24 Mar 2013 18:00:05 +0000 (18:00 +0000)]
Change copyright year to 2013.

Better late than never.

11 years agoafs.c: Fix some spelling mistakes in comments.
Andre Noll [Tue, 1 Jan 2013 16:30:58 +0000 (16:30 +0000)]
afs.c: Fix some spelling mistakes in comments.

11 years agoImprove documentation of readv_nonblock().
Andre Noll [Mon, 18 Mar 2013 19:22:31 +0000 (20:22 +0100)]
Improve documentation of readv_nonblock().

Define the meaning of "sz".

11 years agoFix mood reload.
Andre Noll [Sun, 27 Jan 2013 18:12:57 +0000 (19:12 +0100)]
Fix mood reload.

There was some confusion about how to determine whether the dummy mode
is currently active. At some places we tested if current_mood is NULL,
at others if current_mood->name is NULL. In fact neither check works:

* if a playlist is open, current_mood is NULL (but the dummy
mood is not loaded),

* loading the dummy mood currently sets current_mood->name to
"(dummy)".

This patch makes the latter variant the official one and fixes up
the code accordingly.

This also fixes the critical log message

Jan 27 18:57:29 (5) (13487) afs_event: table moods, event 9: key not found in rbtree

which occured if the dummy mood was active while an event caused the
mood to be reloaded.

11 years agoafs: Add assertion to afs_cb_result_handler().
Andre Noll [Tue, 1 Jan 2013 23:20:04 +0000 (23:20 +0000)]
afs: Add assertion to afs_cb_result_handler().

If cc is NULL we always have a bug, so it's OK to dereference this
pointer unconditionally. However, if the command handler crashes
due to cc being NULL, it is not obvious what has happened, so make
this explicit.

11 years agoclient: Don't print the same error message twice.
Andre Noll [Mon, 23 Jul 2012 17:03:48 +0000 (19:03 +0200)]
client: Don't print the same error message twice.

Currently, if the client task exits, the corresponding error
message is printed both by client_post_select() and by main()
of client.c.

This patch makes main() print a generic "command failed" error
message instead.

11 years agotrivial: Fix typo in client.h.
Andre Noll [Mon, 23 Jul 2012 19:51:03 +0000 (21:51 +0200)]
trivial: Fix typo in client.h.

11 years agosignal: Restore errno on exit from signal handler.
Andre Noll [Sat, 9 Feb 2013 18:29:14 +0000 (19:29 +0100)]
signal: Restore errno on exit from signal handler.

This probably is not necessary since generic_signal_handler() calls
exit(3) if the write to the signal pipe fails. However, nobody is
going to stop write(2) from setting errno also on success, so let's
play safe and always restore its value on exit.

11 years agoSpeed up dep target.
Andre Noll [Mon, 31 Dec 2012 00:10:50 +0000 (00:10 +0000)]
Speed up dep target.

By default "make" removes intermediate files during the build. However,
some of the files generated by gengetopt are needed again later for
a different target.

This patch declares these generated files as "precious", so they
will no longer be removed. On one system the build time went down
from 30s to 25s due to this one-liner.

11 years agodepend.sh: Fix two typos in comment.
Andre Noll [Sun, 30 Dec 2012 14:08:37 +0000 (14:08 +0000)]
depend.sh: Fix two typos in comment.

11 years agonew codename, reset version to git
Andre Noll [Thu, 20 Dec 2012 12:42:19 +0000 (13:42 +0100)]
new codename, reset version to git

11 years agoparaslash 0.4.12 v0.4.12
Andre Noll [Thu, 20 Dec 2012 12:27:14 +0000 (13:27 +0100)]
paraslash 0.4.12

11 years agoFix 'install' target.
Andre Noll [Thu, 20 Dec 2012 12:16:17 +0000 (13:16 +0100)]
Fix 'install' target.

This broke in commit 7024574d, where the AC_SUBST() was moved above
the AC_PROG_INSTALL on which it depends.  This resulted in an empty
$install_sh variable, breaking 'make install'.

Fix this bug by moving the AC_SUBST() below AC_PROG_INSTALL.

11 years agoNEWS update.
Andre Noll [Wed, 19 Dec 2012 19:56:45 +0000 (20:56 +0100)]
NEWS update.

11 years agoFix compilation MacOS.
Andre Noll [Mon, 17 Dec 2012 15:49:48 +0000 (16:49 +0100)]
Fix compilation MacOS.

The resolution of the conflict in commit 83ab4b5d introduced the
following error:

osx_write.c:329:9: error: use of undeclared label 'remove_btrn'
                        goto remove_btrn;
                             ^
Fix is trivial.

11 years agoMerge branch 't/resample'
Andre Noll [Sun, 16 Dec 2012 23:09:22 +0000 (00:09 +0100)]
Merge branch 't/resample'

Was cooking for quite some time. The merge conflicted slightly,
but this was easy to fix.

However, even with the conflict resolved, the merged tree would not
compile because after the merge para_play depends on libsamplerate,
but this dependency was not encoded in configure.ac.

There was no way to fix this issue in either of the two branches
involved without rewriting history: The recently merged t/afh_receiver
branch (which introduced para_play) had no idea of libsamplerate
while t/resample has no idea of para_play.

This merge commit fixes both issues.

0eb69b resample filter: Implementation.
cad284 resample filter: Infrastructure.
37e0df check_wav: Ask parent nodes before falling back to defaults.
216399 Replace check_wav_task by write_task.
1af65c Move wav detection code to a separate file.
d5dc1c write: Make wav-related config options modular.
c25d04 para_filter: Call proper ->free_config method on shutdown.

Conflicts:
m4/gengetopt/makefile

11 years agoDo the RC4_ALIGN dance also for sideband connections.
Andre Noll [Mon, 12 Nov 2012 14:15:43 +0000 (15:15 +0100)]
Do the RC4_ALIGN dance also for sideband connections.

In commit 1199398 (March 2011) sc_send_bin_buffer() and
sc_recv_bin_buffer() received a fix for invalid reads/writes in
RC4(). The same fix is needed also for sc_crypt(), which was introduced
later in 2830b9f8 as part of the sideband API.

Without the fix, valgrind complains like this:

==14435== Invalid read of size 8
==14435==    at 0x510A03A: RC4 (in /ebio/maan/arch/Linux_x86_64/lib/libcrypto.so.0.9.8)
==14435==    by 0x40937E: sc_crypt (crypt.c:333)
==14435==    by 0x407233: sb_received (sideband.c:249)
==14435==    by 0x40770F: recv_sb (client_common.c:215)
==14435==    by 0x407FF3: client_post_select (client_common.c:427)
==14435==    by 0x406BE8: schedule (sched.c:70)
==14435==    by 0x404AE7: execute_client_command (client.c:115)
==14435==    by 0x404B77: extract_matches_from_command (client.c:133)
==14435==    by 0x404C16: generic_blob_complete (client.c:163)
==14435==    by 0x404E13: complete_lsblob (client.c:181)
==14435==    by 0x409AB0: create_matches (interactive.c:100)
==14435==    by 0x409BD0: completion_generator (interactive.c:134)
==14435==  Address 0x608bfd0 is 0 bytes inside a block of size 6 alloc'd
==14435==    at 0x4C274A8: malloc (vg_replace_malloc.c:236)
==14435==    by 0x405E64: para_malloc (string.c:65)
==14435==    by 0x40935E: sc_crypt (crypt.c:330)
==14435==    by 0x407233: sb_received (sideband.c:249)
==14435==    by 0x40770F: recv_sb (client_common.c:215)
==14435==    by 0x407FF3: client_post_select (client_common.c:427)
==14435==    by 0x406BE8: schedule (sched.c:70)
==14435==    by 0x404AE7: execute_client_command (client.c:115)
==14435==    by 0x404B77: extract_matches_from_command (client.c:133)
==14435==    by 0x404C16: generic_blob_complete (client.c:163)
==14435==    by 0x404E13: complete_lsblob (client.c:181)
==14435==    by 0x409AB0: create_matches (interactive.c:100)

See also 54cf5827.

11 years agoclient: Fix double free bug in interactive mode.
Andre Noll [Mon, 12 Nov 2012 12:52:50 +0000 (13:52 +0100)]
client: Fix double free bug in interactive mode.

This can easily be reproduced: Enter "select" and type "<tab>" twice
to complete on all moods and playlists, then hit enter to trigger
the bug. On newer glibc-based systems para_client aborts due to the
double free, and valgrind outputs the following:

==10084== Invalid read of size 4
==10084==    at 0x804CA24: free_argv (string.c:813)
==10084==    by 0x804E86A: client_disconnect (client_common.c:46)
==10084==    by 0x804BF24: client_i9e_line_handler (client.c:448)
==10084==    by 0x8050140: i9e_line_handler (interactive.c:245)
==10084==    by 0x428DCF8: rl_callback_read_char (callback.c:217)
==10084==    by 0x8050264: i9e_post_select (interactive.c:265)
==10084==    by 0x804D183: schedule (sched.c:70)
==10084==    by 0x804A0C2: main (client.c:502)
==10084==  Address 0x452a928 is 0 bytes inside a block of size 8 free'd
==10084==    at 0x4028BDC: free (vg_replace_malloc.c:446)
==10084==    by 0x804E86A: client_disconnect (client_common.c:46)
==10084==    by 0x804B6B8: execute_client_command (client.c:118)
==10084==    by 0x804BA5E: select_completer (client.c:387)
==10084==    by 0x80503BF: create_matches (interactive.c:100)
==10084==    by 0x80504D0: completion_generator (interactive.c:134)
==10084==    by 0x4280B1F: rl_completion_matches (complete.c:1992)
==10084==    by 0x4280BBD: gen_completion_matches (complete.c:1062)
==10084==    by 0x4281539: rl_complete_internal (complete.c:1830)
==10084==    by 0x42819C1: rl_complete (complete.c:401)
==10084==    by 0x4278E9C: _rl_dispatch_subseq (readline.c:774)
==10084==    by 0x427917E: _rl_dispatch (readline.c:724)

The bug happens since we did not set the ->features pointer of
struct client task to NULL after the feature list was freed. The fix
is trivial.

11 years agoMerge branch 't/afh_receiver'
Andre Noll [Sun, 2 Dec 2012 21:23:43 +0000 (22:23 +0100)]
Merge branch 't/afh_receiver'

57d75e play: Fix segfault if decoder is not supported.
98f192 Interactive support depends on curses lib.
3e3d8e para_play, implementation.
d02f88 para_play, infrastructure.
3b2ee2 Make writer nodes honor notifications.
e541d7 interactive: Introduce i9e_print_status_bar().
901f66 interactive: Implement single key mode.
6cb789 interactive: Add producer to struct i9e_client_info.
c31982 Interactive: Introduce i9e_get_error().
be1074 interactive: Fix wipe_bottom_line() on MacOS.
3ba772 interactive: Honor SIGWINCH.
56561c interactive: Honor SIGTERM.
06f33c para_afh: remove streaming mode.
4a30c5 The afh receiver, documentation.
b84e37 The afh receiver, implementation.
618a25 The afh_receiver, infrastructure.
4fa8cb Add execute mechanism to receiver nodes.
7c8931 Introduce afh_get_afhi_txt().
3f1510 audiod: Replace kill_btrn() by task notifications.
5edb8f sched: Replace sched_shutdown() by task_notify_all().
58ce61 sched: Introduce task notifications.
b56199 i9e_attach_to_stdout(): Don't insist on btrn == NULL.
7867cd Interactive: Assorted whitespace/newline fixes.
b654be interactive: kill i9ep->line_handler_running.
77b607 interactive: Do not close stderr in i9e_close().
099ef4 Add missing documentation of send_strerror().

Conflicts:
osx_write.c

11 years agoresample filter: Implementation.
Andre Noll [Sun, 28 Oct 2012 14:10:59 +0000 (15:10 +0100)]
resample filter: Implementation.

The resample filter allows to change the sample rate of a stream on the
fly. All the magic happens within libsamplerate, so the implementation
is quite simple.

However, one tricky thing to consider is how wav headers are treated:
Although the resample filter creates only a single task, it adds
two different nodes to the buffer tree, one for the wav detector and
another one for the resample filter itself.

At startup the generic code of para_filter or para_audiod adds only
the resample filter node, which in turn inserts the wav detector as
its own parent node. This requires to insert a new internal node to
the buffer tree which is currently not supported by the buffer tree
API. It is easy to implement this feature though, so this commit adds
the missing functionality to buffer_tree.c.

11 years agoresample filter: Infrastructure.
Andre Noll [Mon, 8 Oct 2012 21:29:08 +0000 (23:29 +0200)]
resample filter: Infrastructure.

This adds configure command line options and tests for libsamplerate,
and provides a dummy implementation of the resample filter. A simple
m4 file for the configuration options is included as well.

11 years agocheck_wav: Ask parent nodes before falling back to defaults.
Andre Noll [Sun, 28 Oct 2012 14:21:56 +0000 (15:21 +0100)]
check_wav: Ask parent nodes before falling back to defaults.

This instructs the ->execute handler of the check_wav task to ask its
parent nodes for the channel count, sample rate and sample format in
case no wav header was found and no value for the query was given at
the command line. Currently this can never succeed, since the only
parent node of the check_wav task is the stdin task, which has no
clue about these things. However, once check_wav is being used by
the resample filter, one parent might be a decoder which can tell.

This requires to add the new public btr_parent() to buffer_tree.c to
let the check_wav node obtain the node to start the search from.

11 years agoReplace check_wav_task by write_task.
Andre Noll [Sun, 28 Oct 2012 14:03:55 +0000 (15:03 +0100)]
Replace check_wav_task by write_task.

Besides the task(s) associated with the given writer(s), para_write
currently sets up two other tasks: The stdin task and the check_wav
task.

The resample filter, which is to be introduced in subsequent patches,
also needs the functionality that is provided by the check wav task.
However, as filters are not supposed to create their own tasks, there
should not be a dedicated task instance for checking the wav header.

To overcome this problem we move the task member from
check_wav.c to write.c and rename the check_wav_task struct to
check_wav_context. Hence the ->pre_select and ->post_select methods
become part of para_write that call into check_wav.c to do the work.

The patch is quite large but large parts of the changes are just
trivial cwt -> cwc conversions.

11 years agoMove wav detection code to a separate file.
Andre Noll [Sun, 28 Oct 2012 13:01:01 +0000 (14:01 +0100)]
Move wav detection code to a separate file.

The logic to detect a wav header  and delete it from an input stream
is useful also for the upcoming resample filter, so let's make this
code reusable.

The first step for doing so is to remove the relevant parts from
write.c to check_wav.c and exports those functions which are called
from write.c to check_wav.h.

There is one problem though: The wav detector code needs to know
the arguments for the --channels, --sample_rate and --sample_format
options given to para_write, but the code would not be reusable if
check_wav.c depended on the gengetop args info struct of para_write.

Hence we introduce the public structure wav_params in check_wav.h
for this information, which is independent of gengetopt. A simple
convenience helper for copying the command line arguments from an
(arbitrary) args info structure to a struct wav_params is provided
as well.

11 years agowrite: Make wav-related config options modular.
Andre Noll [Sat, 27 Oct 2012 13:36:22 +0000 (15:36 +0200)]
write: Make wav-related config options modular.

The --channels, --sample-rate and --sample-format options will also
be used by the resample filter. This moves these options to separate
files which are included from write.m4. This allows to include them
also from the config file of the resample filter.

11 years agopara_filter: Call proper ->free_config method on shutdown.
Andre Noll [Sun, 11 Nov 2012 09:14:39 +0000 (10:14 +0100)]
para_filter: Call proper ->free_config method on shutdown.

Currently we just free the conf struct. For some filters this not
enough to deallocate all resources and therefore results in a memory
leak.  This leak is not serious though, since it does not affect
para_audiod, and para_filter is about to exit anyway at this point.

Fix it anyway.

11 years agoMerge branch 't/osx_writer_improvements'
Andre Noll [Sun, 25 Nov 2012 13:00:08 +0000 (14:00 +0100)]
Merge branch 't/osx_writer_improvements'

Cooking since 2012-10-30.

9eaa22 osx_write: Check return value of AudioOutputUnitStart().
831db3 osx_write: Be careful when dereferencing the private_data pointer.
97902a osx: Treat writer node as an internal buffer tree node.
1c6fa9 osx_write: Add big fat comment on callback btr node.

11 years agoplay: Fix segfault if decoder is not supported.
Andre Noll [Mon, 19 Nov 2012 21:51:50 +0000 (22:51 +0100)]
play: Fix segfault if decoder is not supported.

When paraslash was build without libmad, para_play still recognizes mp3
files (because the mp3 audio format handler does not require libmad),
but decoding fails of course.

Specifically, the check_filter_arg() call in load_file() fails, but
the error handling code misses to clear the receiver node structure,
which results in a subsequent seqfault due to a double free.

This patch calls wipe_receiver_node() instead of open coding the
cleanup. This fixes the bug and actually simplifies the code a bit.

11 years agoInteractive support depends on curses lib.
Andre Noll [Mon, 19 Nov 2012 21:31:27 +0000 (22:31 +0100)]
Interactive support depends on curses lib.

If libreadline was detected, but no curses lib was found, we currently
try to activate interactive support, and compilation fails.

This patch deactivates interactive support in this case.

11 years agopara_play, implementation.
Andre Noll [Thu, 5 Apr 2012 23:18:23 +0000 (01:18 +0200)]
para_play, implementation.

This replaces the dummy implementation added in the previous commit
by a real implementation.

para_play makes use of all new concepts that have been previously
introduced. In particular, it employs the newly added single key
mode of the i9e subsystem and uses task notifications to shut down
the writer node when the user stops playback.

11 years agopara_play, infrastructure.
Andre Noll [Mon, 25 Jun 2012 23:48:04 +0000 (01:48 +0200)]
para_play, infrastructure.

Now that the preparatory changes to the interactive subsystem
(single key mode, status bar, signal handling) and the writer nodes
(notifications) and receiver nodes (btr exec mechanism) are in place,
we can move on to the para_play executable.

This patch adds only the necessary changes to the build system and
provides a dummy implementation of para_play. The real implementation
will be provided as as a separate patch in the next commit.

11 years agoMake writer nodes honor notifications.
Andre Noll [Mon, 9 Jul 2012 17:44:03 +0000 (19:44 +0200)]
Make writer nodes honor notifications.

Currently, nobody is notifying any writer node but the para_play
executable, which will be introduced in subsequent patches, will use
this facility to terminate the audio stream.

11 years agointeractive: Introduce i9e_print_status_bar().
Andre Noll [Thu, 12 Apr 2012 04:20:42 +0000 (06:20 +0200)]
interactive: Introduce i9e_print_status_bar().

When operating in single key mode, the users of the i9e API
may write a single line, called status bar, to stderr.

This patch adds a new public function to the i9e subsystem for
this purpose. It honors the width of the terminal and shortens
the given status bar string to fit in one line if necessary.

11 years agointeractive: Implement single key mode.
Andre Noll [Sun, 8 Apr 2012 23:27:11 +0000 (01:27 +0200)]
interactive: Implement single key mode.

This changes the i9e subsystem to operate in single key mode while
a command is running as determined by the existence of a buffer tree
node which is attached to the stdout_btrn of i9e.

In single key mode a different readline key map is activated and
single keystrokes are passed to the application via the new key
handler function pointer of struct i9e_client_info.

11 years agointeractive: Add producer to struct i9e_client_info.
Andre Noll [Sun, 8 Apr 2012 22:43:07 +0000 (00:43 +0200)]
interactive: Add producer to struct i9e_client_info.

This enables users of the i9e API to open the i9e subsystem with
a producer already attached to the stdout buffer tree node of the
i9e subsystem.

11 years agoInteractive: Introduce i9e_get_error().
Andre Noll [Wed, 27 Jun 2012 20:32:16 +0000 (22:32 +0200)]
Interactive: Introduce i9e_get_error().

Currently there is no easy way for a paraslash task to find out
whether the i9e task is still up and running. This commit adds the
new public function i9e_get_error() which simply returns the error
state of the i9e task.

11 years agointeractive: Fix wipe_bottom_line() on MacOS.
Andre Noll [Tue, 7 Aug 2012 11:32:44 +0000 (13:32 +0200)]
interactive: Fix wipe_bottom_line() on MacOS.

Once readline has been initialized, writing more than 68 characters in one go
to stderr using stdio causes interesting effects on Mac OS. Specifically, the
terminal is completely messed up. To increase the anticipated weirdness level,
writing the same string in smaller chunks just works fine. This patch adds such
code to interactive.c.

11 years agointeractive: Honor SIGWINCH.
Andre Noll [Mon, 9 Apr 2012 01:02:59 +0000 (03:02 +0200)]
interactive: Honor SIGWINCH.

For the upcoming single key mode of the i9e subsystem, we need to
know the width of the terminal.

This makes this information available to all functions in interactive.c
via the i9e_private structure. The new num_columns variable of this
structure is updated whenever i9e_signal_dispatch() is called with
sig_num equal to SIGWINCH.

11 years agointeractive: Honor SIGTERM.
Andre Noll [Sun, 8 Apr 2012 03:03:52 +0000 (05:03 +0200)]
interactive: Honor SIGTERM.

Currently i9e_signal_dispatch() only looks at SIGINT and ignores all
other signals. We'd like to honor SIGTERM as well because this provides
a handy way for other paraslash tasks to shut down the i9e subsystem,
even if no signal was received.

11 years agopara_afh: remove streaming mode.
Andre Noll [Tue, 23 Aug 2011 14:09:21 +0000 (16:09 +0200)]
para_afh: remove streaming mode.

Since the afh receiver is also capable of streaming local audio files,
this feature can be removed from para_afh.

This patch also replaces "--human" by "--parser-friendly", hence
making human-readable chunk output the default.

11 years agoThe afh receiver, documentation.
Andre Noll [Sun, 29 Jul 2012 12:26:58 +0000 (14:26 +0200)]
The afh receiver, documentation.

Small patch to manual.m4 which removes the text on the streaming
mode of para_afh and adds a section on the afh receiver.

11 years agoThe afh receiver, implementation.
Andre Noll [Sun, 29 Jul 2012 12:41:11 +0000 (14:41 +0200)]
The afh receiver, implementation.

This replaces the dummy implementation added in the previous patch
by a working one. It employs the recently added ->execute method for
receivers to let other buffer tree nodes query information about the
current audio file and reposition the stream.

11 years agoThe afh_receiver, infrastructure.
Andre Noll [Tue, 23 Aug 2011 16:11:38 +0000 (18:11 +0200)]
The afh_receiver, infrastructure.

This adds a dummy implementation of the new afh_receiver which will
replace the streaming mode of para_afh.

It "receives" its input data from a local audio file rather than from
a network socket, but supports the same API as all other receivers. In
particular it provides a buffer tree node which feeds the chunks of
the audio file to any filter which is connected to that node. This
mechanism will be used by the para_play executable.

The afh receiver is not needed for para_audiod, so we link afh_recv.o
only to para_recv.

11 years agoAdd execute mechanism to receiver nodes.
Andre Noll [Tue, 26 Jun 2012 22:39:37 +0000 (00:39 +0200)]
Add execute mechanism to receiver nodes.

Currently, receiver nodes have not much information to offer which could
be interesting for their child buffer tree nodes. This is about to change
with the introduction of the afh receiver and the para_play executable.
For example, para_play needs to query the number of chunks of the current
audio file from the afh receiver in order to display playback progress.

This patch adds only the new function pointer to struct receiver. The afh
receiver will be the first user of this.

11 years agoIntroduce afh_get_afhi_txt().
Andre Noll [Tue, 26 Jun 2012 19:28:48 +0000 (21:28 +0200)]
Introduce afh_get_afhi_txt().

The afh receiver needs a pretty-printed version of the audio format
handler structure, like the one that is printed in print_info()
of afh.c.

This commit moves print_info() to afh_common.c and makes it print
into a buffer rather than to stdout. The function is renamed to the
more descriptive afh_get_afhi_txt().

The single caller in afh.c is changed accordingly.

11 years agoaudiod: Replace kill_btrn() by task notifications.
Andre Noll [Sun, 8 Jul 2012 14:58:45 +0000 (14:58 +0000)]
audiod: Replace kill_btrn() by task notifications.

11 years agosched: Replace sched_shutdown() by task_notify_all().
Andre Noll [Sun, 8 Jul 2012 18:57:24 +0000 (18:57 +0000)]
sched: Replace sched_shutdown() by task_notify_all().

sched_shutdown() was mis-designed from the beginning as the registered
tasks have no chance to clean up. Using task notifiers allows to
replace the single caller of sched_shutdown().

11 years agosched: Introduce task notifications.
Andre Noll [Sun, 8 Jul 2012 18:57:16 +0000 (18:57 +0000)]
sched: Introduce task notifications.

Currently there is no canonical way to perform inter-task
communications. This leads to ugly hacks like kill_all_decoders()
of audiod which is called when audiod switches to "off" or "standby"
mode. This function sets the error state of the receiver task to a
negative value and removes the receiver's buffer tree node, magically
knowing that this is the correct action to take in order to shut down
the receiver cleanly.

This patch provides a simple infrastructure for task communications
which makes such hacks unnecessary. Tasks may send a notification
value, which is a standard error code, to another task by calling the
new task_notify() function. The receiving task is supposed to check
for any pending notifications in its ->post_select function.

As a first application of the notification concept, the above mentioned
kill_all_decoders() function is changed to use notifications instead.

11 years agoi9e_attach_to_stdout(): Don't insist on btrn == NULL.
Andre Noll [Thu, 12 Apr 2012 04:21:56 +0000 (06:21 +0200)]
i9e_attach_to_stdout(): Don't insist on btrn == NULL.

This allows to call this function even if the stdout buffer tree node
is already attached. In this case i9e_attach_to_stdout() detaches
the current btr node first.

11 years agoInteractive: Assorted whitespace/newline fixes.
Andre Noll [Sun, 8 Apr 2012 03:03:10 +0000 (05:03 +0200)]
Interactive: Assorted whitespace/newline fixes.

This avoids printing unnecessary newlines and fixes the
"double-prompt" bug.

11 years agointeractive: kill i9ep->line_handler_running.
Andre Noll [Mon, 9 Apr 2012 04:10:50 +0000 (06:10 +0200)]
interactive: kill i9ep->line_handler_running.

What we are interested in is not if the line handler is currently
running but if there exists a buffer tree node for the stdout task. So
check this condition instead and remove the unnecessary variable.

11 years agointeractive: Do not close stderr in i9e_close().
Andre Noll [Mon, 9 Apr 2012 04:12:14 +0000 (06:12 +0200)]
interactive: Do not close stderr in i9e_close().

Closing stderr prevents further log messages from being printed.

11 years agoAdd missing documentation of send_strerror().
Andre Noll [Sun, 4 Nov 2012 12:38:59 +0000 (13:38 +0100)]
Add missing documentation of send_strerror().

11 years agoMerge branch 't/filter_parse_config_cleanup'
Andre Noll [Sun, 18 Nov 2012 19:22:30 +0000 (20:22 +0100)]
Merge branch 't/filter_parse_config_cleanup'

8e290f Cleanup filter command line parsers.

11 years agoMerge branch 't/fade_improvements'
Andre Noll [Sun, 4 Nov 2012 13:20:36 +0000 (14:20 +0100)]
Merge branch 't/fade_improvements'

Was cooking for almost a month, let's merge it.

483d31 fade: Upgrade client command log message to loglevel NOTICE.
49412f fade: Handle non-positive fade time gracefully.
376456 fade: Add --loglevel option.
dec704 fade: Generate fade.ggo from m4 template.
0968b2 fade: Introduce --mixer-api to choose between ALSA and OSS.
b4171b fade: Add the ALSA mixer implementation.
46af7d fade: Switch to modular mixer API.
702457 fade: Infrastructure for the modular mixer API.
3a2580 fade: Abort on client command failures.
b618da fade: Remove some unnecessary includes.
f502e6 configure: Add fade.o to object list only if oss was detected.

11 years agoosx_write: Check return value of AudioOutputUnitStart().
Andre Noll [Thu, 9 Aug 2012 19:07:03 +0000 (21:07 +0200)]
osx_write: Check return value of AudioOutputUnitStart().

This function may fail, and we even have an error code for this condition
available.

11 years agoosx_write: Be careful when dereferencing the private_data pointer.
Andre Noll [Tue, 7 Aug 2012 11:51:47 +0000 (13:51 +0200)]
osx_write: Be careful when dereferencing the private_data pointer.

When the main process stops the audio unit the callback might be
sleeping on the mutex and run one more time.

11 years agoosx: Treat writer node as an internal buffer tree node.
Andre Noll [Thu, 14 Jun 2012 15:27:05 +0000 (17:27 +0200)]
osx: Treat writer node as an internal buffer tree node.

11 years agoosx_write: Add big fat comment on callback btr node.
Andre Noll [Thu, 14 Jun 2012 11:26:32 +0000 (13:26 +0200)]
osx_write: Add big fat comment on callback btr node.

11 years agoCleanup filter command line parsers.
Andre Noll [Wed, 10 Oct 2012 07:29:04 +0000 (09:29 +0200)]
Cleanup filter command line parsers.

All these functions call the gengetopt parser which aborts on errors.
Hence it is pointless to check the return value of the parser.

The patch also renames most of the *args_info structs to "conf".

11 years agoamp: Remove pointless private_amp_data->conf.
Andre Noll [Tue, 9 Oct 2012 21:07:24 +0000 (23:07 +0200)]
amp: Remove pointless private_amp_data->conf.

There is no need to store the configuration of the amp filter
in its privata_data structure since we can always get it via
the filter node pointer.

11 years agobuffer_tree.c: Fix a typo.
Andre Noll [Sun, 21 Oct 2012 09:31:57 +0000 (11:31 +0200)]
buffer_tree.c: Fix a typo.

11 years agobtr_next_buffer_omit(): Add comment on passing NULL pointer.
Andre Noll [Tue, 9 Oct 2012 21:05:44 +0000 (23:05 +0200)]
btr_next_buffer_omit(): Add comment on passing NULL pointer.

It has always been OK to pass a NULL buffer pointer to this function,
but this was not documented yet.

11 years agoconfigure.ac: libflac also affects para_afh and para_server.
Andre Noll [Mon, 8 Oct 2012 20:54:44 +0000 (22:54 +0200)]
configure.ac: libflac also affects para_afh and para_server.

If libflac was not detected, there will be no flac support
whatsoever. The current warning message is misleading since
it only mentions para_audiod and para_filter.

11 years agofade: Upgrade client command log message to loglevel NOTICE.
Andre Noll [Mon, 16 Jul 2012 19:53:35 +0000 (21:53 +0200)]
fade: Upgrade client command log message to loglevel NOTICE.

This is one of the more interesting log messages of para_fade.

11 years agofade: Handle non-positive fade time gracefully.
Andre Noll [Sun, 15 Jul 2012 21:57:53 +0000 (23:57 +0200)]
fade: Handle non-positive fade time gracefully.

Currently, we don't do anything if the fade_time parameter is less
than or equal to zero. Just setting the destination volume seems to
be more natural in this case.

11 years agofade: Add --loglevel option.
Andre Noll [Sun, 15 Jul 2012 21:37:46 +0000 (23:37 +0200)]
fade: Add --loglevel option.

All the infrastructure is already in place, so this patch is
quite simple.

11 years agofade: Generate fade.ggo from m4 template.
Andre Noll [Sun, 15 Jul 2012 21:30:00 +0000 (23:30 +0200)]
fade: Generate fade.ggo from m4 template.

This allows to use the generic --config file template.

11 years agofade: Introduce --mixer-api to choose between ALSA and OSS.
Andre Noll [Sun, 15 Jul 2012 17:58:59 +0000 (19:58 +0200)]
fade: Introduce --mixer-api to choose between ALSA and OSS.

Currently, if both OSS and ALSA are supported, there is no way to
select the OSS mixer API.

This adds a new option to para_fade which allows to force the
given mixer API.

11 years agofade: Add the ALSA mixer implementation.
Andre Noll [Mon, 16 Jul 2012 19:25:51 +0000 (21:25 +0200)]
fade: Add the ALSA mixer implementation.

This provides another mixer API which relies on the libasound library
of ALSA.

The manual is changed accordingly to mention that para_fade now
supports both OSS and ALSA.

11 years agofade: Switch to modular mixer API.
Andre Noll [Mon, 16 Jul 2012 19:29:19 +0000 (21:29 +0200)]
fade: Switch to modular mixer API.

Although only the oss mixer is supported ATM, this commit paves the way
for supporting more than one mixer API. It moves the oss-specific part
of para_fade to the new oss_mix.c file added by the previous commit.

Different mixer APIs will support different sets of mixer channels,
so handling of the various mixer channels is changed from a ggo enum
config option to a string option which allows to specify arbitrary
strings. The mixer implementations must check the given strings
themselves and are supposed to define a ->get_channels method which
returns the available channels. This function is called from fade.c
if an invalid channel is given.

The default mixer device, currently hardcoded in the ggo file to
"/dev/mixer", is fine for OSS. The ALSA mixer will need another default
however. Therefore this patch removes the default setting from the ggo
file so that the corresponding ggo config variable will be NULL if no
mixer device was given. The mixer implementations are supposed to check
this variable and fall back to their individual defaults if it is NULL.

11 years agofade: Infrastructure for the modular mixer API.
Andre Noll [Sun, 15 Jul 2012 11:08:28 +0000 (13:08 +0200)]
fade: Infrastructure for the modular mixer API.

This commit prepares for supporting more than one mixer by introducing
$mixers in configure.ac which contains the set of supported mixers. It
creates an empty oss_mix.c file to which the oss-specific code will
be moved in the next patch.

The fade-specific stuff of configure.ac is moved to a separate section
since whether to build fade will soon no longer depend on OSS only.

The patch is a bit large due to some generic m4 macros being moved to
the top of configure.ac as they are needed in the new fade section.

11 years agofade: Abort on client command failures.
Andre Noll [Mon, 2 Jul 2012 06:40:31 +0000 (08:40 +0200)]
fade: Abort on client command failures.

Currently, we check only the exit code of wait(), but do not look
at the exit status of the child. So the fade command continues
even if all para_client commands fail.

Fix this by investigating the termination status of the child
process.

11 years agofade: Remove some unnecessary includes.
Andre Noll [Sun, 15 Jul 2012 12:31:02 +0000 (14:31 +0200)]
fade: Remove some unnecessary includes.

These are included already from para.h.

11 years agoconfigure: Add fade.o to object list only if oss was detected.
Andre Noll [Sun, 15 Jul 2012 09:24:35 +0000 (11:24 +0200)]
configure: Add fade.o to object list only if oss was detected.

The all_errlist_obj variable should only contain objects which can
actually be compiled on the given setup.

However, fade.o was added to this variable unconditionally. This patch
makes it conditional on oss.

11 years agoNEWS update.
Andre Noll [Sun, 7 Oct 2012 09:11:02 +0000 (11:11 +0200)]
NEWS update.

11 years agoSimplify ggo makefile.
Andre Noll [Sun, 29 Jul 2012 18:51:18 +0000 (20:51 +0200)]
Simplify ggo makefile.

Currently we have three different targets for creating *_cmdline.[ch]
files. This is because receivers, filters and writers need slightly
different command line options.

This patch defines the common options in the ggo makefile and moves
additional parameters to the individual .m4 files so that a single
target to create *_cmdline.[ch] is now sufficient.

The name of the command line parsers of some filters and writers
changed due to this unification, so these are updated accordingly.

11 years agowrite: Get rid of gengetopt's string parser.
Andre Noll [Sun, 29 Jul 2012 17:49:46 +0000 (19:49 +0200)]
write: Get rid of gengetopt's string parser.

It causes gengetopt to generate quite some additional code for
the string parsers of all writers. Moreover, this string parser is
inferior to create_argv() and create_shifted_argv() of string.c as
gengetopt's parser does not honor any quoting at all.

This commit changes the signature of the ->parse_config_or_die method
of struct writer to take an (argc, argv) pair instead of a string.  All
writers can thus call the vanilla command line parser of gengetopt. The
single user in write_common.c now calls ->parse_config_or_die()
with an (argc, argv) pair obtained from create_shifted_argv().

11 years agoIntroduce create_shifted_argv().
Andre Noll [Sun, 29 Jul 2012 16:39:58 +0000 (18:39 +0200)]
Introduce create_shifted_argv().

In order to create argument vectors for the gengetopt parsers,
filter_common.c and recv_common.c call create_argv() on the given
--filter or --receiver option, then shift the returned array by one
to the right because gengetopt expects the program name in argv[0].

This commit creates a new helper function for this purpose and changes
the two callers to use the new function.

11 years agoFix off-by-one bug in create_argv().
Andre Noll [Sun, 29 Jul 2012 15:55:37 +0000 (17:55 +0200)]
Fix off-by-one bug in create_argv().

Nothing serious, just wasting memory.

11 years agoggo: Move options from makefile to .m4 files.
Andre Noll [Sun, 29 Jul 2012 15:13:10 +0000 (17:13 +0200)]
ggo: Move options from makefile to .m4 files.

It's easier to specify these options for gengetopt in the
corresponding m4 files, together with the command line
options of the program.

11 years agopara_gui ggo: Do not pass --no-handle-error.
Andre Noll [Sun, 29 Jul 2012 14:28:28 +0000 (16:28 +0200)]
para_gui ggo: Do not pass --no-handle-error.

We are exiting anyway on errors. This change allows to skip
the check of the return value of gui_cmdline_parser() and
removes a line from the makefile.

11 years agoRemove fsck.m4.
Andre Noll [Sun, 29 Jul 2012 14:18:21 +0000 (16:18 +0200)]
Remove fsck.m4.

This should have removed in 0.4.0 back when osl was moved to a
separate library.

11 years agoPut dependency files to a separate directory.
Andre Noll [Sat, 28 Jul 2012 16:14:24 +0000 (18:14 +0200)]
Put dependency files to a separate directory.

Currently the dependency files are stored in the same directory as the
object files. This moves these files to the new build/deps directory
instead, and makes "make clean" remove the objects directory while
"make clean2" now removes the whole build directory.

As a side effect of this change, the $(all_objs) variable now contains
only the non-directory part of the objects, so we may get rid of the
directory-stripping in the test makefile.

11 years agoMakefile: Simplify option parsing for verbose build.
Andre Noll [Sat, 28 Jul 2012 09:03:28 +0000 (11:03 +0200)]
Makefile: Simplify option parsing for verbose build.

There is no point in introducing the intermediate BUILD_VERBOSE
variable. Just set $Q directly and make it a singly expanded variable.

11 years agoconfigure: Replace AC_TRY_RUN and AC_TRY_LINK.
Andre Noll [Sat, 28 Jul 2012 06:44:00 +0000 (08:44 +0200)]
configure: Replace AC_TRY_RUN and AC_TRY_LINK.

Both macros are considered obsolete. AC_TRY_RUN has been obsoleted
by AC_RUN_IFELSE while AC_TRY_LINK has been replaced by AC_LINK_IFELSE.

This patch replaces all occurrences of these two obsolete macros and
bumps the required autoconf version to 2.61 (which was released in
2006 and is shipped with Ubuntu Hardy).

11 years agoconfigure: Replace AC_HELP_STRING by AS_HELP_STRING.
Andre Noll [Sun, 22 Jul 2012 20:37:58 +0000 (22:37 +0200)]
configure: Replace AC_HELP_STRING by AS_HELP_STRING.

The former is considered obsolete. Reported by

autoconf --warnings obsolete

11 years agoconfigure: Remove check for return value of signal handlers.
Andre Noll [Sun, 22 Jul 2012 20:29:49 +0000 (22:29 +0200)]
configure: Remove check for return value of signal handlers.

These days one may safely assume C89 semantics where the type of a
signal handler is void.

11 years agoautogen.sh: Remove call to aclocal.
Andre Noll [Sun, 22 Jul 2012 19:54:07 +0000 (21:54 +0200)]
autogen.sh: Remove call to aclocal.

aclocal is part of automake, which is not used at all by the paraslash
build system.

11 years agoAllow to specify build dir via make O=<dir>.
Andre Noll [Sun, 22 Jul 2012 18:09:37 +0000 (20:09 +0200)]
Allow to specify build dir via make O=<dir>.

11 years agoMakefile: Move generated files to build directory.
Andre Noll [Thu, 26 Jul 2012 02:28:37 +0000 (04:28 +0200)]
Makefile: Move generated files to build directory.

This instructs the build system to store the generated ggo files,
all objects and depend files, and the man pages in the new "build"
directory.

11 years agoMakefile: Don't hardcode path for generated man pages.
Andre Noll [Thu, 26 Jul 2012 02:28:56 +0000 (04:28 +0200)]
Makefile: Don't hardcode path for generated man pages.

Using $(man_dir) throughout makes it easier to change the name of
this directory.

11 years agoMakefile: Clean up directory creation.
Andre Noll [Sun, 22 Jul 2012 14:33:20 +0000 (16:33 +0200)]
Makefile: Clean up directory creation.

This combines all directory targets into a single target and executes
the contents of the new MKDIR_P variable (set to "mkdir -p") to create
the directory.

11 years agoMove gengetopt input files to m4 directory.
Andre Noll [Sun, 22 Jul 2012 14:11:11 +0000 (16:11 +0200)]
Move gengetopt input files to m4 directory.

This separates the gengetopt input directory from its output directory.
All gengetopt m4 file are moved to the new m4/gengetopt directory.

As a consequence of this cleanup, we may get rid of the .gitignore
file for the generated ggo files, which is a good thing as it was
hard to keep it up to date.

11 years agoDifferentiate between ggo_dir and m4_ggo dir.
Andre Noll [Sun, 22 Jul 2012 13:39:13 +0000 (15:39 +0200)]
Differentiate between ggo_dir and m4_ggo dir.

The former is the output directory for the generated ggo files
while the latter is the input directory containing the .m4 files.

Separating the two allows to switch to different directories for
input and output files.

11 years agoTreat all ggo files as m4 files.
Andre Noll [Sun, 22 Jul 2012 13:15:52 +0000 (15:15 +0200)]
Treat all ggo files as m4 files.

Most input files for gengetopt are already generated from corresponding
m4 files. This renames the remaining ones, so that all .ggo files
are now generated and can be removed by the make clean variants.
Hence we do not need to track the set of generated ggo files any more.

11 years agoMerge branch 't/releases_branch'
Andre Noll [Sun, 26 Aug 2012 12:26:00 +0000 (14:26 +0200)]
Merge branch 't/releases_branch'

18d2c3 Remove all release tarballs from the master branch.
f82ac2 web: Rename tarball download directory.

Was cooking since 2012-07-28, tested also on athcx.

11 years agosignal: Improve documentation of para_signal_init().
Andre Noll [Tue, 14 Aug 2012 11:09:43 +0000 (13:09 +0200)]
signal: Improve documentation of para_signal_init().

para_signal_init() does not install any signal handlers, so this part of the
documentation is incorrect. The patch fixes this flaw, mentions which end of
the signal pipe is returned to the caller and improves the wording a bit.

11 years agoMerge remote-tracking branch 'boock/master'
Andre Noll [Mon, 13 Aug 2012 08:08:41 +0000 (10:08 +0200)]
Merge remote-tracking branch 'boock/master'