| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Now that para_write is the only user of the check_wav API, we no longer
need to play preprocessor tricks to make a copy of the wav related command
line options.
|
| |
|
|
|
|
| |
It has only one caller, which passes NULL as the child node, so this parameter
can be removed. The cw_btrn parameter is also unnecessary because the caller
may as well use cwc->btrn directly.
|
| |
|
|
|
|
| |
With the resample filter gone, para_write is the only remaining user of the
check_wav API. Make the check_wav code local, make all functions static,
and dedoxify the documentation.
|
| |
|
|
|
| |
File comments for write.[ch], the usual cleanups and dedoxification and the
improved comment for main() of write.c.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With the current API it is impossible to free the memory that was allocated
by stdin_task_register() after schedule() returns. This commit replaces the
APIs defined in stdin.h and stdout.h to remove the memory leaks which are
inevitable with the old API. We also make struct stdin_task and stdout_task
opaque because the API users (client.c, filter.c, recv.c and write.c) should
not be able to manipulate the fields of these structures directly.
The new stdout API differs from the new stdin API only in that stdout_new()
needs an additional argument to let the caller pass in a pointer to the
parent buffer tree node. Other than that, the APIs are symmetric.
Use the opportunity to do the non-blocking dance in std{in,out}_new()
and std{in,out}_free() rather than in the post-monitor functions. This
way we may get rid of the silly ->must_set_nonblock_flag boolean of struct
std{in,out}_task.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
The variable is not used outside of setup_and_schedule(), so there is no
reason for it to be global.
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A medium sized series for the build system which improves the way the git
version string is stored in the executables and man pages. Subsequent patches
of the series remove some warts from the makefile: we no longer use order-only
dependencies and the .PRECIOUS target.
The merge results in a conflict against the "remove regex include" commit
67388cd4fae0. This is trivial to resolve, though.
* refs/heads/t/build:
Doxify version functions.
Doxify OV_EXCLUDE_STATIC_CALLBACKS #define.
Makefile: Fix braino in tarball target.
build: Remove superfluous dependency in Makefile.real.
build: Remove the .PRECIOUS target.
build: Improve clean targets.
build: Get rid of directory order-only dependencies.
build: Compile with -Wunused -Wall also on BSD.
build: Revamp git versioning.
build: Merge version.{c,h} into string.{c,h}.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
This is a preparatory patch for the upcoming revamp of the git
version script. The revamped script generates version.c, a file
which is currently tracked by git. We can easily get rid of it (and
of version.h) since all paraslash executables link in both string.o
and version.o. So let's move the three small functions of version.c
to string.c and their declarations from version.h to string.h.
|
| |/
|
|
| |
Every .c file includes it anyway.
|
| |
|
|
|
|
| |
Currently we have ~15 error codes which indicate an EOF condition. One
should suffice, so drop all codes except the generic E_EOF and use
that everywhere.
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This series implements a new memory allocation API which checks
for overflows. The first part of the series just renames the main
allocation functions. Later patches in the series implement allocators
which take two size_t arguments (like calloc(3)) and check whether the
multiplication overflows by employing the __builtin_mul_overflow()
primitive supported by gcc and clang. This requires us to bump the
lowest supported gcc and clang version.
* refs/heads/t/overflow:
build: Compile with -ftrapv.
string: Introduce arr_zalloc().
string: Introduce arr_alloc().
string: Introduce arr_realloc() and check for integer overflow.
string: Rename para_calloc() -> zalloc().
string: Rename para_malloc() -> alloc().
string: Overhaul para_strdup().
|
| | |
| |
| |
| |
| |
| | |
Adjust all callers which pass a product of two integers to zalloc()
to call the new function instead and reduce zalloc() to a one-line
wrapper.
|
| | |
| |
| |
| |
| | |
Reword the documentation a bit since the function has never been a
wrapper for calloc(3). No code changes.
|
| | |
| |
| |
| |
| |
| |
| | |
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.
|
| |/
|
|
|
|
|
|
|
|
|
|
|
| |
This modifies the public struct sched so that users pass in the
default timeout as an integer value in milliseconds rather than
a struct timeval. This simplifies the code a little and eases the
transition from select(2) to poll(2) because poll(2) also takes a
plain integer for the timeout.
Since para_select() of fd.c now calls ms2tv() to convert the timeout
back to a struct timeval, all executables which link with fd.o must
also link with time.o. This was not the case for para_mixer and
para_audioc, so configure.ac needs to be adjusted accordingly.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
}'
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This replaces the gengetopt file write.m4 by write.suite.m4, making use
of the shared macros in m4/lls/include for --channels, --sample-format
and --sample-rate.
The gengetopt files for these options are not needed for the unconverted
executables which still rely on gengetopt, so they can be removed.
In write.c we now use LLS_COPY_WAV_PARMS() rather than
COPY_WAV_PARMS(). The latter macro becomes unused and is removed
as well.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit removes error2.c and the surrounding infrastructure of
the build system, getting rid of ~600 LOC.
After the change there are no more subsystems for error codes, and we
don't need to host-compile error2.c any more. Since all executables
now contain the text of every error code, the change has some impact
on the sizes of the (stripped) executables:
Before: After:
64K para_afh 71K para_afh
43K para_audioc 47K para_audioc
256K para_audiod 259K para_audiod
64K para_client 71K para_client
39K para_fade 47K para_fade
141K para_filter 144K para_filter
51K para_gui 59K para_gui
252K para_play 255K para_play
97K para_recv 104K para_recv
227K para_server 230K para_server
60K para_write 67K para_write
This increase in size is justified by the major simplification.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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().
|
| |
|
|
|
|
|
|
|
|
|
| |
Before struct task can be made private to sched.c we must eliminate
code which directly accesses the fields of this structure. The last
offender is ->error: in many places we check this field to detect
whether some task is in an error condition.
This patch provides a public accessor function, task_status(),
for this purpose. All users of ->error are modified to call this
function instead.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
This renames stdin_set_defaults() to stdin_task_register() and changes
the function to register the stdin task. Before this patch, the task
was registered in the callers.
|
| |
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| |
|
|
| |
Better late than never.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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().
|
| |
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
This adds the #include statement for stdbool.h to para.h. This allows
to get rid of the individual includes in *.c.
More importantly, since all *.c files include para.h, booleans will
now be available everywhere so that we won't need to touch dozens of
files anymore whenever a boolean is added to a public structure.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The interactive completion code must be able to run a second,
independent scheduler instance for generating the possible completions.
This is currently not possible because the pre_select and post_select
list heads of the scheduler are defined globally in sched.c.
This patch moves these list heads from sched.c to struct sched. This
leaves only the global "now" variable in sched.c, but it is OK to
update this from all scheduler instances, so it can stay.
Moving the two list heads to struct sched requires that several
public functions, among them register_task(), grow an additional
parameter. The (mostly trivial) changes that update all callers to
provide the new argument make the patch rather invasive, unfortunately.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function parses the argument of the --writer option to extract
the name of the writer, which is the first word of the argument. If
this word is not the name of a supported writer, the function
returns NULL to indicate that the given writer does not exist.
Otherwise check_writer_arg() calls the ->parse_config_or_die method
of this writer which parses the remaining part of the argument and
exits on errors.
It is more consistent and simpler to let this function exit also
in case the writer was not found. This simplifies the callers a bit
since they do not have to check the return value any more. It also
allows to kill E_WRITE_COMMON_SYNTAX.
|
| |
|
|
|
| |
This value was used but no code path existed that would actually
return this error, so remove it.
|
| |
|
|
|
| |
The old name was a leftover from the long ago when para_write
started to use the buffer tree API.
|
| |
|
|
|
| |
This function is only called from write.c, so move it there and make
it static.
|
| |\
| |
| |
| |
| | |
Conflicts:
Makefile.in
|
| | |
| |
| |
| |
| |
| |
| |
| | |
This gets rid of quite some inclusions of <dirent.h> which are not needed
as most .c files do not deal with directories at all.
afs.c doe not mmap anything and needs nothing from sys/time.h so remove
these includes as well.
|