Rename ->{pre,post}_select methods to ->{pre,post}_monitor. The word "monitor" is neutral and continues to be correct after the switch from select(2) to poll(2). Pure rename, nothing to see here.
Consolidate receiver/filter/writer {pre,post}_select() docs. The documentation of these three ->pre_select() and ->post_select() methods overlapped quite a bit. Some comments stated general properties of the sched API which fit better in the documentation of sched.h, so move these bits there. Improve the text a bit while at it and avoid talking about select(2) and fd sets as these are implementation details. Instead, focus on the general concept of fd monitoring. Pure comment cleanups, no code changes.
Remove ->init() of struct receiver. The previous patch removed the ->init() method of the afh receiver. Since the afh receiver was the only receiver that defined an init method, the method can now be removed from struct receiver. As a consequence, recv_init(), which calls each receiver's init method has become a no-op and can also be removed.
Shorten copyright notice. The GPLv2 line does not add any additional information, so drop it. This leaves a single line of legalese text for most files, which is about the amount of screen real estate it deserves. This patch was created with the following script (plus some manual fixups): awk '{ if (NR <= 5) { gs = gensub(/.*Copyright.* ([0-9]+).*Andre Noll.*/, "\\1", "g") if (gs != $0) year = gs next } if (NR == 6 && year != "") printf("/* Copyright (C) %s Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */\n", year) print }'
doxygen: Improve documentation of struct receiver. The documentation still referred to the former gengetopt related ->conf pointer and also had some language and punctuation issues. The new text should fix this, and is more to the point.
doxygen: Add \ref to references. This way doxygen issues a warning if the file/function/structure no longer exists and a stale reference remains.
doxygen: Remove some stale doxygen references. When we switched to lopsub, the callback request functions became unused and were removed. At the same time, all command handlers were made static, so they are no longer part of the doxygen documentation and we shouldn't refer to them any more. Also struct slot_info and the server_uptime variable have been made private to their respective files audiod and time.c. Tthe latter was in fact replaced by a timeval struct long ago. The http and udp receivers don't have an init function any more, and get_chunk_table_of_row() was removed ten years ago in commit 54a480ae. Most references of the source code documentation will be annotated with \ref in a subsequent commit to avoid this kind of documentation bug in the future.
Convert receivers to lopsub. This converts the four receivers (afh, http, dccp, udp) to use the lopsub library instead of gengetopt. The command line options of the receivers are implemented as subcommands of the new recv_cmd lopsub suite. Hence the four gengetopt command line parsers and ->ggo_help of struct receiver can be removed. This change allows to get rid of the receiver array which was defined through the DEFINE_RECEIVER_ARRAY macro. We now store each receiver structure in the user_data pointer provided by lopsub. Since this structure is initialized at compile time (and constant since ->ggo_help is gone), ->init() of struct receiver is no longer needed to initialize the various function pointers. The function is now optional and does not take an argument any more. At the moment, only the afh receiver needs ->init() to initialize all supported audio format handlers. t0005 needs slight adjustment since the section headers of the help text have changed a bit.
Update year in copyright headers. Done with files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2014\)* Andre Noll') sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2014 Andre Noll/Copyright (C) \1 Andre Noll/1' $files In previous years we ran a similar script to set the second year in the range to the current year. This is kind of silly, so let's get rid of this useless information. This commit replaces "Copyright (C) A-B" by "Copyright (C) A" in all file headers, i.e. only the first year (A) is left in. Accurate information including time stamps for each change can be obtained from the git history.
doc: Change email address to maan@tuebingen.mpg.de The mail server on systemlinux.org was down for more than a week lately, so let's use an alternative official address. This commit changes all maan@systemlinux.org addresses to maan@tuebingen.mpg.de. Most .c and .h files contain the email address in the copyright header, so they must all be patched. Three other files contain the address for a different reason: * README lists email and git, gitweb and home page URLs * configure.ac needs it for configure -h * version.c contains it for the -V option of all commands
sched: Directly pass context pointer to pre/post_select(). The patch is large, but it's fairly straight forward: Instead of a task pointer all ->pre_select() and ->post_select() methods now receive the context pointer that was passed to the scheduler when the task was registered. This allows to kill the public task_context(). Two pre_select/post_select functions are not directly called by the scheduler: session_post_select(), generic_recv_pre_select(). These are changed to receive a proper struct rather than a void pointer. Note that generic_filter_pre_select() is not changed in this manner because some filters do not provide a pre_select wrapper but set task->pre_select to generic_filter_pre_select().
task_register() conversion: receivers This adds a new public function, task_reap(), to sched.c. It is called by para_audiod and para_play to free the memory occupied by the receiver node after EOF. sched_shutdown() can not be used for this purpose since the scheduler stays active during the life time of these programs (i.e. schedule() never returns) while receiver nodes come and go. The new task_reap() has to face the problem that it is called from another task's ->post_select() method, so removing the task being reaped from the scheduler task list is not possible in task_reap(). Hence this patch adds the new flag "dead" to struct task. It is initially unset and is turned on in task_reap() to indicate that (a) the task has exited (i.e. ->post_select() returned negative) and (b) task_reap() has been called to fetch the exit status. Only if this flag is set, the scheduler removes the task from the task list.
Change copyright year to 2014. This year, we're really on time. The changes in this patch were created by the following silly script: files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2013\)* Andre Noll') sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2013 Andre Noll/Copyright (C) \1-2014 Andre Noll/1' $files sed --in-place= -e 's/Copyright (C) 2013 Andre Noll/Copyright (C) 2013-2014 Andre Noll/1' $files
recv.h: Fix comment indentation.
Revamp ggo help. This adds usage and description fields to struct ggo_help and changes ggo_print_help() to optionally print these. The boolean detailed_help flag of ggo_print_help() is replaced by a bitmask which lets the caller specify what to print. Four pre-defined masks are used to print the normal help, the detailed help, the help for modules (receivers, filters, writers) and the detailed module help. The new macro DEFINE_GGO_HELP can be employed to create a struct ggo_help from a gengetopt structure.
sched: Rename new_post_select back to post_select.
sched: Kill old ->post_select variant. It has no more users.
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().
Change copyright year to 2013. Better late than never.
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.