paraslash.git
10 years agoafh_recv: Replace ggo text section by description.
Andre Noll [Sat, 6 Apr 2013 22:27:51 +0000 (22:27 +0000)]
afh_recv: Replace ggo text section by description.

This way the text shows up only when --detailed-help is given.

10 years agoMake gengetopt descriptions work.
Andre Noll [Fri, 12 Apr 2013 11:54:12 +0000 (13:54 +0200)]
Make gengetopt descriptions work.

With gengetopt's text and description options it is not possible to
print a text only when --detailed-help was given, but not when only
--help is given.

Moreover, headers generated with old versions of gengetopt do not
export the description text.  However, declaring it unconditionally
causes compiler warnings on new systems.

To circumvent these problems, we introduce a new test for configure
which checks whether the description string is declared. If it is not,
we simply append the declaration to the *.cmdline.h files.

This change allows to move the description string of para_play to
the gengetopt source file.

10 years agoIntroduce version.c to limit recompilation on version changes.
Andre Noll [Fri, 12 Apr 2013 12:23:45 +0000 (14:23 +0200)]
Introduce version.c to limit recompilation on version changes.

Currently version.h includes git-version.h which changes whenever
a different commit is checked out or the working tree becomes dirty
because a file has been modified. Consequently, all .c files that
include this header must be recompiled in this case.

To limit the number of recompilations, this commit introduces
version.c, which contains functions that return the various types of
the version string. It is now the only file that includes version.h,
so only version.o must be rebuilt if git-version.h changes.

This also adds the build date, OS and CC version to the version output.

10 years agoMake all commands print git version and improve version string.
Andre Noll [Tue, 26 Mar 2013 23:30:49 +0000 (23:30 +0000)]
Make all commands print git version and improve version string.

Currently the format of the first line of the help output varies
between executables, for example:

para_afh git (0.4.12.12.g15a4: spectral gravity)
para_audioc git

This difference comes from the fact that para_afh has its own
->print_help method which uses the VERSION_SINGLE_LINE macro of
version.h while para_audioc relies on gengetopt's help output.

The latter uses the make variable PACKAGE_VERSION which gets
initialized at configure time through the second argument in AC_INIT
of configure.ac. This value is either the version number for or the
string "git".

It's a good thing to have the abbreviated git version encoded in
all executables, so this commit changes the argument of gengetopt's
--set-version to the git version string including the codename. With
the patch applied, the output of all commands looks like this if
--version was given:

para_filter 0.4.12.12.g11d7 (spectral gravity)

To make sure things stay consistent, the patch introduces the
VERSION_SINGLE_LINE macro and changes all commands to use it instead
of open coding the version string.

10 years agoAvoid unwanted log messages during startup.
Andre Noll [Mon, 1 Apr 2013 22:52:20 +0000 (22:52 +0000)]
Avoid unwanted log messages during startup.

Regardless of the given loglevel, para_recv currently prints log
messages like these at startup:

afh_init: initializing mp3 handler
afh_init: initializing ogg handler
afh_init: initializing aac handler
afh_init: initializing wma handler
afh_init: initializing spx handler
afh_init: initializing flac handler

That's because recv_init() is called before the command line arguments
are parsed, so the loglevel has not been set at this point. Other
programs have similar problems.

Fix these problems by always setting the loglevel right after a parser
has been called so that the init functions run *after* loglevel has
been set.

10 years agoDon't check return value of command line parsers unnecessarily.
Andre Noll [Sat, 6 Apr 2013 18:59:12 +0000 (18:59 +0000)]
Don't check return value of command line parsers unnecessarily.

All gengetopt parsers except the one for para_client are generated
without the --no-handle-error option, i.e. these parsers exit on errors.
Hence it is pointless to check return values.

10 years agoBuild receivers, filters and writers without -h and -V support.
Andre Noll [Fri, 5 Apr 2013 18:58:03 +0000 (18:58 +0000)]
Build receivers, filters and writers without -h and -V support.

This is not needed since the help is printed by the driving application.
It allows to get rid of an ugly "p += 3" statement in ggo.c.

10 years agofilter: Wrap lines in the available filter list.
Andre Noll [Sat, 6 Apr 2013 19:25:18 +0000 (19:25 +0000)]
filter: Wrap lines in the available filter list.

Currently para_filter -h and para_audiod -h print the available
filters in a single line which exceeds 80 characters if many
filters are supported.

This patch makes printf_or_die() return the number of characters
printed.  This allows to add line breaks to format the filter list.

10 years agoaudioc: Print config file errors.
Andre Noll [Sun, 7 Apr 2013 01:05:56 +0000 (01:05 +0000)]
audioc: Print config file errors.

Currently para_audioc fails silently if the config file contains
errors. This patch makes it print a proper error message in this case.

10 years agodoc: Rewrite udp sender description
Andre Noll [Sun, 7 Apr 2013 03:06:39 +0000 (03:06 +0000)]
doc: Rewrite udp sender description

This text was rather badly written. Replace it with better English.

10 years agoclient: Fix typo in comment.
Andre Noll [Sat, 6 Apr 2013 19:43:53 +0000 (19:43 +0000)]
client: Fix typo in comment.

10 years agoclient: Remove duplicate include.
Andre Noll [Fri, 12 Apr 2013 11:30:17 +0000 (13:30 +0200)]
client: Remove duplicate include.

The client.cmdline.h header file was included twice.

10 years agoMerge branch 't/stdin_stdout_fixes'
Andre Noll [Tue, 11 Jun 2013 18:41:49 +0000 (20:41 +0200)]
Merge branch 't/stdin_stdout_fixes'

Was cooking for almost a month.

b99b4a stdin/stdout: Restore fd flags on shutdown.

Conflicts:
stdin.c
stdout.c

10 years agoFix help text of com_touch().
Andre Noll [Tue, 11 Jun 2013 18:36:23 +0000 (20:36 +0200)]
Fix help text of com_touch().

It is the amp filter rather than the compress filter that makes use
of the amplification value stored in the audio file table.

10 years agoMerge branch 't/gui_improvements'
Andre Noll [Fri, 7 Jun 2013 19:34:51 +0000 (21:34 +0200)]
Merge branch 't/gui_improvements'

Was cooking for more than one month.

bf1831 string: Speed up xvasprintf().
bcc083 string: Add discard feature for for_each_line().
e3868d string: Simplify return value of for_each_line().
d1f0f0 string: Simplify for_each_line().
23b121 string: Clean up for_each_line() and related functions.
6256ed string: Replace the for_each_line_modes enum by a bitmap.
14e689 gui: Don't sleep before executing the status command.
e90c6c gui: Speed up add_spaces().
20e2c6 gui: Rename do_exit().
ef0508 gui: Remove superfluous cmd_died.
d7562b gui: Check stdin for readability.
a44fa6 gui: Discard overlong input lines.

Conflicts:
gui.c

10 years agoMerge branch 't/doc'
Andre Noll [Sat, 25 May 2013 12:37:41 +0000 (14:37 +0200)]
Merge branch 't/doc'

Simple enough and cooking since 2013-05-05.

e82be0 manual: Add a new paragraph for installing dependencies.
1d6f5f manual: Add missing references of two optional packages.
4a6061 check_wav.c: Fix documentation of check_wav_post_select().
f9c625 Add two missing Copyright headers and file annotations.
16af9d Add documentation of public functions in check_wav.c.

10 years agoMerge remote-tracking branch 'mpi/master'
Andre Noll [Sun, 19 May 2013 21:05:00 +0000 (23:05 +0200)]
Merge remote-tracking branch 'mpi/master'

10 years agoFix compilation on Ubuntu precise.
Andre Noll [Sun, 19 May 2013 20:09:52 +0000 (22:09 +0200)]
Fix compilation on Ubuntu precise.

This distro ships glibc-2.15 where clock_gettime() is part of the
realtime library librt. So all executables which call clock_gettime()
must be linked with -lrt. The configure script detects this and adds
-lrt to LDFLAGS. However, -lrt must come *after* the objects to be
linked together, which is currently not the case.

Fix this by moving $(LDFLAGS) to the end of the recipe for the targets
of all executables.

10 years agofilter_common.c: Fix two typos in comment.
Andre Noll [Sun, 19 May 2013 19:25:13 +0000 (21:25 +0200)]
filter_common.c: Fix two typos in comment.

10 years agoalsa writer: Do not print uninitialized data.
Andre Noll [Wed, 15 May 2013 20:33:24 +0000 (22:33 +0200)]
alsa writer: Do not print uninitialized data.

ALSA's snd_output_buffer_string() returns the current size of valid
data in the returned data buffer, but this buffer is not guaranteed
to be zero-terminated.

Currently alsa_init() ignores this fact and prints the buffer up to
the first NULL byte.  Therefore it may print garbage that follows the
valid data in the buffer. If there is no zero byte after the data,
it may even segfault.

Fix this bug by using memchr() instead of strchr() and carefully
tracking the number of bytes processed.

10 years agofile writer: Use xwrite() instead of plain write().
Andre Noll [Sat, 30 Mar 2013 19:12:40 +0000 (19:12 +0000)]
file writer: Use xwrite() instead of plain write().

Currently the file writer's ->post_select() sets t->error to -1 on
errors, rather than using a proper error code. This may result in
a segfault when this number is passed to para_strerror().

Replacing the call to write() by xwrite() not only gives a proper
error code but also treats EAGAIN as a non-fatal error.

10 years agoMerge branch 't/sched_improvements'
Andre Noll [Sat, 18 May 2013 12:06:22 +0000 (14:06 +0200)]
Merge branch 't/sched_improvements'

This topic has been cooking for a month. During this period, one
problem on BSD has been found and fixed.

3ad5b0 Fix build on FreeBSD
484e75 sched: Rename new_post_select back to post_select.
74c880 sched: Kill old ->post_select variant.
c77e19 grab client: Switch to the alternative post select method.
38aeac client supervisor: Switch to the alternative post select method.
e009fa client exec: Switch to the alternative post select method.
742718 i9e: Switch to the alternative post select method.
2e6b8f vss: Switch to the alternative post select method.
6e83b4 stdout: Switch to the alternative post select method.
1995ce stdin: Switch to the alternative post select method.
88b0ec audioc: Switch to the alternative post select method.
b210e8 afs command task: Switch to the alternative post select method.
12f683 afs signal task: Switch to the alternative post select method.
ccef24 server signal task: Switch to the alternative post select method.
a6dabd server command task: Switch to the alternative post select method.
855c53 write: Switch to the alternative post select method.
58b74b play: Switch to the alternative post select method.
cf4982 afh_recv:  Switch to the alternative post select method.
4dc05b client: Switch to the alternative post select method.
043fd6 audiod: Switch command_task to the alternative post select method.
ce462a audiod: Switch the status task to the alternative post select method.
a7f2d1 audiod: Switch signal task to the alternative post select method.
ba2f65 osx writer: Switch to the alternative post select method.
3642d2 oss writer: Switch to the alternative post select method.
c29db3 file writer: Switch to the alternative post select method.
36875c ao: Switch to the alternative post select method.
3b3049 alsa: Switch to the alternative post select method.
60b853 wmadec: Switch to the alternative post select method.
6c8719 wav filter: Switch to the alternative post select method.
03e915 spxdec: Switch to the alternative post select method.
24bbc5 resample: Switch to the alternative post select method.
4ca80f prebuffer: Switch to the alternative post select method.
a55083 oggdec: Switch to the alternative post select method.
806d26 mp3dec: Switch to the alternative post select method.
7dcaf5 flacdec: Switch to the alternative post select method.
4dc9b9 fecdec: Switch to the alternative post select method.
f6e2cb compress: Switch to the alternative post select method.
ac3371 amp: Switch to the alternative post select method.
7c2c68 aacdec: Switch to the alternative post select method.
b333e0 dccp_recv: Switch to the alternative post select method.
00e793 udp_recv: Switch to the alternative post select method.
9c00a7 sched: Provide alternative post_select variant.
24758c Replace gettimeofday() by clock_gettime().
01f802 sched: Get rid of (pre)select shortcuts.
5bb44a audiod: Avoid delay when closing slot.

Conflicts:
string.c

10 years agoconfigure.ac: Do not print play objects.
Andre Noll [Fri, 17 May 2013 09:00:38 +0000 (11:00 +0200)]
configure.ac: Do not print play objects.

This is a debug statement from the early days of development of
para_play. It can safely be removed.

10 years agoFix build on FreeBSD
Andre Noll [Fri, 17 May 2013 08:49:10 +0000 (10:49 +0200)]
Fix build on FreeBSD

Commit 24758c5f (Replace gettimeofday() by clock_gettime()) removed
the inclusion of sys/time.h from several files since this header was
believed to be needed only for gettimeofday(), which was removed in
the same commit.

However, this broke the build on FreeBSD since sys/time.h
also pulled in the declaration of u_short, which is required by
/usr/include/netinet/udp.h. Therefore the compilation of udp_send.c
failed with

/usr/include/netinet/udp.h:42: error: expected specifier-qualifier-list before 'u_short'

This patch changes udp_send.c to include sys/types.h, which provides
the missing declaration.

10 years agoMerge branch 't/utf8'
Andre Noll [Tue, 14 May 2013 20:01:21 +0000 (22:01 +0200)]
Merge branch 't/utf8'

Was cooking since 2013-03-10.

a946af string.c: Fix typo in documentation of skip_cells().
251394 Switch to HTF-8 for web pages.
09c6bc gui: Try to link against libncursesw.
36f38a UTF-8 support for para_gui.
a99804 mp3_afh: Switch to UTF-8 encoding.
f78b53 gui: Don't compute string length unnecessarily.
6224f7 Get rid of unused HAVE_NCURSES define.
6cd788 Fix --with-curses configure option.

10 years agomanual: Add a new paragraph for installing dependencies.
Andre Noll [Sat, 4 May 2013 15:14:42 +0000 (17:14 +0200)]
manual: Add a new paragraph for installing dependencies.

This allows to install all required and optional packages with
a single command.

10 years agostdin/stdout: Restore fd flags on shutdown.
Andre Noll [Mon, 18 Mar 2013 22:51:46 +0000 (23:51 +0100)]
stdin/stdout: Restore fd flags on shutdown.

The stdin/stdout code should restore the flags to the old value to
avoid surprises, for example in shell scripts.

This changes stdin.c and stdout.c to save the old value. It is
restored in ->post_select when the buffer tree node is removed and
no more I/O takes place.

10 years agowma: Fix sparse error.
Andre Noll [Sat, 4 May 2013 18:39:54 +0000 (20:39 +0200)]
wma: Fix sparse error.

wma_common.c defines wma_log2() with __attribute__ ((const)), but the
declaration in wma.h lacks this attribute. Sparse does not like that
and fails with

wma_common.c:147:15: error: symbol 'wma_log2' redeclared with different type (originally declared at wma.h:28) - different modifiers

Add the const attribute also to wma.h.

10 years agoaacdec: Fix check of return value of NeAACDecInit2().
Andre Noll [Sat, 4 May 2013 16:13:56 +0000 (18:13 +0200)]
aacdec: Fix check of return value of NeAACDecInit2().

This function returns (char)-1 on errors and zero on success. Checking
whether the return value is negative is incorrect on systems where
char is unsigned.  On raspberry/ARM, gcc complains:

aacdec_filter.c:126:6: warning: comparison is always false due to limited range of data type [-Wtype-limits]

Fix this by checking agains zero instead.

10 years agomanual: Add missing references of two optional packages.
Andre Noll [Sat, 4 May 2013 15:07:56 +0000 (17:07 +0200)]
manual: Add missing references of two optional packages.

The curses lib and libsamplerate are both optional but were not
mentioned in the "Requirements" section. This patch adds both.

10 years agostring: Speed up xvasprintf().
Andre Noll [Mon, 25 Mar 2013 19:05:05 +0000 (19:05 +0000)]
string: Speed up xvasprintf().

This avoids to call vsnprintf() twice in the common case where the
result is small.

The running time of a simple test case that called this function in
a loop improved from 13s to 8s due to this change.

10 years agostring: Add discard feature for for_each_line().
Andre Noll [Mon, 25 Mar 2013 18:02:54 +0000 (18:02 +0000)]
string: Add discard feature for for_each_line().

This adds the new FELF_DISCARD_FIRST flag which instructs
for_each_line() to discard everything up to the next newline.

The new feature is only used by para_gui. When para_gui detects
a partial overlong input line, it ignores this data and passes the
FELF_DISCARD_FIRST flag in subsequent calls to for_each_line(). Hence
output continues at the next line.

10 years agostring: Simplify return value of for_each_line().
Andre Noll [Mon, 25 Mar 2013 17:30:56 +0000 (17:30 +0000)]
string: Simplify return value of for_each_line().

No caller used this function for counting lines, so simplify it by always
returning the number of bytes not processed.

10 years agostring: Simplify for_each_line().
Andre Noll [Mon, 25 Mar 2013 17:16:14 +0000 (17:16 +0000)]
string: Simplify for_each_line().

No user calls this with line_hander == NULL, so remove the special treatment
of this case.

10 years agostring: Clean up for_each_line() and related functions.
Andre Noll [Mon, 25 Mar 2013 16:10:28 +0000 (16:10 +0000)]
string: Clean up for_each_line() and related functions.

While for_each_complete_line() is a static function, there are two
public functions, for_each_line() and for_each_line_ro(), which are
implemented as simple wrappers for the static one. The only difference
between the two is that for_each_line_ro() sets the FELF_READ_ONLY
bit while for_each_line() does not.

Since we are about to add another bit of information soon, let's make
the bitmap and the static function public, and remove the two wrappers.
All callers are changed to pass an additional "unsigned flags" to
indicate whether they want the read-only behavior.

Documentation is updated accordingly.

10 years agostring: Replace the for_each_line_modes enum by a bitmap.
Andre Noll [Mon, 25 Mar 2013 15:36:10 +0000 (15:36 +0000)]
string: Replace the for_each_line_modes enum by a bitmap.

Currently we pass an "enum for_each_line_modes" as the first argument
to for_each_complete_line(). The parameter is effectively a boolean
since the enumeration defines only two possible values.

For the upcoming discard feature of for_each_line_modes() we'll need
to pass another bit of information, so this patch changes the type of
the first argument to for_each_complete_line() to unsigned and treats
it as a bit array. The only bit defined so far is LINE_MODE_RO, with
unchanged semantics.

The two callers are updated to reflect this change.

10 years agogui: Don't sleep before executing the status command.
Andre Noll [Wed, 27 Mar 2013 20:49:40 +0000 (20:49 +0000)]
gui: Don't sleep before executing the status command.

This results in uncacceptable delays when the status command fails
for any reason, for example because the server is down.

Replace this code by introducing a struct timeval variable "next_exec",
which stores the earliest possible time to restart the status command.

Move all status fetching code before the select() call in do_select()
to open_stat_pipe() and rename the function to status_pre_select(),
which is more appropriate.

10 years agogui: Speed up add_spaces().
Andre Noll [Mon, 25 Mar 2013 19:08:12 +0000 (19:08 +0000)]
gui: Speed up add_spaces().

The calls to waddstr() in this function showed up in profiles. So
print the full string at once instead of calling waddstr() for each
character.

10 years agogui: Rename do_exit().
Andre Noll [Mon, 25 Mar 2013 03:08:12 +0000 (03:08 +0000)]
gui: Rename do_exit().

This function sends SIGTERM to every process in the process group of
para_gui and dies thereafter. So kill_pg_and_die() is more descriptive
than the old name.

10 years agogui: Remove superfluous cmd_died.
Andre Noll [Mon, 25 Mar 2013 02:22:24 +0000 (02:22 +0000)]
gui: Remove superfluous cmd_died.

We might as well directly refer to cmd_pid which is set to zero in the
signal handling code after the process exits.

10 years agogui: Check stdin for readability.
Andre Noll [Mon, 25 Mar 2013 02:14:06 +0000 (02:14 +0000)]
gui: Check stdin for readability.

If the select_loop of para_gui runs in getch or command mode we
currently wait a full timeout period before checking for pending
input.

This patch adds stdin to the set of file descriptors monitored by
select so that a key press causes select() to return immediately.

10 years agogui: Discard overlong input lines.
Andre Noll [Mon, 18 Mar 2013 19:13:35 +0000 (20:13 +0100)]
gui: Discard overlong input lines.

If an external command produces output without newlines, the current
code ends up calling read_nonblock() with a buffer size of zero which
triggers the assertion in readv_nonblock().

Increase the output buffer to 32K and fix the problem by simply
discarding all input if the input buffer is full and contains no
newline character.

A better fix would be to discard everything until the next newline
character is read, but this requires more work, so let's go with this
simple fix for now.

10 years agoMerge branch 't/allow_zero_btr_add'
Andre Noll [Thu, 2 May 2013 17:55:18 +0000 (19:55 +0200)]
Merge branch 't/allow_zero_btr_add'

Was cooking for over a month.

10 years agosched: Rename new_post_select back to post_select.
Andre Noll [Sun, 31 Mar 2013 19:47:35 +0000 (19:47 +0000)]
sched: Rename new_post_select back to post_select.

10 years agosched: Kill old ->post_select variant.
Andre Noll [Sun, 31 Mar 2013 19:23:18 +0000 (19:23 +0000)]
sched: Kill old ->post_select variant.

It has no more users.

10 years agograb client: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 19:11:04 +0000 (19:11 +0000)]
grab client: Switch to the alternative post select method.

10 years agoclient supervisor: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 18:54:10 +0000 (18:54 +0000)]
client supervisor: Switch to the alternative post select method.

10 years agoclient exec: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 18:47:50 +0000 (18:47 +0000)]
client exec: Switch to the alternative post select method.

10 years agoi9e: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 18:38:39 +0000 (18:38 +0000)]
i9e: Switch to the alternative post select method.

10 years agovss: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 18:30:03 +0000 (18:30 +0000)]
vss: Switch to the alternative post select method.

10 years agostdout: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 18:24:32 +0000 (18:24 +0000)]
stdout: Switch to the alternative post select method.

10 years agostdin: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 18:22:08 +0000 (18:22 +0000)]
stdin: Switch to the alternative post select method.

10 years agoaudioc: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 18:17:41 +0000 (18:17 +0000)]
audioc: Switch to the alternative post select method.

10 years agoafs command task: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 18:11:48 +0000 (18:11 +0000)]
afs command task: Switch to the alternative post select method.

10 years agoafs signal task: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 17:58:26 +0000 (17:58 +0000)]
afs signal task: Switch to the alternative post select method.

10 years agoserver signal task: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 17:47:26 +0000 (17:47 +0000)]
server signal task: Switch to the alternative post select method.

10 years agoserver command task: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 17:42:17 +0000 (17:42 +0000)]
server command task: Switch to the alternative post select method.

10 years agowrite: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 17:34:52 +0000 (17:34 +0000)]
write: Switch to the alternative post select method.

10 years agoplay: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 17:27:28 +0000 (17:27 +0000)]
play: Switch to the alternative post select method.

10 years agoafh_recv: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 17:03:15 +0000 (17:03 +0000)]
afh_recv:  Switch to the alternative post select method.

10 years agoclient: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 16:46:08 +0000 (16:46 +0000)]
client: Switch to the alternative post select method.

10 years agoaudiod: Switch command_task to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 16:44:57 +0000 (16:44 +0000)]
audiod: Switch command_task to the alternative post select method.

10 years agoaudiod: Switch the status task to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 15:52:57 +0000 (15:52 +0000)]
audiod: Switch the status task to the alternative post select method.

10 years agoaudiod: Switch signal task to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 14:11:59 +0000 (14:11 +0000)]
audiod: Switch signal task to the alternative post select method.

10 years agoosx writer: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 14:03:19 +0000 (14:03 +0000)]
osx writer: Switch to the alternative post select method.

10 years agooss writer: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 14:01:35 +0000 (14:01 +0000)]
oss writer: Switch to the alternative post select method.

10 years agofile writer: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:59:41 +0000 (13:59 +0000)]
file writer: Switch to the alternative post select method.

10 years agoao: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:56:49 +0000 (13:56 +0000)]
ao: Switch to the alternative post select method.

10 years agoalsa: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 22:40:48 +0000 (22:40 +0000)]
alsa: Switch to the alternative post select method.

10 years agowmadec: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:43:34 +0000 (13:43 +0000)]
wmadec: Switch to the alternative post select method.

10 years agowav filter: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 22:44:38 +0000 (22:44 +0000)]
wav filter: Switch to the alternative post select method.

10 years agospxdec: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:37:13 +0000 (13:37 +0000)]
spxdec: Switch to the alternative post select method.

10 years agoresample: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:34:37 +0000 (13:34 +0000)]
resample: Switch to the alternative post select method.

10 years agoprebuffer: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:30:57 +0000 (13:30 +0000)]
prebuffer: Switch to the alternative post select method.

10 years agooggdec: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:28:48 +0000 (13:28 +0000)]
oggdec: Switch to the alternative post select method.

10 years agomp3dec: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:25:02 +0000 (13:25 +0000)]
mp3dec: Switch to the alternative post select method.

10 years agoflacdec: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:20:13 +0000 (13:20 +0000)]
flacdec: Switch to the alternative post select method.

10 years agofecdec: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:15:41 +0000 (13:15 +0000)]
fecdec: Switch to the alternative post select method.

10 years agocompress: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:14:08 +0000 (13:14 +0000)]
compress: Switch to the alternative post select method.

10 years agoamp: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:11:46 +0000 (13:11 +0000)]
amp: Switch to the alternative post select method.

10 years agoaacdec: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 13:08:46 +0000 (13:08 +0000)]
aacdec: Switch to the alternative post select method.

10 years agodccp_recv: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 22:45:58 +0000 (22:45 +0000)]
dccp_recv: Switch to the alternative post select method.

10 years agoudp_recv: Switch to the alternative post select method.
Andre Noll [Sun, 31 Mar 2013 12:49:42 +0000 (12:49 +0000)]
udp_recv: Switch to the alternative post select method.

10 years agosched: Provide alternative post_select variant.
Andre Noll [Sun, 31 Mar 2013 12:32:07 +0000 (12:32 +0000)]
sched: Provide alternative post_select variant.

Code which accesses the ->error field of another task has been
a source of bugs in the past. This patch is a first step to make
->error private to sched.c.

Currently the ->post_select() methods of all tasks are supposed
to set ->error to a negative value to indicate that the task
should be terminated, i.e. t->error being negative instructs the
scheduler to not call t->pre_select() or t->post_select() any more
in subsequent iterations.  An equivalent way to achieve the same
is to let ->post_select() return an error code instead. Benefits
include

* It reduces the use of ->error outside of sched.c
* It's impossible to miss setting the error code
* It simplifies code slightly

Therefore we'd like to change the prototype of the ->post_select()
methods from

void (*post_select)(struct sched *s, struct task *t);
to
int (*post_select)(struct sched *s, struct task *t);

Changes to struct sched affects many parts of the code base,
hence converting all users at once would result in a very
large patch. Therefore we temporarily introduce an additional
->new_post_select() method according to the second declaration
above. The scheduler calls the new method if it is defined and falls
back to the old variant otherwise. This approach allows to switch
over one task after another without breaking things.

This patch introduces the infrastructure just described and switches
over the http receiver. Subsequent commits will change all other tasks
in the same way. After all tasks have been switched over we can get
rid of the old ->post_select variant and rename ->new_post_select()
back to ->post_select().

10 years agoReplace gettimeofday() by clock_gettime().
Andre Noll [Sun, 31 Mar 2013 02:03:04 +0000 (02:03 +0000)]
Replace gettimeofday() by clock_gettime().

POSIX.1-2008 marks gettimeofday() as obsolete, so let's switch to
clock_gettime().

clock_gettime() operates on timespecs rather than on timevals like
gettimeofday() does. Since timevals are extensively used in all
parts of paraslash, and select() takes a timeval pointer as the
timeout parameter, it seems to be easiest to add a new wrapper,
clock_get_realtime(). It calls clock_gettime(), performs error
checking (all errors are treated fatal and abort the program), and
converts the result to a timeval.

Another difference between gettimeofday() and clock_gettime()
is that sys/time.h needs to be included for gettimeofday(), while
clock_gettime() is declared in time.h which gets included from para.h.
Hence we can remove the include statement for sys/time.h everywhere.

Programs which call clock_gettime need to be linked against librt on
glibc versions before 2.17 while BSD and newer glibc-based systems
have no such requirement. To make matters more interesting,
MacOS lacks clock_gettime() completely although this function conforms
to SUSv2 and POSIX.1-2001.

We'd like to avoid the unnecessary dependence on librt on systems that
have clock_gettime() in -lc, and we must fall back to gettimeofday()
on MacOS. Hence this commit also introduces a check in configure.ac
which determines whether clock_gettime() is available and, if it is,
whether -lrt is needed. Executables are only linked with -lrt if
configure found that this is necessary.

11 years agocheck_wav.c: Fix documentation of check_wav_post_select().
Andre Noll [Sun, 14 Apr 2013 09:57:12 +0000 (11:57 +0200)]
check_wav.c: Fix documentation of check_wav_post_select().

This function does not take a pointer to a buffer tree node, yet the
comment referred to "btrn". Simply drop this part of the sentence.

11 years agosched: Get rid of (pre)select shortcuts.
Andre Noll [Sat, 30 Mar 2013 22:43:38 +0000 (22:43 +0000)]
sched: Get rid of (pre)select shortcuts.

These shortcuts let the scheduler skip any subsequent ->pre_select()
calls as well as the actual call to select(2) if the current task's
->pre_select() requested a zero timeout.

This idea turned out to be dubios at best. The main problem is that
->post_select no longer knows whether ->pre_select() and select()
have been called. For example, if ->pre_select() monitors some file
descriptor, ->post_select() might find it not ready for I/O even when
it actually is because ->pre_select() or select() was optimized away.

Another problem are tasks whose ->post_select() method expects that
->pre_select() sets some variable in a shared data structure.

This patch removes the scheduler optimizations so that all
->pre_select() methods of all tasks are called once per scheduler
interval.

11 years agoaudiod: Avoid delay when closing slot.
Andre Noll [Sun, 31 Mar 2013 14:58:18 +0000 (14:58 +0000)]
audiod: Avoid delay when closing slot.

Currently we might wait up to a full scheduler interval until a slot
is closed.

This commit changes the pre_select method of the status task to check
whether some slot can be closed. In this case it requests a minimal
delay from the scheduler.

The current try_to_close_slot() is split into two functions,
must_close_slot() and close_unused_slots(). The former function is
called from ->pre_select(). It only checks whether a slot must be
closed but performs no action.

The latter function, close_unused_slots() probes all slots and closes
those for which must_close_slot() returns true.

11 years agoAdd two missing Copyright headers and file annotations.
Andre Noll [Thu, 4 Apr 2013 20:58:48 +0000 (20:58 +0000)]
Add two missing Copyright headers and file annotations.

11 years agoRename SERVER_AUDIO_FORMATS to AUDIO_FORMAT_HANDLERS.
Andre Noll [Sat, 6 Apr 2013 15:42:54 +0000 (15:42 +0000)]
Rename SERVER_AUDIO_FORMATS to AUDIO_FORMAT_HANDLERS.

The audio format handlers are used by para_server, para_afh and
para_play, so the old name was misleading.

11 years agoconfigure.ac: Shorten config summary.
Andre Noll [Wed, 27 Mar 2013 02:51:38 +0000 (02:51 +0000)]
configure.ac: Shorten config summary.

With many filters/writers the output line becomes rather long.
Moreover, filters and writers are also used by para_play but para_play
is not mentionend in the prefix. Just skip the prefix.

11 years agomanual: Don't try to enumerate audio formats.
Andre Noll [Mon, 25 Mar 2013 23:08:59 +0000 (23:08 +0000)]
manual: Don't try to enumerate audio formats.

This is a high-level description where no details
are needed. Flac was missing anyway.

11 years agoamp: Remove stray comment.
Andre Noll [Fri, 5 Apr 2013 20:10:56 +0000 (20:10 +0000)]
amp: Remove stray comment.

11 years agoAdd documentation of public functions in check_wav.c.
Andre Noll [Thu, 4 Apr 2013 17:00:01 +0000 (17:00 +0000)]
Add documentation of public functions in check_wav.c.

The init, shutdown, pre_select and post_select functions of this
file are exported via check_wav.h, so they should be documented. This
commit adds doxygen comments for all of them.

11 years agostring.c: Fix typo in documentation of skip_cells().
Andre Noll [Wed, 27 Mar 2013 14:47:39 +0000 (14:47 +0000)]
string.c: Fix typo in documentation of skip_cells().

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 agobtr: Handle zero-sized buffers gracefully.
Andre Noll [Sun, 23 Dec 2012 22:58:17 +0000 (23:58 +0100)]
btr: Handle zero-sized buffers gracefully.

There is no need to abort on the attempt to add a zero sized buffer.
Let's be gentle and make this condition a noop rather than a fatal
error.