summaryrefslogtreecommitdiff
path: root/write.h (follow)
Commit message (Collapse)AuthorAge
* Switch to SPDX identifiers.Andre Noll2026-03-17
| | | | | | | | Generated with sed -i 's|Copyright.*Andre Noll.*|SPDX-License-Identifier: GPL-2.0 */|g' *.c *.h followed by manually tweaking the result a bit. No license change intended.
* Improve writer documentation.Andre Noll2025-10-08
| | | | | File comments for write.[ch], the usual cleanups and dedoxification and the improved comment for main() of write.c.
* Make struct sched private, introduce sched_new().Andre Noll2025-07-13
| | | | | | | | | | | | | | | | This moves the declaration of the structure from sched.h to sched.c because the information stored in this structure has almost no users outside of the scheduler core. As a result, the size of the structure is no longer known outside of sched.c. To initialize a scheduler instance, users now must call the new sched_new(), passing an alternative poll function if needed, We don't let applications set the default timeout anymore because the value is kind of arbitrary anyway and most users specified one second. So hardcode this as the default. Besides allocating the scheduler structure, sched_new() also initializes the task list and the poll function pointer. Thanks to these initializations, the two conditions of sched.c removed in this patch are never true.
* Remove ->execute() of struct writer.Andre Noll2025-06-25
| | | | No writer implements this method.
* Rename ->{pre,post}_select methods to ->{pre,post}_monitor.Andre Noll2022-08-25
| | | | | | | 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.Andre Noll2022-08-25
| | | | | | | | | | | | | 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.
* Teach writers to abort gracefully on early EOF.Andre Noll2021-10-21
| | | | | | | | | | | | | | | | | | | | For very short streams it may happen that the receiver and decoder unregister themselves from the buffer tree before the writer had a chance to query the information from the decoder which it needs to open the audio device. This leads to errors such as Aug 25 14:24:51 schubert (5) get_btr_value: cmd sample_rate: Operation not supported Aug 25 14:24:51 schubert (5) get_btr_value: cmd channels: Operation not supported Aug 25 14:24:51 schubert (5) get_btr_value: cmd sample_format: Operation not supported Aug 25 14:24:51 schubert (4) alsa_init: channels count not available: Invalid argument This may happen with all receivers, audio formats and writers, although it is most common with ogg streams. This commit changes get_btr_sample_rate() and friends to return a standard error code rather than assuming success. The alsa, ao and oss writers are patched to check the return value and fail gracefully if one of these functions fails.
* Shorten copyright notice.Andre Noll2017-09-22
| | | | | | | | | | | | | | | | | | | | | 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 }'
* Convert writers to lopsub.Andre Noll2017-03-26
| | | | | | | | | | | | | | | | | | | | | Similar to the previous commits for receivers and filters, this commit replaces the five gengetopt parsers for the alsa, ao, file, oss, osx writers by a lopsub suite and links para_write with -llopsub. This allows to get rid of the WRITER_ENUM and the writers array as a reference to each writer structure are stored in the lopsub user_data pointer. Moreover, ->init(), ->parse_config(), ->free_config() and ->ggo_help() of struct writer are not needed any more and can be removed. The patch also removes write_common.h and moves the few prototypes write.h. Now that receivers, filters and writers have all been converted, we may also stop to include ggo.h from audiod_command.c and play.c. As for the receivers and filters, t0005 needs slight adjustments due to the new section header in the man page.
* Update year in copyright headers.Andre Noll2015-01-12
| | | | | | | | | | | | | | | | 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.
* Assorted typo fixes in comments.Andre Noll2015-01-11
| | | | Quite a few..
* doc: Change email address to maan@tuebingen.mpg.deAndre Noll2014-08-18
| | | | | | | | | | | | | | 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().Andre Noll2014-05-25
| | | | | | | | | | | | | | | 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: writersAndre Noll2014-05-25
|
* Change copyright year to 2014.Andre Noll2014-02-22
| | | | | | | | | 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
* sched: Rename new_post_select back to post_select.Andre Noll2013-04-30
|
* sched: Kill old ->post_select variant.Andre Noll2013-04-30
| | | | It has no more users.
* sched: Provide alternative post_select variant.Andre Noll2013-04-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.Andre Noll2013-03-25
| | | | Better late than never.
* write: Get rid of gengetopt's string parser.Andre Noll2012-08-27
| | | | | | | | | | | | | 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().
* write: Remove ->shutdown.Andre Noll2012-07-08
| | | | | No writer implements this method, and nobody even looks at this pointer. Remove it.
* Change year in copyright message to 2012.Andre Noll2012-01-07
|
* doxygen: Add some missing documentation.Andre Noll2011-05-15
|
* Replace 2010 in copyright message by 2011.Andre Noll2011-01-17
|
* writers: Kill ->open.Andre Noll2010-11-23
| | | | | Now that ->open is a dummy function for all writers, we may safely remove this method from struct writer and kill the dummy functions.
* Change the ->open method of writers to void.Andre Noll2010-11-23
| | | | | These methods always succeed. Add missing documentation of the public register_writer_node() function while we're at it.
* write: Simplify config parsers.Andre Noll2010-11-23
| | | | | | These functions all call the gengetopt parser which aborts on errors. It is therefore pointless to check the return value. Document this fact and make it explicit by renaming ->parse_config of struct writer to ->parse_config_or_die().
* Rename some variables to avoid warnings on old gcc versions.Andre Noll2010-08-01
| | | | | | | | | | Fortunately, gcc-4 no longer warns on these. However, gcc-3.3 is still supported for compiling paraslash, so rename "index" to "idx" and "conf" to "config" to get rid of warnings of the form wmadec_filter.c:1013: warning: declaration of `index' shadows a global declaration Add documentation of ->free_config() while we're at it.
* Change year in COPYRIGHT to 2010.Andre Noll2010-04-05
| | | | Hey, this is earlier than last year :)
* Skip btr suffix from {pre,post}_select_btr().Andre Noll2010-01-13
| | | | | Everything uses btr now, so there's no need for a suffix any more. Update the documentation a bit.
* Kill unused writer_node_group code.Andre Noll2010-01-13
|
* Switch audiod over to the buffer tree API.Andre Noll2010-01-07
| | | | Still a bit rough and there are too many btr merges.
* Introduce prepare_writer_node().Andre Noll2010-01-04
| | | | Unused yet.
* Add execute handler to struct writer.Andre Noll2009-12-31
|
* [btr]: Minor improvements and cleanups.Andre Noll2009-12-29
|
* write/alsa: Add btr support.Andre Noll2009-12-29
| | | | | | | Not yet finished. Supporting btr required some changes in the buffer tree code as well.
* wng: Avoid buffer underruns due to filter chain output buffer constraints.Andre Noll2009-11-05
| | | | | | | | | | | | | | | | | | Using ogg vorbis streams together with the oss writer hits the following nasty bug: In case the filter chain can provide more data than what fits into its output buffer, it converts the maximal amount possible to completely fill its output buffer. However, the time to play this data might be less than than the time until the next data packet arrives from the upper layers, especially when using ogg vorbis streams and FEC. Since the filter chain task has no pre_select function, the convert function(s) of its filter nodes only get the chance to convert more data until the next select call returns, which might already be too late. This patch fixes the bug by teaching the pre_select function of the writer node group to remember whether something was written during the previous call to wng_post_select(). In this case we force a minimal timeout for select, i.e. the next call to select() will return immediately and the convert functions of the filter node are called again, hopefully converting more data for the writer node group.
* struct writer_node: Store the number of the writer rather than a pointer.Andre Noll2009-05-14
| | | | | This makes it easier to get the name of the writer from the writer_node struct.
* Use only a single buffer pointer for filters/receivers.Andre Noll2009-05-02
| | | | This allows filters to change the output buffer size on the fly.
* write: Get rid of wn->chunk_bytes and wng->max_chunk_bytes.Andre Noll2009-03-15
| | | | These are not used anyway. Make all writers return 1 on success.
* Fix a typo in the documentation to struct writer.Andre Noll2009-03-12
|
* Change year of copyright from 2008 to 2009.Andre Noll2009-01-10
|
* Improve help/man page of para_write.Andre Noll2008-12-06
|
* Replace MAX, MIN, ABS macros by type-checking variants.Andre Noll2008-12-01
| | | | Taken from the Linux kernel. These macros also evaluate each parameter only once. Fix up all resulting gcc warnings.
* write.h: Cosmetics.Andre Noll2008-11-28
|
* Fix a bug in para_write.Andre Noll2008-07-12
| | | | | | | | With the old code, the command "para_write < /dev/null" would segfault because the wng_close() is called although the writer node group was never opened. Fix this bug by introducing a new field in struct writer_node_group that tracks whether wng_open() was called.
* Simplify the scheduling code.Andre Noll2008-03-30
| | | | | | | | | | | | | | | | | | | | | | - Get rid of sched->select_ret. Tasks shouldn't care about the return value of the select call. - Kill task->private_data. Use container_of() instead. - Remove task->event_handler. It is never necessary and only makes the code more convoluted. The scheduler unregisters tasks as soon as either the pre_select or the post_select functions return an error. - Rename task->ret to task->error and get rid of a couple of error fields in other structs that usually only contained a copy of the task's error value. This conversion likely introduces many bugs that have to be shaken out in subsequent patches. Hopefully it will result in less error-prone code in the long run.
* Change year in Copyright comment from 2007 to 2008.Andre Noll2008-01-08
|
* Replace eof by error in receivers/filters/writers.Andre Noll2007-12-15
| | | | | | | | | | This way it's possible to tell at a later time why the receiver/filter/writer terminated. This allows to increase the delay for reconnecting in case the receiver failed to connect to para_server: Let the receivers set the error value to -E_RECV_EOF in case a normal end of file event occurred and check this value when calculating the restart barrier.
* Fix some typos.Andre Noll2007-12-15
|