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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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().
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.
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.
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.
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.
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.
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.
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.
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.
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.
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().
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.
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.
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.
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).
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.
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.
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.
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.
Andre Noll [Mon, 23 Jul 2012 19:50:40 +0000 (21:50 +0200)]
server: Remove "foo" feature.
Oops, this feature was added only for testing feature negotiation
with multiple features and should have been deleted before 0.4.11 was
released. This was even mentioned in the commit message of e151dbb7,
which introduced the bogus "foo" feature..
Andre Noll [Tue, 24 Jul 2012 06:42:23 +0000 (08:42 +0200)]
com_init(): Send error message only for non-sideband connections.
If com_init() fails, this non-sideband error message is currently
sent also for sideband connections, which confuses the client. Send
it only for non-sideband connections.
Andre Noll [Mon, 23 Jul 2012 06:41:23 +0000 (08:41 +0200)]
fade: Fix command for switching moods.
It contained a newline, which was not a problem before the sideband
API was introduced. However, with sideband being the default, the
newline character is interpreted as part of the name of the mood or
playlist, causing the mood switch to fail.
The fix is simple: Just remove the trailing newline character.
Andre Noll [Sun, 8 Apr 2012 19:31:10 +0000 (21:31 +0200)]
btr_exec_up(): Also ask given node.
At the moment, the buffer tree walk starts at the parent of the given
node. Users of the btr API can not execute a command for a node unless
it has at least one child.
This unnecessary restriction is removed in this commit by letting
the tree walk start at the given node rather than its parent.
This actually simplifies the code a bit.
Andre Noll [Tue, 23 Aug 2011 19:04:02 +0000 (21:04 +0200)]
btr: Introduce btr_add_output_dont_free().
At the moment, all buffers which are fed to a buffer tree must be
allocated on the heap since the buffer tree code automatically frees
the buffer once its refcount dropped to zero.
The new afh receiver, however, mmaps the audio file and likes to feed
chunks of this memory map into the buffer tree. This is currently
impossible because such buffers must not be freed.
This patch adds the new public function btr_add_output_dont_free()
which works like btr_add_output() but sets the new dont_free bit
which prevents the buffer from being deallocated.
Also btr_inplace_ok() is changed to return "false" whenever there
exists a buffer in the input queue with the dont_free bit set.
Andre Noll [Mon, 9 Apr 2012 19:57:54 +0000 (21:57 +0200)]
btr: Remove btr_free_node().
This has turned out to be source for bugs. Deallocate everything
in btr_remove_node() hence making removing the node and freeing
its resources an atomic operation.
To avoid dangling pointers to freed btrn nodes, the argument of
btr_remove_node() is changed to to struct btr_node **btrnp.
Andre Noll [Mon, 9 Apr 2012 23:43:38 +0000 (01:43 +0200)]
command_util: Fix make dependencies for *_command_list.h.
The *_command_list.h files depend on the .c files listed in the SF
header line of the .cmd command file because command_util.sh gets
the declaration of the command handlers from these files.
Unfortunately, make does not know about these dependencies, so we
have to mention them in the Makefile as well.