Merge branch 'refs/heads/t/sha256' A couple of changes which start to eliminate the use of sha1 in favor of sha256. This series is only the first step, though, as we need to keep sha1 for the time being to provide backward compatibility. Cooking for four months. * refs/heads/t/sha256: manual: Avoid sha1. upgrade_db: Add copyright and purpose to upgrade_db.c. web: Add link to the para_upgrade_db(1) man page. afs: Switch to sha256 and change default database path. Add para_upgrade_db. Use sha256 for the challenge response. Introduce hash2 (sha256). Assume sideband and aes_ctr128 are always supported/requested.
Add para_upgrade_db. This new executable is required to convert existing paraslash databases to the new format. Only the layout of the audio file table changes due to the switch from sha1 to sha256. The command creates and opens a new audio file table and copies over each row, using an arbitrary (incorrect) hash value for the values in hash column of the destination table. After all rows have been copied in this way, the old table is deleted and the database directory is renamed from afs-database-0.4 to afs-database-0.7, which will be the default path in paraslash-0.7. Subsequent patches will modify para_server to load the database from the new path and use sha256 instead of sha1 for the hash that identifies the audio file. The user must then start the thusly patched para_server and force-add all audio files to correct the hashes. This approach keeps para_upgrade_db minimal and shortens its running time.
New configure option: --enable-ubsan. If the new option is given, -fsanitize=undefined is passed to the compiler to enable the undefined behavior detector. We don't check whether this option is supported because the configure option is off by default.
Version 2 moods. This introduces a context-free grammar for moods. The parser for the corresponding language (the version 2 mood parser) is generated by flex and bison and will eventually replace the open-coded parser for traditional (version 1) moods. Those are still supported, but the server now logs a deprecation warning when a version 1 mood is loaded, Loading a version 2 mood is a two step procedure. In the first step the bison parser reads the mood definition stored in the moods table of the afs database. If there are no errors, the parser returns an abstract syntax tree which represents the syntactic structure of the mood definition. In the second step the abstract syntax tree is evaluated for each row of the audio file table in turn. If the evaluation function returns true, the audio file is considered admissible. In this case a reference to the row is added to the score table in the same way the version 1 mood parser stores the set of admissible files. The commit adds the following new files to the repository: * yy/mp.lex: the lexer * yy/mp.y: the bison parser * yy/makefile: rules for building the parser, included from main Makefile * mp.c: frontend (high-level API) and backend (helpers for yy/mp.[ch]) * mp.h: backend data structures and function prototypes The frontend is only needed in the existing mood.c, which now also contains the declarations of the frontend API so that mp.h needs only be included by the lexer and the parser. The comment at the top of mp.c gives an overview of the mood parser API. All non-static functions of mp.c (both frontend and backend) are fully documented. The section on moods of the user manual has been rewritten and extended. Since flex and bison are required to build para_server, the list of optional software packages now mentions these tools, with links to their home page. If either tool is not installed, the configure script succeeds but para_server will not be built.
build: Run lopsubgen with absolute path. The configure script detects the location of the lopsubgen executable, but we never use this information and rely on the shell to find the executable in $PATH when the recipes in m4/lls/makefile are run. This should not matter much, but it is inconsistent to how we deal with m4. Moreover, using the LOPSUBGEN autoconf variable in the recipes allows the user to override the path at build time.
Merge branch 'refs/heads/t/lopsub' The bulk of the changes in this release is the conversion of all command line parsers from gengetopt to lopsub. The series also contains a few cleanups that have become possible due to the switch from gengetopt to lopsub. The patches towards the end of the series rename para_fade to para_mixer. Naturally, the merge conflicted rather heavily against the other topic branches that have been merged since the lopsub branch was started. Conflicting files: Makefile.real afh.c afh_recv.c configure.ac osx_write.c write.c The resolutions for these conflicts were recorded with git rerere and have been tested for quite some time. Cooking for three weeks. * refs/heads/t/lopsub: (74 commits) audioc: Avoid double free in audioc_i9e_line_handler(). audiod: Avoid uninitialized memory access. Simplify mixer setup. mixer: Implement non-linear time scale for fading. mixer: Allow arbitrary relative time for sleep subcommand. Convert para_fade to subcommands, rename it to para_mixer. build: Create .dep files only during compilation. build: Simplify definition of $m4_lls_deps. build: Rename command list variables. build: Combine $(CFLAGS) and $(STRICT_CFLAGS). build: Let .d files depend only on .c. build: Don't create phony targets for dependencies. build: Remove duplicate dependency. build: Remove cmdline_dir and friends. build: Remove some unused variables from Makefile.real. build: Remove m4/gengetopt. Remove gengetopt and help2man checks from configure.ac. Remove man_util.bash. Remove ggo.c and ggo.h. manual: Do not mention gengetopt and help2man any more. ...
Merge branch 'refs/heads/t/dynamic_chunks' A rather long and intrusive series that finally improves the aac decoder and audio format handler. The merge had a minor conflict in error.h, which was easily resolved by removing both affected error codes. Cooking for a month. * refs/heads/t/dynamic_chunks: (24 commits) afh_recv: Check return value of afh_get_chunk(). aacdec: Decode only one frame per iteration. aacdec: Combine aac_open() and aacdec_open(). aacdec: Make "initialized" a boolean. aacdec: Make frame_info local to ->post_select(). aacdec: Remove pointless assignment. aacdec: Remove pointless check and improve comment. aacdec: Rename buffer variables. aacdec: Remove pointless variable p. aacdec: Remove check which is always true. aacdec: Kill pointless label. aacdec: Remove superfluous assignment. aacdec: Improve and silence error message. aacdec: Prefer NeAACDecInit() over NeAACDecInit2(). aacdec: Don't eat full buffer on errors. Combine aacdec and aac_common. Convert the aac audio format handler to libmp4ff. aac_afh: Don't create chunk tables any more. afh: Dynamic chunks. server: Store max chunk size in database. ...
Merge branch 'refs/heads/t/makefile_conventions' A bunch of changes which strive to make the paraslash build system more standard. Cooking for three months. * refs/heads/t/makefile_conventions: build: Add target "check" as a synonym for "test". build: Rename target "tarball" to "dist". build: Do not strip installed executables by default. build: Support $(DESTDIR). build: Rename clean targets.
Convert para_fade to subcommands, rename it to para_mixer. para_fade operates in one of several modes, but the command line options are shared. So most of the options are ignored for any particular mode. With lopsub we can do better and define one subcommand per mode so that options which are only relevant to one subcommand can be made local to that subcommand. With subcommands the syntax of the command changes, which breaks existing scripts. So it seems to be prudent to rename the executable from para_fade to para_mixer. The old name was a bit misleading anyway since the command can do much more than just fade the volume.
Remove gengetopt and help2man checks from configure.ac. The build system no longer depends on these tools, so the checks have become unnecessary.
Convert writers to lopsub. 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.
Convert filters to lopsub. This replaces the *_filter.m4 gengetopt files by the filter_cmd lopsub suite, where each filter is realized as a subcommand. Due to this change, para_filter needs to be linked with -llopsub. The filter structure is now stored in the user_data pointer provided by lopsub, allowing to get rid of the global filters[] array, the FILTER_ENUM macro and the corresponding enumeration constants. The removal of the ->goo_help member of struct filter makes this structure constant. Hence ->init() of struct filter can also go away. We still can tell whether a filter is supported by checking the user_data pointer: if it is NULL, the filter is unsupported. The new filter_supported() helper in filter_common.c is provided for convenience. Parsing of the filter command line options is now performed generically, and the ->parse_config() method is renamed to ->setup(), an optional function which is supposed to perform semantic checks and the one-time setup of the filter, if any. It is accompanied by ->teardown() which replaces ->free_config(). The conversion of the individual filters is easy since most filters have a simple syntax or take no arguments at all. The resample_filter, however, needs a different way to copy the wav parameters from the lopsub parse result to the wav parms structure. A suitable macro, LLS_COPY_WAV_PARMS is added to check_wav.h for this purpose. The old COPY_WAV_PARMS needs to stay until para_write, the only other user of the macro, has been converted as well. The section heading of the manual page has changed slightly, causing t0005 to fail. Hence this test needs a slight adjustment.
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.
Convert audiod commands to lopsub. The four command lists (server, afs, audiod, play) and all executables will be converted to the long option parser library (lopsub). This first patch converts the audiod commands (on, off, cycle...) and adds the necessary infrastructure to the build system. The option parser for para_audiod is still generated by gengetopt and will be converted in a subsequent patch. The build system is updated to include an autoconf test which checks for the lopsub library and the lopsubgen executable. If the check fails, it prints instructions on how to download the lopsub package. Moreover, a section on lopsub is added to the INSTALL file and the library is listed as a required tool in the manual. The options and help texts of all audiod commands are moved from audiod.cmd to the new file audiod_cmd.suite.m4. Until all command lists are converted, man_util.bash needs an ugly hack to deal with the two kinds of files. The help texts have been reworked slightly, but no syntactical changes were performed. However, one side effect of the change is that options to audiod commands now accept short and long options, and that short options may be combined in the usual way. The error subsystem of paraslash is extended to treat lopsub errors analogous to errors from the osl libary: we reserve a new bit for error codes returned from lopsub library functions and a lls() wrapper function that must be used for all lopsub functions which return a lopsub error code on failure. The E_INVALID_AUDIOD_CMD error code can be removed since invalid commands are now detected by the lopsub library, which returns its own error code in this case. As a result of the conversion, struct audiod_command can be removed. Command handlers now take a pointer to a lopsub parse result instead of the (argc, argv) pair. The patch also changes the completers for audiod commands in audioc.c. to use the information in the generated audioc_cmd.lsg.h header file instead of duplicating this information. With the patch applied, para_audiod and para_audioc need to be linked with -llopsub. We still need to include ggo.h from audiod_command.c until receivers, filters and writers have been converted as well.
Convert the aac audio format handler to libmp4ff. This changes the aac audio format handler to call the primitives provided by the mp4ff library. This allows to remove the atom parsing code from aac_afh.c. After this change para_server, para_afh, and para_recv no longer depend on aac_common.c and on the mp4v2 library. The autoconf tests for libmp4v2 are removed from configure.ac. A subsequent commit will deal with aac_common.c.
build: Do not strip installed executables by default. The "install" target currently strips all executables while installing them, which is not recommended according to GNU conventions. Instead, there should exist the "install-strip" target for this purpose. Moreover, the current install target assumes the GNU variant of the install utility because we call install with --strip-program, an option which is not available on *BSD. This patch addresses both issues. It removes the autoconf check and lets the user directly define the path to the install executable by setting INSTALL, INSTALL_PROGRAM, INSTALL_DATA, as recommended by the GNU project. These variables are used in the commands to be executed when the install target is made. They have reasonable and portable defaults, so not setting them at all should be fine on all supported platforms, addressing the issue with --strip-program. The new phony target install-strip runs install -s but does not try to be smart about how to tell the install implementation which strip program to use. The cross compiling example can be simplified to reflect the fact that CROSS_COMPILE is no longer used in the Makefile.
build: Remove compatibility check for clock_gettime(). Only Mac OS (which is no longer supported) did not have it. Moreover, on Linux we used to check whether one needs to link with -lrt to obtain clock_gettime(), which is necessary for glibc versions 2.16 and earlier (released in 2012). All distributions should have moved on to newer glibc versions by now, so let's get rid of the check.
Drop support for Mac OS. This software hasn't been tested on Mac OS for years, so Mac OS support is most likely already broken. This commit removes the osx writer and the autoconf tests for core audio, and adjusts the documentation to not mention Mac OS anymore. It also effectively reverts commit be1074b4 which introduced an ugly workaround in interactive.c that was only needed on Mac OS.
Simplify the error subsystem, get rid of error2.[ch]. 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.
build: Remove @socket_ldflags@ and @nsl_ldflags@. These are not needed on any supported platform and the corresponding make variables are always empty.