Andre Noll [Mon, 2 Jun 2025 20:48:41 +0000 (22:48 +0200)]
Prefer __func__ to __FUNCTION__.
The former is part of the C99 standard, while the latter is only provided
for backward compatibility. This change also silences many gcc warnings when
compiling with -Wpendantic (disabled in the default build).
Andre Noll [Mon, 2 Jun 2025 22:36:31 +0000 (00:36 +0200)]
Doxgen: Do not omit brief descriptions.
Commit 3107d2411a7a was a bit overzealous because with BRIEF_MEMBER_DESC
and REPEAT_BRIEF both set to NO the short text does not even make it into
the detailed description. This was unintended, so partially revert this change.
Andre Noll [Mon, 2 Jun 2025 19:42:21 +0000 (21:42 +0200)]
Merge topic branch t/wmadec into master
A few patches which remove unused code from the wma decoder and audio
format handler. Notably, noise coding was removed completely since
it was only used for unusual bit rates. Most likely, it never worked
in the first place.
* refs/heads/t/wmadec:
wmadec: Fix typo in comment.
wmadec: Remove a stale comment in wma_init().
wmadec: Kill pointless start/end computations.
wmadec: Remove noise coding.
wmadec: Simplify wma_init().
wmadec: Remove fft().
Andre Noll [Mon, 26 May 2025 18:38:37 +0000 (20:38 +0200)]
Shrink struct rmatt_event_data.
The aft event handler needs to know the bit number of the attribute which is
being removed in order to clear the bit in the afs info structure of each row
of the audio file table. The handler does not need to know the attribute's
name, though, and remove_attribute() already prints it, so remove this field
from the event data structure.
Andre Noll [Sun, 25 May 2025 17:29:57 +0000 (19:29 +0200)]
INSTALL: Remove installation instructions of lopsub.
These days, people should just install the Debian package. If lopsub is not
installed, the configure script prints detailed instructions about how to
obtain lopsub with and without apt.
Andre Noll [Wed, 19 Mar 2025 21:05:16 +0000 (22:05 +0100)]
Introduce VSS_NEW_AUDIO_FILE to fix playlist updates.
The playlist event handler handles afsi change events by moving the affected
entry to the end of the playlist. This is the right thing to do if the
event was triggered by virtual streaming system streaming a new file. It is
incorrect, however, if the event was triggered by a subcommand such as touch.
This commit introduces the new afs event type VSS_NEW_AUDIO_FILE to distinguish
between the two different use cases. The audio file table event handler
ignores the VSS_NEW_AUDIO_FILE event while the playlist event handler ignores
the AFSI_CHANGE event. The moods event handler treats both events equally,
Get rid of a pointless static one-liner function in playlist.c while at it.
Andre Noll [Wed, 14 May 2025 22:27:47 +0000 (00:27 +0200)]
aft: Pass correct afsi argument to AFSI_CHANGE event handlers.
Each time a new audio file is opened for streaming, we update the numplayed
and lastplayed fields of its afs info entry of the audio file table, then
update the global afsi and ahfi structures, then trigger an AFSI_CHANGE event,
which calls all table event handlers. The event handlers receive as arguments
a pointer to the old afsi and a pointer to the already modified aft row.
The AFSI_CHANGE event handler of the audio file table gets called in the
situation described above, and also via the touch and cpsi subcommands,
because these also change the afsi info structure and therefore trigger
AFSI_CHANGE events as well. The handler checks whether the affected audio
file is the current audio file, and if it is, extracts the modified afsi
from the audio file table into the global afsi structure.
The problem is that in case of the above "next audio file" scenario, the
old afsi pointer points to the global afsi structure, which gets updated
by the aft event handler. Therefore the event handlers which happen to run
after the event handler of the audio file table see the already updated afsi
through the old_afsi pointer.
Since the audio file table happens to be the first table of the 7-element
afs_tables[] array iterated by afs_event(), all six other event handlers see
the incorrect afsi. However, only the moods event handler looks at the old afsi
to update the mean and quadratic variation of the lastplayed and numplayed
values of the afs statistics. Due to the bug described above, the old and
new lastplayed and numplayed values coincide, and therefore the statistics
update is a no-op. In practice, at least for moods with many admissible files,
the values will only be slightly off, so the bug is rather benign.
Fix this by renaming the on-stack new_afsi to old_afsi, adjusting
initializations accordingly, and passing a pointer to this instance instead.
Andre Noll [Wed, 21 May 2025 18:36:52 +0000 (20:36 +0200)]
Improve documentation of set_max_chunk_size().
The old text implied that the function could be removed at some point, which
is not the case. Remove this part of the documentation and clarify what the
function actually does.
Andre Noll [Wed, 21 May 2025 18:23:23 +0000 (20:23 +0200)]
Warn about old (0.5.x or earlier) on-disk afhi.
Nine years ago, starting with commit 234647bb5, old on-disk entries are
reported with a notice to re-add the file in order to update the audio file
table. Bump the loglevel for now, and add a comment to turn the check into
a hard error eventually.
Andre Noll [Tue, 20 May 2025 20:47:46 +0000 (22:47 +0200)]
buffer_tree: Assert that we don't pass NULL to memcpy().
The buffer pointer cannot be NULL here because this only happens when the
buffer tree area is full, which is not the case thanks to the previous n <=
btr_pool_unused(btrp) check.
Andre Noll [Tue, 20 May 2025 19:33:04 +0000 (21:33 +0200)]
Merge topic branch t/build into master
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}.
Andre Noll [Mon, 5 May 2025 21:52:42 +0000 (23:52 +0200)]
load_afd(): Double check shared memory sizes.
The shared memory ID is sent by a trusted source, so it is a programming error
(rather than a runtime error that could be handled) if the size of the shared
memory area is smaller than the size of an audio file data structure. Thus,
the right thing to do is to abort immediately in this case.
Andre Noll [Mon, 28 Apr 2025 22:03:26 +0000 (00:03 +0200)]
mp3_afh: Document id3_field_init() and id3_field_finish().
These functions are somewhat obscure because they are not part of the
libid3tag API. They are not part of the internal paraslash API either,
so their documentation should not be shown on the API page. Exclude the
documentation with the doxygen \cond and \endcond markers.
Andre Noll [Sun, 23 Mar 2025 20:53:15 +0000 (21:53 +0100)]
blob: Get rid of the two dummy event handlers.
The four blob operation structures defined in blob.c are created by
a macro which initializes the function pointer for the event handler
to ${name}_event_handler, where $name is the blob type, i.e. one of
images, lyrics, moods, playlists.
Only two of the four, moods and playlists, need an event handler
because the images and lyrics tables ignore events. Currently we
have to define dummy functions {images,lyrics}_event_handler() to
avoid link errors. This extra code can easily be avoided by making
the macros a little smarter.
Andre Noll [Tue, 18 Mar 2025 18:31:33 +0000 (19:31 +0100)]
Check return value of lsu_com_help().
This function fails if an invalid command name is passed as the argument, yet
all callers ignore the error. Modify the callers to print the strerror text as
appropriate and no longer do that in lsu_lopsub_error(). Rename this function
and introduce the error type argument to print more meaningful error messages.
The old name is confusing since we also have struct i9e_completer,
which is a completely different beast. Rewrite the documentation
of the function while at it.
Andre Noll [Mon, 25 Nov 2024 20:55:43 +0000 (21:55 +0100)]
com_select(): Support '-' to reactivate the previous mood/playlist.
This adds two static global variables to afs.c which track the
previously active mood or playlist. The select subcommand now makes
use of this information if the argument is the special string '-'. The
subcommand then follows common Unix conventions and reactivates the
previous mood or playlist.
Andre Noll [Wed, 19 Mar 2025 17:10:42 +0000 (18:10 +0100)]
com_check(): Report inconsistencies consistently.
Currently the various checkers report the inconsistencies they detect
in one of the osl tables to either stdout via the pbout para_buffer
or to stderr by calling afs_error(), Unify this by replacing all
calls to afs_error().
Andre Noll [Wed, 1 Jan 2025 21:24:03 +0000 (22:24 +0100)]
build: Improve clean targets.
In a "fresh build" (e.g. after a make clean) we create the .d and the
.o file in one go to speed up this common case. However, if one runs
"make clean" followed by e.g. "make para_audioc", this will create
*all* object and dependency files, not just the ones needed to build
para_audioc. This behaviour is unfortunate because most dependencies
are irrelevant for a single target, and even the few which do matter
are ignored as well in this case because the object file does not
exist and needs to be recreated anyway,
Work around this shortcoming by shuffling the commands of the four
rules a little so that the clean target only removes object files
but keeps the dependency files.
Also remove the calls to SAY in the recipe of the clean targets because
with the rm commands spelled out it is clear what is being removed.
Andre Noll [Wed, 1 Jan 2025 16:19:47 +0000 (17:19 +0100)]
build: Get rid of directory order-only dependencies.
They only clutter the Makefile for no good reason. Just create all
build directories beforehand when running ./version-gen.sh.
One order-only dependency remains: We want to invoke the compiler
only after all generated .h files have been created. Otherwise the
.d files may be created incorrectly.
Andre Noll [Wed, 1 Jan 2025 00:16:48 +0000 (01:16 +0100)]
build: Revamp git versioning.
This rewrites GIT-VERSION-GEN and renames it to version-gen.sh. The
main difference is that the script now generates version.c rather
than version.h, speeding up the build because switching branches
or transitioning from a clean to a dirty work-tree (or vice versa)
changes the version string. Before the patch, all files which included
version.h were recompiled. With the patch applied, only the short
version.c needs to be recompiled.
The generated version,c defines one function which returns the
single-line version string and a second function which returns
the multi-line version information (author, copyright, git URL
etc). This information is now passed to version-gen.sh via environment
variables. The CPP macros we had before are removed.
Andre Noll [Tue, 31 Dec 2024 23:48:26 +0000 (00:48 +0100)]
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.
Andre Noll [Wed, 19 Mar 2025 23:18:30 +0000 (00:18 +0100)]
Teach the mood parser to not leak on errors.
Attempting to load an incomplete mood definition such as "1 &&"
currently causes memory leaks because the memory for the partial
syntax tree is never freed.
Employ bison's %destructor directive to call mp_free_ast() whenever
a syntax error happens.