paraslash.git
6 years agoMerge branch 'maint'
Andre Noll [Tue, 25 Apr 2017 16:04:57 +0000 (18:04 +0200)]
Merge branch 'maint'

A couple of fixes found by the clang static analyzer.

* maint:
  aft: Check return value of load_afsi().
  audiod: Avoid reading garbage in get_time_string().
  net: Always initialize struct sockaddr_storage.
  wma_afh: Fix two bugs in convert_utf8_to_utf16().

6 years agoMerge branch 'refs/heads/t/xz'
Andre Noll [Mon, 24 Apr 2017 18:05:18 +0000 (20:05 +0200)]
Merge branch 'refs/heads/t/xz'

A single patch which modifies the build system to create xz-compressed
tarballs. The patch conflicted against the changes introduced by the
recently merged makefile_conventions topic branch.

Cooking for almost a month.

* refs/heads/t/xz:
  Switch to xz to compress tarballs.

6 years agoReduce size of paraslash.ico.
Andre Noll [Mon, 24 Apr 2017 02:03:06 +0000 (04:03 +0200)]
Reduce size of paraslash.ico.

The image geometry of a favicon needs to be only 32x32. Scaling the
image down to this geometry reduced the file size from 73K to 4K.

6 years agoMerge branch 'refs/heads/t/dynamic_chunks'
Andre Noll [Sun, 23 Apr 2017 19:12:22 +0000 (21:12 +0200)]
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.
  ...

6 years agoafh_recv: Check return value of afh_get_chunk().
Andre Noll [Fri, 21 Apr 2017 18:57:38 +0000 (20:57 +0200)]
afh_recv: Check return value of afh_get_chunk().

Starting with commit b6b571e6c (afh: Dynamic chunks) the function
returns an int value and may fail. Although we store the return value
in a variable, the value of the variable is never read, causing the
clang static analyzer to complain (rightfully).

This patch modifies afh_recv_post_select() to fail if afh_get_chunk()
returns negative.

6 years agoaft: Check return value of load_afsi().
Andre Noll [Fri, 21 Apr 2017 20:54:36 +0000 (22:54 +0200)]
aft: Check return value of load_afsi().

This function should never fail, but it does return an error code and
all callers except copy_selector_info() check the return value. So
let's add the check there as well.

6 years agoaudiod: Avoid reading garbage in get_time_string().
Andre Noll [Fri, 21 Apr 2017 20:35:37 +0000 (22:35 +0200)]
audiod: Avoid reading garbage in get_time_string().

If no writer is active, wstime is not initialized. Yet we check
whether wstime.tv_sec == 0.

Introduce a helper variable to avoid reading garbage. This also
improves readability.

Found by the clang static analyzer.

6 years agonet: Always initialize struct sockaddr_storage.
Andre Noll [Fri, 21 Apr 2017 20:04:09 +0000 (22:04 +0200)]
net: Always initialize struct sockaddr_storage.

The static analyzer of clang claims that the left operand of the condition

ss->ss_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&ia6->sin6_addr);

in SS_IS_ADDR_V4MAPPED() is a garbage value. The code has been like
this for seven years without problems, so the warning is probably
bogus.

It does not hurt to initialize the sockaddr_storage structures though,
which silences the warning.

6 years agowma_afh: Fix two bugs in convert_utf8_to_utf16().
Andre Noll [Fri, 21 Apr 2017 19:49:20 +0000 (21:49 +0200)]
wma_afh: Fix two bugs in convert_utf8_to_utf16().

This function has two issues:

* If iconv_open() fails and src is NULL (or *src is NULL) we attempt
to close an invalid file descriptor.

* On errors, we free *dst but miss to set it to NULL, causing a double
free in the caller.

This patch addresses both issues. The double free was found by the
clang static analyzer.

6 years agoaudioc: Avoid double free in audioc_i9e_line_handler().
Andre Noll [Fri, 21 Apr 2017 19:22:34 +0000 (21:22 +0200)]
audioc: Avoid double free in audioc_i9e_line_handler().

If connect_audiod() returns negative, we free "args" twice. Found by
the clang static analyzer.

6 years agoaudiod: Avoid uninitialized memory access.
Andre Noll [Fri, 21 Apr 2017 18:43:06 +0000 (20:43 +0200)]
audiod: Avoid uninitialized memory access.

In handle_connect(), the local pointer variable errctx is not
initialized. If an error occurs early in the function, for example
because recv_cred_buffer() fails, we jump to the "out" label and try
to print the string errctx points to. This will cause a segfault or
worse, so make sure the variable is always initialized.

This bug was found by the static analyzer of clang.

7 years agoMerge branch 'refs/heads/t/wma_improvements'
Andre Noll [Fri, 21 Apr 2017 15:07:00 +0000 (17:07 +0200)]
Merge branch 'refs/heads/t/wma_improvements'

A couple of simple patches which simplify the WMA code and improve
readability.

Cooking for three weeks.

* refs/heads/t/wma_improvements:
  wmadec: Use read_u32_be().
  wma_afh.c: Remove condition which is always true.
  imdct.c: Replace pointless macro PASS.
  wma_common.c: Remove pointless assignment.
  wma_afh.c: Use DIV_ROUND_UP().

7 years agoMerge branch 'refs/heads/t/makefile_conventions'
Andre Noll [Wed, 19 Apr 2017 17:13:20 +0000 (19:13 +0200)]
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.

7 years agoMerge branch 'refs/heads/t/rm_as_compat'
Andre Noll [Tue, 18 Apr 2017 12:55:03 +0000 (14:55 +0200)]
Merge branch 'refs/heads/t/rm_as_compat'

A single patch that removes socket compatibility code from para_audiod,
para_audioc and para_server.

Cooking for three months.

* refs/heads/t/rm_as_compat:
  Remove compatibility code for abstract unix domain sockets.

7 years agoMerge branch 'refs/heads/t/rm_rc4'
Andre Noll [Sun, 16 Apr 2017 18:15:35 +0000 (20:15 +0200)]
Merge branch 'refs/heads/t/rm_rc4'

This patch removes support for RC4, making the AES-based stream
cipher mandadory. The aes_ctr128 server feature is made a no-op,
breaking support with very old clients (<= 0.5.1).

Cooking for three months.

* refs/heads/t/rm_rc4:
  crypt: Remove RC4 support.

7 years agowww: Fix an html bug in download page.
Andre Noll [Sun, 16 Apr 2017 15:37:51 +0000 (17:37 +0200)]
www: Fix an html bug in download page.

Dillo complains with

HTML warning: line 45, Unexpected closing tag: </p> -- expected </ul>.

This complaint looks bogus, but removing the <p> and </p> tags makes the
warning go away with no visible change.

7 years agoMerge branch 'refs/heads/t/rm_oaep'
Andre Noll [Sat, 15 Apr 2017 13:51:38 +0000 (15:51 +0200)]
Merge branch 'refs/heads/t/rm_oaep'

The open-coded OAEP padding removed in this series is no longer needed
since all supported libgcrypt versions support OAEP padding.

The series also contains a few follow up cleanups for gcrypt.c.

Cooking for three months.

* refs/heads/t/rm_oaep:
  gcrypt: Simplify init_random_seed_or_die().
  gcrypt: Rename E_OEAP to E_RSA_DECODE.
  gcrypt: Remove open-coded OAEP padding.

7 years agoMerge branch 'refs/heads/t/rm_asn'
Andre Noll [Sun, 9 Apr 2017 11:47:15 +0000 (13:47 +0200)]
Merge branch 'refs/heads/t/rm_asn'

A few cleanups, and one patch which removes an obsolete feature,
getting rid of an open-coded ASN parser.

Cooking for three months.

* refs/heads/t/rm_asn:
  Remove unused E_PUBLIC_KEY.
  crypt.c: Combine load_key() and get_private_key().
  crypto: Remove support for ASN public keys.
  crypto: Simplify asymetric key handling.
  crypto: Rename check_key_file() -> check_private_key_file().
  gcrypt.c: Always initialize result pointer in get_private_key().

7 years agoMerge branch 'refs/heads/t/rm_osx'
Andre Noll [Tue, 4 Apr 2017 06:42:28 +0000 (08:42 +0200)]
Merge branch 'refs/heads/t/rm_osx'

Two simple patches which remove code and documentation related to
Mac OS. Cooking since 2017-01-04.

* refs/heads/t/rm_osx:
  build: Remove compatibility check for clock_gettime().
  Drop support for Mac OS.

7 years agoSimplify mixer setup.
Andre Noll [Fri, 30 Dec 2016 23:06:10 +0000 (00:06 +0100)]
Simplify mixer setup.

The ->init method of the two mixer implementations initialize the
members of the mixer structure. This structure contains only function
pointers. Their values, once set, never change.

Hence we may initialize the structure at compile time and make it
constant.

7 years agomixer: Implement non-linear time scale for fading.
Andre Noll [Fri, 30 Dec 2016 22:25:11 +0000 (23:25 +0100)]
mixer: Implement non-linear time scale for fading.

For some sound hardware, changing the volume channel has little
effect for small values but even an increment by one is audible for
high values. For such hardware it is desirable to scale the volume
in a non-linear way.

This patch implements this feature. The new --fade-exponent receives
an argument to control the level of non-linearity. The default value
of zero results in old behavior: linear scaling.

For the implementation we need to compute (the inverse of) t ->
t^alpha, where alpha is between zero and one. This requires the use
of exp(3) and log(3), so we need to include <math.h> and link with -lm.

7 years agoThe new logo for v0.6.x.
Andre Noll [Sun, 25 Dec 2016 20:28:26 +0000 (21:28 +0100)]
The new logo for v0.6.x.

7 years agoSwitch to xz to compress tarballs.
Andre Noll [Sun, 3 Jul 2016 14:47:13 +0000 (16:47 +0200)]
Switch to xz to compress tarballs.

xz compresses better than bzip2, and decompression needs less time. It
is also widely used by many other software projects, so there should
be no disadvantage.

We keep removing the .bz2 tarball on make clean, and also keep the
paraslash-*.tar.bz2 entry in .gitignore for the time being.

7 years agomixer: Allow arbitrary relative time for sleep subcommand.
Andre Noll [Tue, 27 Dec 2016 23:53:29 +0000 (00:53 +0100)]
mixer: Allow arbitrary relative time for sleep subcommand.

If --wake-hour is not given, the wake time defaults to now + nine
hours.  This is arbitrary, and the constant 9 was hardcoded with no
way to specify it at the command line or in the config file.

This commit replaces --wake-hour and --wake-min by --wake-time whose
argument must be given in HH:MM syntax. An optional leading '+'
character allows to specify a relative offset.

7 years agoConvert para_fade to subcommands, rename it to para_mixer.
Andre Noll [Tue, 27 Dec 2016 21:19:03 +0000 (22:19 +0100)]
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.

7 years agobuild: Create .dep files only during compilation.
Andre Noll [Sat, 21 Jan 2017 15:18:44 +0000 (16:18 +0100)]
build: Create .dep files only during compilation.

It is unnecessary to run a dedicated command to create the dependency
files because:

* If the object file does not exist, we have to run the compiler
anyway, which creates the dependency on the fly.

* If the object file exists, the dependency file also exists, so
the build system notices if the object file needs to be rebuilt,
for example because an included header file was modified.

The only thing we must guarantee is that all included header files
exist. We do this by introducing an order-only dependency: all object
files depend on all .lsg.h files but we impose this specific ordering
without forcing the targets to be updated.

This speeds up the build a lot and also simplifies Makefile.real.

7 years agobuild: Simplify definition of $m4_lls_deps.
Andre Noll [Sat, 21 Jan 2017 15:08:07 +0000 (16:08 +0100)]
build: Simplify definition of $m4_lls_deps.

7 years agobuild: Rename command list variables.
Andre Noll [Sun, 17 Jul 2016 18:54:00 +0000 (20:54 +0200)]
build: Rename command list variables.

The old names, xxx_command_lists and man_util_command_lists are not
accurate any more, and unnecessarily clumsy to boot.

This patch renames the variables to xxx_commands and all_commands and
sorts the three affected sections of the Makefile alphabetically to
reduce the risk of future merge conflicts.

7 years agobuild: Combine $(CFLAGS) and $(STRICT_CFLAGS).
Andre Noll [Sun, 17 Jul 2016 16:27:13 +0000 (18:27 +0200)]
build: Combine $(CFLAGS) and $(STRICT_CFLAGS).

We used to compile the parsers generated by gengetopt with less strict
flags to avoid warnings in generated files. With lopsub this is no
longer necessary, so one set of flags suffices.

Moreover, we currently initialize $(STRICT_CFLAGS) to $(CFLAGS) (from
the environment), then append our own flags. This is unfortunate
because the user defined settings in $(CFLAGS) are overwritten.

This patch changes the Makefile to only set STRICT_CFLAGS. We now
pass $(STRICT_CFLAGS) $(CFLAGS) to the compiler, allowing the user
to override (parts of) $(STRICT_CFLAGS) by adding -Wno-foo to CFLAGS.

We use the opportunity to regroup the various options a little.

7 years agobuild: Let .d files depend only on .c.
Andre Noll [Sat, 16 Jul 2016 20:24:12 +0000 (22:24 +0200)]
build: Let .d files depend only on .c.

Currently we let each .d file depend on the same set of files as the
.o file by having two targets specified as arguments to -MT options
in the cc command that creates the .d file: one for the .d file and
one for the .o file.

This approach runs into problems if header files are removed and the
now stale .d file depends on a file which no longer exists.

It is enough to let the .d file depend only on the corresponding
.c file. In case an included file changes or is removed, the .c
file changes as well, so we already know we must build the object
file and can update the .d file at the same time, without running
cc twice. The -MMD option which is added to the usual cc command
instructs the compiler to create both the .d and the .o file in one go.

When creating the .o and .d files simultaneously, we don't need a
sed command to prepend the directory containing the .lsg.h headers
as these files are prerequisites of the object file being created,
so they are known to exist when the cc command is executed.

7 years agobuild: Don't create phony targets for dependencies.
Andre Noll [Sat, 16 Jul 2016 11:43:52 +0000 (13:43 +0200)]
build: Don't create phony targets for dependencies.

The -MP option is supposed to work around make errors after a header
file was removed. However, with the option enabled, the attempt to
include a non-existing header file causes the build to loop endlessly.

7 years agobuild: Remove duplicate dependency.
Andre Noll [Sat, 16 Jul 2016 10:14:50 +0000 (12:14 +0200)]
build: Remove duplicate dependency.

We already defined the dependency on $(man_util_command_lists) a few
lines earlier.

7 years agobuild: Remove cmdline_dir and friends.
Andre Noll [Sun, 10 Jul 2016 16:33:48 +0000 (18:33 +0200)]
build: Remove cmdline_dir and friends.

This directory used to contain the source files of the command line
parsers generated by gengetopt. There are no such files any more,
so the the receipts which compile these source files can go away and
we do not need to create the directory any more.

The special CFLAGS for compiling those files can be removed as well
as the include directive for CPPFLAGS.

Finally, the make construct which filters out the .cmdline.d files
from the list of dependency files is no longer needed, and we may get
rid of the sed command which prepends $(cmdline_dir) to the includes
of the dependency files.

7 years agobuild: Remove some unused variables from Makefile.real.
Andre Noll [Wed, 29 Jun 2016 20:21:35 +0000 (22:21 +0200)]
build: Remove some unused variables from Makefile.real.

All executables are converted, so $converted_executables is the same
as $executables, modulo executables which can not be built (and are
thus irrelevant). Similarly, $unconverted_executables is empty and
can be removed as well.

The $m4_deps variable was only used for the gengetopt files, so this
can also be removed, along with $ggo_dir.

$help2man_dir used to contain the path to the directory for the output
files of help2man. Since we now generate the man pages with lopsubgen,
$help2man_dir has become unused and can be removed.

7 years agobuild: Remove m4/gengetopt.
Andre Noll [Sun, 26 Jun 2016 10:40:20 +0000 (12:40 +0200)]
build: Remove m4/gengetopt.

This directory only contained a single file: the makefile for
generating the command line parsers with gengetopt. Since we no longer
rely on gengetopt, we may remove $(m4_ggo_dir), m4/gengetopt/makefile
and the corresponding include directive in Makefile.real.

7 years agoRemove gengetopt and help2man checks from configure.ac.
Andre Noll [Sun, 26 Jun 2016 10:37:42 +0000 (12:37 +0200)]
Remove gengetopt and help2man checks from configure.ac.

The build system no longer depends on these tools, so the checks have
become unnecessary.

7 years agoRemove man_util.bash.
Andre Noll [Sun, 26 Jun 2016 10:33:44 +0000 (12:33 +0200)]
Remove man_util.bash.

This script is no longer needed since all executables and all command
lists have been converted to the lopsub library.

This commit removes the script and the receipt in Makefile.real that
called it.

7 years agoRemove ggo.c and ggo.h.
Andre Noll [Sun, 26 Jun 2016 10:30:28 +0000 (12:30 +0200)]
Remove ggo.c and ggo.h.

No source file includes ggo.h and none of the executables is linked
with ggo.o any more, so we may get rid of them.

7 years agomanual: Do not mention gengetopt and help2man any more.
Andre Noll [Sun, 26 Jun 2016 10:44:56 +0000 (12:44 +0200)]
manual: Do not mention gengetopt and help2man any more.

Both tools are no longer required to build the paraslash tree, so
there is no point to list them in the set of packages to install. The
patch also removes the links to the source code from the user manual.

7 years agoConvert para_server to lopsub.
Andre Noll [Fri, 24 Jun 2016 19:38:24 +0000 (21:38 +0200)]
Convert para_server to lopsub.

This is the last executable to be converted to lopsub.

acl_init() is removed from acl.c, and the initialization of the access
control list is moved to init_sender_status() of send_common.c. It
now takes an lls_opt_result argument and calls acl_add_entry() for
each argument given. The latter function needs to be made public.

In dccp_send.c we check the FEC parameters and change the gengetopt
config structure to contain the default values if invalid FEC
parameters were given. With lopsub this is no longer possible as
the lls_parse_result structure is opaque. We copy the FEC parameters
to a dccp_fec_client structure anyway, so is it easiest to move the
check there.

The patch removes the unused gengetopt option files but leaves the
gengetopt infrastructure of the build system in place. The build
system will be cleaned up in subsequent patches.

7 years agoConvert para_audiod to lopsub.
Andre Noll [Sat, 27 Aug 2016 13:05:13 +0000 (15:05 +0200)]
Convert para_audiod to lopsub.

This commit replaces the gengetopt file for para_audiod by a lopsub
suite, introducing several new files in m/lls/include which correspond
to options also needed by para_server (which has not been converted
to lopsub yet).

The audiod_status_info enumeration is now provided by lopsub and can
be removed from audiod.h.

The patch also  adds a new description section to the manual page
para_audiod(1).

7 years agoaudiod: Remove unused --stream-delay.
Andre Noll [Mon, 20 Jun 2016 20:35:04 +0000 (22:35 +0200)]
audiod: Remove unused --stream-delay.

This option is a no-op since six years: Commit 25c11569 removed the
only user of this option.

7 years agoConvert para_afh to lopsub.
Andre Noll [Sat, 18 Jun 2016 16:06:55 +0000 (18:06 +0200)]
Convert para_afh to lopsub.

This commit replaces the gengetopt file for para_afh by the lopsub
suite afh.suite and links the executable with --llopsub.

The patch also adds a short description of the two operating modes
of para_afh (print or modify) to the manual page para_afh(1).

7 years agoConvert para_gui to lopsub.
Andre Noll [Sat, 18 Jun 2016 14:57:39 +0000 (16:57 +0200)]
Convert para_gui to lopsub.

This replaces the gengetopt file for para_gui by a lopsub suite and
links para_gui with -llopsub.

The new FOR_EACH_KEY_MAP() macro is introduced for iterating over
all key bindings given at the command line or in the config file.

The bulk of the change is parse_config_file_or_die() where we get rid
of the gengetopt specific hack which removed all key bindings due to
gengetopt appending the options when the config parser is called a
second time.

The patch also adds a description section to the man page of para_gui.

7 years agogui: Remove --timeout.
Andre Noll [Sun, 25 May 2014 22:02:40 +0000 (00:02 +0200)]
gui: Remove --timeout.

para_gui should work well regardless of the scheduler timeout setting.
This commit removes the timeout options and changes gui.c to use a
fixed timeout of one second.

7 years agoConvert para_filter to lopsub.
Andre Noll [Sun, 12 Jun 2016 18:46:10 +0000 (20:46 +0200)]
Convert para_filter to lopsub.

Changes the semantics in case --filter is not given. We used to
print an error, but it makes more sense to show the list of supported
filters in this case.

If no filters are given, we now print the list of available filters. A
new function in filter_common.c, print_filter_list(), is introduced
for this purpose.

The manual page of para_filter has been extended to include an overall
description of the command.

The only error code of filter.c, E_NO_FILTERS, becomes unused and is
removed.

7 years agoConvert para_write to lopsub.
Andre Noll [Fri, 26 Aug 2016 18:12:01 +0000 (20:12 +0200)]
Convert para_write to lopsub.

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.

7 years agoConvert para_recv to lopsub.
Andre Noll [Fri, 26 Aug 2016 13:28:24 +0000 (15:28 +0200)]
Convert para_recv to lopsub.

This converts the gengetopt parser for para_recv to lopsub format,
replacing the ggo file by a lopsub suite.

The conversion is rather simple because para_recv does not have
a config file parser and because changes to the build system are
small because we already link para_recv with -llopsub due to the
recv_cmd suite.

7 years agoConvert writers to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:50:17 +0000 (22:50 +0200)]
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.

7 years agomake converter_arg in resamplefilter an enum option
Andre Noll [Tue, 27 Dec 2016 17:54:37 +0000 (18:54 +0100)]
make converter_arg in resamplefilter an enum option

7 years agoConvert filters to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:44:30 +0000 (22:44 +0200)]
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.

7 years agoConvert para_play to lopsub.
Andre Noll [Tue, 23 Aug 2016 10:04:19 +0000 (12:04 +0200)]
Convert para_play to lopsub.

This changes para_play to use the lopsub library rather than gengetopt
for parsing the command line and the config file.

The old approach of permuting argv[] no longer works with lopsub
because direct access to the array of non-option arguments is no
longer possible. Therefore we introduce shuffle_map[], an array of
indices which defaults to 1..n if --randomize is not given, and a
random permutation of 1..n otherwise. The new get_playlist_file()
helper returns the path to the input file determined by permuting
the given index.

The overall description for the manual page has also been improved
slightly.

Since m4/gengetopt/history_file.m4 has become unused, this file can
be removed.

7 years agoConvert para_fade to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:31:11 +0000 (22:31 +0200)]
Convert para_fade to lopsub.

This replaces the ggo file for the command line and config file parser
of para_fade by a lopsub suite file and links para_fade against the
lopsub library.

As there are no subcommands, the conversion is straight forward and
the bulk of the patch are simple changes which replace access to the
gengetopt structure by equivalent lopsub constructs.

7 years agoConvert para_client to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:29:29 +0000 (22:29 +0200)]
Convert para_client to lopsub.

This replaces the gengetopt command line parser for para_client by a
lopsub suite and links para_client against the lopsub library. The ggo
file for para_client was the last user of m4/gengetopt/complete.m4,
so this file can be removed.

The tricky part is create_merged_lpr(), which replaces
make_client_argv(). It is called from the i9e line handler and from
the completers. The new function merges the original parse result
with the arguments given at the command line to produce the parse
result stored in the client task structure.

The completers no longer duplicate the possible options each server
subcommand because the header file generated by lopsubgen exposes
an array of string literals which is suitable as the opts argument
of i9e_complete_option().

7 years agoConvert receivers to lopsub.
Andre Noll [Mon, 22 Aug 2016 13:13:40 +0000 (15:13 +0200)]
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.

7 years agoConvert audioc to lopsub.
Andre Noll [Sun, 7 Aug 2016 22:01:19 +0000 (00:01 +0200)]
Convert audioc to lopsub.

This changes para_audioc to use the lopsub library rather than
gengetopt for parsing the command line options. The gengetopt input
file m4/gengetopt/audioc.m4 is replaced by an equivalent suite file,
audioc.c is adjusted to call the lopsub primitives instead if the
gengetopt parsers, and para_audioc is linked against lopsub. Moreover,
the manual page of audioc is now generated with lopsubgen.

Since this is the first executable which is converted, the commit
introduces a fair amount of infrastructure which will also be used
by other executables. Specifically:

* Common command line options (--help, --detailed-help, --version,
--loglevel, --history_file, --complete) are stored in per-option
files below m4/lls/include. Each of these files is included from
audioc.suite.m4. To tell make which files audioc.suite depends on,
we use the line synchronization feature of m4 and a simple awk script
to create a .m4d file which contains these dependencies, similar to
the .d files which describe dependencies of .c and .h files. The new
m4_lls_deps make variable contains the set of .m4d files.

* A generic copyright section for the man page which refers to the
COPYRIGHT_YEAR macro, defined from the make variable in Makefile.real.

* The new make variable LOGLEVELS. We need to know the set of loglevels
in the suite files as well as in the C code, so the variable avoids
to duplicate this information.

7 years agoRemove *.cmd and command_util.bash.
Andre Noll [Sat, 31 Dec 2016 19:07:33 +0000 (20:07 +0100)]
Remove *.cmd and command_util.bash.

The four *.cmd files are no longer needed and can be removed,
along with the script which transformed these files into C code. The
directory for the generated files, $(build_dir)/cmdlist, can go away
as well.

With command_util.bash gone, the Makefile can also be cleaned up
considerably. In particular, the ugly TOUPPER make function can be
removed because it was only used by the command_util recipe. Moreover,
The dependencies for the *.command_list.* files are no longer needed.

Finally, the sed command which fixed up the dependencies in the *.d
files can be simplified.

7 years agoplay: Remove support for non-lopsub commands.
Andre Noll [Mon, 7 Sep 2015 21:40:58 +0000 (23:40 +0200)]
play: Remove support for non-lopsub commands.

This cleans up play.c to get rid of struct pp_command, the array of
command handlers and the compatibility code for non-lopsub commands
in run_command() and com_help().

Also the FOR_EACH_COMMAND() macro to iterate over all non-lopsub
commands can go away and we no longer need to include the
play.command_list.h header generated by command_util.bash.

7 years agoplay: Convert com_quit() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:52:25 +0000 (03:52 +0000)]
play: Convert com_quit() to lopsub.

This converts the last subcommand of para_play. Cleanups are done in
subsequent patches although the declarations of the command handlers
are removed here because they have become unused and triggered
compiler warnings.

7 years agoplay: Convert com_tasks() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:51:23 +0000 (03:51 +0000)]
play: Convert com_tasks() to lopsub.

Nothing to see here: only the usual changes to the command handler,
and no changes to the help text.

7 years agoplay: Convert com_pause() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:50:36 +0000 (03:50 +0000)]
play: Convert com_pause() to lopsub.

The argc check can be removed from the command handler of this
subcommand. Other than that no changes to (the body of) com_pause()
are necessary.

7 years agoplay: Convert com_play() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:49:45 +0000 (03:49 +0000)]
play: Convert com_play() to lopsub.

Straight forward conversion, slight improvement of the help text.

7 years agoplay: Convert com_info() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:48:50 +0000 (03:48 +0000)]
play: Convert com_info() to lopsub.

This also improves the help text slightly to be more specific about
the output of the subcommand.

7 years agoplay: Convert com_ls() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:47:55 +0000 (03:47 +0000)]
play: Convert com_ls() to lopsub.

This also gets rid of the undocumented pattern matching. The command
now takes no arguments and always lists all files.

7 years agoplay: Convert com_ff() to lopsub.
Andre Noll [Mon, 28 Mar 2016 03:47:07 +0000 (03:47 +0000)]
play: Convert com_ff() to lopsub.

Converting com_ff() is analogous to com_jmp() since both subcommands
take a single integer argument. See the commit message of the previous
commit which converted com_jmp() for more information.

7 years agoplay: Convert com_jmp() to lopsub.
Andre Noll [Mon, 28 Mar 2016 16:55:58 +0000 (16:55 +0000)]
play: Convert com_jmp() to lopsub.

The command handler needs to check that there is a single argument
which is an integer between 0 and 100. This check needs to be modified
to use the lopsub primitives rather than accessing the argument
vector directly.

Unfortunately we can not perform the conversion of the string argument
into an int value with lopsub since the given percentage is an unnamed
option rather than an argument of an option.

The patch also rewords the summary and the help text of the jmp
subcommand slightly to be more clear.

7 years agoplay: Convert com_bg() to lopsub.
Andre Noll [Mon, 28 Mar 2016 16:55:42 +0000 (16:55 +0000)]
play: Convert com_bg() to lopsub.

There is not much to convert since the command takes no arguments,
and thus lpr is unused. The commit gets rid of the argc check which
is performed by lopsub and fixes a typo in the command summary:
s/input/insert.

7 years agoplay: Convert com_prev() to lopsub.
Andre Noll [Mon, 7 Sep 2015 20:30:31 +0000 (22:30 +0200)]
play: Convert com_prev() to lopsub.

The arg count check can be removed from the command handler, and the
pointless help text of the commit has been removed because it said
more or less the same as the summary text.

7 years agoplay: Convert com_next() to lopsub.
Andre Noll [Mon, 28 Mar 2016 04:05:14 +0000 (04:05 +0000)]
play: Convert com_next() to lopsub.

com_next() is also called from com_jmp(), where we needed to pass
a fake argv. This is no longer necessary as com_next() now takes
a parse result pointer which is unused. So we may just pass NULL
from com_jmp().

7 years agoplay: Convert com_fg() to lopsub.
Andre Noll [Mon, 28 Mar 2016 04:04:56 +0000 (04:04 +0000)]
play: Convert com_fg() to lopsub.

Lopsub fails to parse the command line if one or more arguments are
given, allowing to remove the check from the command handler.

The commit also extends the help text of the subcommand to mention
that the colon key can also be used to return to input mode.

7 years agoplay: Link against lopsub and convert com_help() to lopsub.
Andre Noll [Sun, 10 Apr 2016 20:02:10 +0000 (22:02 +0200)]
play: Link against lopsub and convert com_help() to lopsub.

This introduces the play_cmd suite for the subcommands of para_play,
like play, pause, fg, bg, etc. The new suite contains only the
"help" subcommand so far. Other commands will be converted one by one
in subsequent patches.

We make use of the lopsub user_data feature to store a pointer to the
command handler in the lls_command structure generated by lopsubgen.
This pointer is initialized by the new EXPORT_PLAY_CMD_HANDLER macro
in play.c.

The suite has no supercommand, therefore lopsubgen adds a special
"unavailable" identifier to play.lsg.h. We must therefore provide a
dummy completer for the fake supercommand.

Until all subcommands are converted, the run_command() and com_help()
subcommand need to iterate over two command lists. Afterwards, this
compatibility code can be removed.

7 years agoafs.c: Remove compatibility code in action_if_pattern_matches().
Andre Noll [Fri, 2 Oct 2015 02:34:53 +0000 (02:34 +0000)]
afs.c: Remove compatibility code in action_if_pattern_matches().

This is no longer needed as there are no more non-lopsub
commands left. Now pmd->lpr is non-NULL for all commands which
call action_if_pattern_matches(), which allows to simplify the
function. Moreover, ->patterns of struct pattern_match_data is unused
and can be dropped.

7 years agoserver: Remove ->argc, ->argv from struct command_context.
Andre Noll [Sun, 22 May 2016 11:37:48 +0000 (13:37 +0200)]
server: Remove ->argc, ->argv from struct command_context.

Command handlers should not look at the argv[] vector directly
but only use the lopsub library functions to access the parsed
command line.

In fact, the only function which accesses the argv vector is
run_command(). Defining argc and argv as local variables in this
function allows to drop the two members from the command context
structure.

7 years agoserver: Remove support for non-lopsub commands.
Andre Noll [Sun, 31 Jul 2016 08:32:57 +0000 (10:32 +0200)]
server: Remove support for non-lopsub commands.

Now that all commands have been converted to lopsub, struct
server_command is no longer needed and can be removed, along with
the helper functions for lookup and permission checking.

7 years agoafs: Remove unused call_callback helpers.
Andre Noll [Sun, 6 Sep 2015 19:01:41 +0000 (21:01 +0200)]
afs: Remove unused call_callback helpers.

send_option_arg_callback_request() and send_standard_callback_request()
have both become unused now that all server commands have been
converted to lopsub. This patch gets rid of these functions and
removes their declarations from afs.h.

7 years agoEnable partial matching for server commands.
Andre Noll [Mon, 5 Sep 2016 15:34:53 +0000 (17:34 +0200)]
Enable partial matching for server commands.

The feature was deactivated in an earlier commit which converted the
lsatt command to lopsub. The problem was that "ls" would have been
interpreted as lsatt because lsatt was the only converted command
that started with ls.

Now that all server commands are converted, the lopsub library function
lls_lookup_subcmd() does the right thing, so this patch removes the
additional test for an exact match.

7 years agols conversion cleanup
Andre Noll [Mon, 26 Dec 2016 14:04:18 +0000 (15:04 +0100)]
ls conversion cleanup

7 years agoserver: Convert com_ls() to lopsub.
Andre Noll [Sun, 27 Dec 2015 22:04:29 +0000 (22:04 +0000)]
server: Convert com_ls() to lopsub.

This is the final server command to be converted to the lopsub API.
Besides the conversion to lopsub, the patch changes the semantics
of the ls command in two ways: The deprecated -p option is removed,
and the -F option is made the default so that full paths are printed
if -b is not given.

Regarding the conversion, the patch removes enum ls_flags which used to
contain the various flags of the ls command. This information can now
be extracted in the callback from the deserialized parse result. Also
write_score() is kind of pointless and is replaced by inlining it.

Note that make_status_items() is also affected by this patch because
it makes use of the infrastructure of the ls command. This function
is called from the event handler of the audio file table for events
of type AFSI_CHANGE and AFHI_CHANGE.

Since no more non-lopsub server commands are left after this patch,
several cleanups are possible. These are dealt with in subsequent
patches.

7 years agoserver: Convert blob commands to lopsub.
Andre Noll [Sun, 20 Mar 2016 18:41:25 +0000 (18:41 +0000)]
server: Convert blob commands to lopsub.

This converts all blob commands (ls, cat rm, mv) in one go to lopsub,
making the patch rather large.

The addblob commands are special in that we must pass not only the
blob name given at the command line to the callback but also the
blob data which was read from stdin. The command handler does not
serialize the parse result like most other commands do, but constructs
a query object containing name and data for the callback. Therefore
the command handler does not call send_lls_callback_request() but
send_callback_request(). We continue to follow this scheme.

blob.c contains a few macros which expand to a set of functions,
one for each type of bloc (mood, playlist, image, lyrics). These
macros have to be adjusted to take another argument because we need
the prefixes (e.g., lyr for lyrics) in both upper and lower case and
there is no preprocessor toupper().

7 years agoserver: Convert com_addatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:13:33 +0000 (21:13 +0000)]
server: Convert com_addatt() to lopsub.

Another simple command without options which is easy to convert. The
only thing worth noting is that we now fail the command early if more
than 64 arguments are given when previously we only checked that at
least one argument is given.

7 years agoserver: Convert com_touch() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:10:36 +0000 (21:10 +0000)]
server: Convert com_touch() to lopsub.

Another open-coded option parser bites the dust.

This also gets rid of struct com_touch_options, along with the ugly
convention of passing -1 to the action handler to indicate that the
option was not given.

The documentation was enhanced slightly and now explains in the
[description] section the general concept of the touch command.

7 years agoserver: Convert com_select() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:15:06 +0000 (21:15 +0000)]
server: Convert com_select() to lopsub.

Pretty straight-forward conversion since the command does not have
any arguments. In the callback handler, we we can't return directly
any more since we need to free the serialized parse result.

7 years agoserver: Convert com_rm() to lopsub.
Andre Noll [Sun, 11 Oct 2015 00:17:55 +0000 (00:17 +0000)]
server: Convert com_rm() to lopsub.

This gets rid of the open-coded command line parser in com_rm() and
of enum rm_flags. Patterns are now passed to for_each_matching_row()
and from there to the action handler remove_audio_file() via ->lpr
of struct pattern_match_data.

7 years agoserver: Convert com_rmatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:18:42 +0000 (21:18 +0000)]
server: Convert com_rmatt() to lopsub.

No change to the action handler, remove_attribute(), necessary.

7 years agoserver: Convert com_cpsi() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:17:09 +0000 (21:17 +0000)]
server: Convert com_cpsi() to lopsub.

Allows to get rid of enum cpsi_flags as we pass the flags via the
serialized parse result to the callback and the action handler
(copy_selector_info()).

Also the open-coded command line parser in com_cpsi() can be removed.

7 years agoserver: Convert com_check() to lopsub.
Andre Noll [Sun, 20 Mar 2016 18:40:50 +0000 (18:40 +0000)]
server: Convert com_check() to lopsub.

Gets rid of enum com_check_flags and the open-coded option parser
of com_check().

Also streamlines the help text of the options a bit.

7 years agoserver: Convert com_mvatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:21:11 +0000 (21:21 +0000)]
server: Convert com_mvatt() to lopsub.

We need to cast the obj->data pointer to a non-constant type because
the osl library functions expect void *, which results in a warning
without the cast.

7 years agoserver: Convert com_setatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:22:01 +0000 (21:22 +0000)]
server: Convert com_setatt() to lopsub.

Introduces ->input_skip for struct pattern_match data. The setatt
command uses this to strip the attribute modifies off the unnamed
arguments in the lopsub parse result. The remaining arguments are
the patterns which are to be matched against each file in the audio
file table.

7 years agoserver: Convert com_lsatt() to lopsub.
Andre Noll [Sun, 20 Mar 2016 18:40:19 +0000 (18:40 +0000)]
server: Convert com_lsatt() to lopsub.

This is the first afs subcommand which needs to pass a pattern list
to its callback. The new send_lls_callback_request() provides this
functionality. It serializes the parse result into a buffer and passes
this buffer to the callback.

Since there are non-lopsub commands which also pass a pattern list,
action_if_pattern_matches() is patched to receive the pattern
list either from the serialized parse result or in the old way via
pmd->data. To achieve this, a parse result pointer is added to struct
pattern_match_data. If this pointer is not NULL, we are dealing with
a subcommand that has been converted.

Since the ls subcommand has not been converted yet, lopsub will
regard "ls" as a uniqe abbreviation of the lsatt command, which
breaks t0004. To work around this, we deactivate prefix matching by
only accepting exact matches in run_command(). This workaround can
be removed after com_ls() has been converted.

7 years agoserver: Convert com_init() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:23:54 +0000 (21:23 +0000)]
server: Convert com_init() to lopsub.

No change necessary for the callback as the init command does
not have any options. The only information that must travel from the
command handler to the callback is the set of tables to create. The
corresponding bitmask is passed without serializing the parse result.

7 years agoserver: Convert com_add() to lopsub.
Andre Noll [Sun, 15 May 2016 16:53:50 +0000 (18:53 +0200)]
server: Convert com_add() to lopsub.

In the callback structure for the add command, replace the flags
field by the serialized callback result. This way the callback
has access to the full parse result structure.

7 years agoserver: Convert non-afs commands to lopsub.
Andre Noll [Sun, 12 Jun 2016 13:36:21 +0000 (15:36 +0200)]
server: Convert non-afs commands to lopsub.

Currently the server commands are divided into two group: those
commands which are handled by the server process and those which
communicate with the afs process. This commit converts the commands of
the former group and the corresponding completers for para_client to
the lopsub suite format while the afs commands will be converted in
subsequent commits. After this change para_server needs to be linked
with -llopsub.

To this aim the options and help texts of of the server commands are
transferred from server.cmd to the new server_cmd.suite.m4, enabling
long-style options in the progress. Moreover, an introduction is added
at the beginning of the list of server commands which describes how
server commands are executed.

Command permissions are now handled by making use of the aux_info
feature of lopsub. To keep those commands working which do not
have any permission bit set, we need to add a new identifier
NO_PERMISSION_REQUIRED to enum server_command_permissions of
user_list.h. The value of this identifier is zero of course.

Naturally the bulk of the change takes place in command.c where all
server commands are implemented. The command handlers are modified
to take a pointer to a struct lls_parse result as an additional
argument. A new helper, send_errctx(), is introduced to avoid code
duplication.

Since command.h now refers to a lopsub parse result, all files which
include command.h, including those which implement only afs commands,
need to include the system header lopsub.h.

To keep afs commands working, some compatibility code in run_command()
is added. This will go away after all commands have been converted.

A couple of macros in command.h ease the handling of the long symbolic
constants exposed by the generated lopsub header file.

Although only the non-afs commands are converted, the change allows
for a couple of cleanups:

* The E_BAD_COMMAND error code is no longer needed and has been
removed.

* cmd_perms_itohuman() has become unused and is removed.

* The server_cmds[] array is empty and can be removed, along
with the loop in send_list_of_commands() which iterated over
the array.

The patch also adjusts tests t0004 and t0005 since the help output
format changed slightly, breaking the expectations of these tests.

7 years agoConvert audiod commands to lopsub.
Andre Noll [Sat, 7 May 2016 08:59:01 +0000 (10:59 +0200)]
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.

7 years agowmadec: Use read_u32_be().
Andre Noll [Sat, 28 Jan 2017 17:02:33 +0000 (18:02 +0100)]
wmadec: Use read_u32_be().

The shift operation in show_bits() was buggy because p[0] is promoted
to int, and the shift p[0] << 24 results in undefined behavior,
causing the sanitizer of gcc to complain:

bitstream.h:40:21: runtime error: left shift of 230 by 24 places cannot be represented in type 'int'

read_u32_be() gets this right.

7 years agowma_afh.c: Remove condition which is always true.
Andre Noll [Sun, 8 Jan 2017 17:05:31 +0000 (18:05 +0100)]
wma_afh.c: Remove condition which is always true.

The single caller of count_frames() never passes a NULL pointer.

7 years agoimdct.c: Replace pointless macro PASS.
Andre Noll [Sat, 7 Jan 2017 15:12:05 +0000 (16:12 +0100)]
imdct.c: Replace pointless macro PASS.

The macro defines pass(), a function with only a single caller. We
may as well define the function directly, improving readability and
enabling proper syntax colors.

7 years agowma_common.c: Remove pointless assignment.
Andre Noll [Fri, 6 Jan 2017 00:04:23 +0000 (01:04 +0100)]
wma_common.c: Remove pointless assignment.

7 years agowma_afh.c: Use DIV_ROUND_UP().
Andre Noll [Fri, 6 Jan 2017 00:03:29 +0000 (01:03 +0100)]
wma_afh.c: Use DIV_ROUND_UP().

This kills another open-coded instance of DIV_ROUND_UP().

7 years agoaacdec: Decode only one frame per iteration.
Andre Noll [Fri, 18 Apr 2014 00:13:08 +0000 (00:13 +0000)]
aacdec: Decode only one frame per iteration.

This improves latency and helps to avoid buffer underruns on slow
machines.

7 years agoaacdec: Combine aac_open() and aacdec_open().
Andre Noll [Fri, 18 Apr 2014 00:12:40 +0000 (00:12 +0000)]
aacdec: Combine aac_open() and aacdec_open().

Both functions are short, and they are only called once at
startup. Thus, there is no reason to spread out the initialization
over two functions, so let's combine them.