chiark / gitweb /
disorder
4 months agolib/addr.c, etc.: Return plain addresses from `netaddress_resolve'.
Mark Wooding [Sat, 6 Jun 2020 12:27:45 +0000 (13:27 +0100)]
lib/addr.c, etc.: Return plain addresses from `netaddress_resolve'.

Instead of a list of `struct addrinfo' structures, return a vector of
`struct resolved', each of which just contains a socket address and
length.  This is sufficient for all of the existing callers (which have
been changed to cope), and means that we don't need any awful hacks
because they're easy to free.

4 months agodisobedience/control.c: Handle state-change toggles better.
Mark Wooding [Sat, 6 Jun 2020 09:17:25 +0000 (10:17 +0100)]
disobedience/control.c: Handle state-change toggles better.

If you click a toggle icon, say the `pause' button, then: Gtk
immediately toggles the state of the icon, but doesn't change the
corresponding menu item.  Instead, a state change is reported through
the log connection which causes us to update the menu (and the icon,
though that's already in the right state so you don't notice).  (Of
course, this just works the other way around if you use the menu item or
keyboard accelerator instead.)

There are a couple of problems with this, with more or less the same
fix.

  * If the connection to the server is very slow, then there's a lag
    between clicking the icon, or pressing the accelerator, and the rest
    of the UI updating.  This is unfortunate.

  * If something goes wrong, then the icon is left in the wrong state,
    and nothing will correct it.

The fix is as follows:

  * When toggling the state of something, we immediately (a) adjust our
    internal idea of what the state /ought/ to be, and (b) force an
    update of the icon (and associated menu item).  This solves the
    problem of the associated UI element lagging.

  * On a server error, we immediately change the state back again and
    force another icon update.

  * That leaves the RTP connection option (which was my original
    motivation for all of this).  There's no server feedback for this
    control.  Instead, we periodically check whether the RTP player
    process is listening for connections.  An event is signalled if this
    state /changes/, and this event is used to set the icon and
    menu-item state.  So, again, if we force our internal idea of the
    RTP process state to match the icon, but the player doesn't start up
    properly, then the next time we check, we find that the player isn't
    responding, signal the event, and then we fix the icon state.

4 months agodisobedience/rtp.c: Pass configuration file names on to `disorder-playrtp'.
Mark Wooding [Fri, 5 Jun 2020 01:16:06 +0000 (02:16 +0100)]
disobedience/rtp.c: Pass configuration file names on to `disorder-playrtp'.

4 months agoclients/, disobedience/: Add `-u' option to override user config file.
Mark Wooding [Fri, 5 Jun 2020 01:07:41 +0000 (02:07 +0100)]
clients/, disobedience/: Add `-u' option to override user config file.

At long last.

4 months agodisobedience/disobedience.c: Stop telling `getopt' to accept `-H' and `-C'.
Mark Wooding [Thu, 4 Jun 2020 20:18:59 +0000 (21:18 +0100)]
disobedience/disobedience.c: Stop telling `getopt' to accept `-H' and `-C'.

The option parser refuses them later, but you get a less helpful error
message.

4 months agoclients/disorder.c: Remove the short forms for undocumented options.
Mark Wooding [Thu, 4 Jun 2020 20:02:32 +0000 (21:02 +0100)]
clients/disorder.c: Remove the short forms for undocumented options.

Also, somewhat sneakily, move the internal names for these options out
of the way of my future plans.

The affected options are `-N' (`--no-per-user-config'), `-u' (`--user')
and `-p' (`--password').  As far as I can make out, `--user' and
`--password' are only intended to be used during testing, and only the
long forms are given; and `--no-per-user-config' isn't actually used at
all.

4 months agolib/configuration.c, etc.: Replace `config_userconf()' by a variable.
Mark Wooding [Thu, 4 Jun 2020 19:49:16 +0000 (20:49 +0100)]
lib/configuration.c, etc.: Replace `config_userconf()' by a variable.

Exactly analogous to the existing `configfile' variable.

4 months agolib/configuration.c, lib/home.c: Introduce environment variables.
Mark Wooding [Thu, 4 Jun 2020 19:22:02 +0000 (20:22 +0100)]
lib/configuration.c, lib/home.c: Introduce environment variables.

The places where DisOrder looks for configuration can now be overridden
using environment variables.

  * `$DISORDER_CONFIG' is the master configuration file -- defaults to
    `PKGCONFDIR/config', where `PKGCONFDIR' is set at compile
    time (e.g., `/etc/disorder'.

  * `$DISORDER_PRIVCONFIG' is the private configuration file -- defaults
    to `$DISORDER_CONFIG.private'.

  * `$DISORDER_HOME' is the user's `profile directory' for DisOrder
    things -- defaults to `$HOME/.disorder' on Unix, or
    `%APPDATA%/DisOrder' (i.e., in the roaming profile directory) on
    Windows.

  * `$DISORDER_USERCONFIG' is the user's configuration file -- defaults
    to `$DISORDER_HOME/passwd'.

  * `$DISORDER_USERCONFIG_SYS' is the per-user system configuration file
    -- defaults to `$DISORDER_CONFIG.USERNAME'.

The primary motivation for all of this is to make it easier to run
clients -- particularly Disobedience and its `disorder-playrtp'
inferiors -- against multiple servers simultaneously.  Setting
configuration on the command line works rather badly for clients, since
that overrides the /system/ configuration, which the user can't edit
anyway -- the client programs still read `$HOME/passwd' unconditionally.
This is clearly a bug, but changing the behaviour now is a bad idea;
besides, changing `-c' (or introducing a new option) to override the
`passwd' file, doesn't actually help much unless Disobedience in turn
passes the necessary option on to `disorder-playrtp'.  Environment
variables solve all of these problems much more simply.

4 months agolib/home.c: Introduce functions for building pathmames in home directories.
Mark Wooding [Thu, 4 Jun 2020 19:13:11 +0000 (20:13 +0100)]
lib/home.c: Introduce functions for building pathmames in home directories.

Split the home-directory logic of `config_userconf' into its own file.
Arrange to only calculate the home directory once.

Most invasively, use this new functionality in place of looking up
`$HOME' and building pathnames by hand.

This change doesn't add much functionality, but it does add a little.
Most notably,

$ unset HOME; disobedience

doesn't segfault any more.  More subtly, the logic for finding one's
home directory is now consistent.  On Windows, we still use `%APPDATA%';
on Unix, we now /always/ use `$HOME' first, and then fall back to
`getpwuid(getuid)->pw_dir' if that's unset.  Previously, the
configuration reader would ignore `$HOME' and use the password database,
while Disobedience used `$HOME' exclusively and crashed if it was
unset.  This is all obviously silly.

4 months agoserver/*.c: Don't try reading per-user configuration.
Mark Wooding [Sat, 6 Jun 2020 17:07:17 +0000 (18:07 +0100)]
server/*.c: Don't try reading per-user configuration.

This can't end well.

4 months agolib/configuration.c, etc.: Remove arguments from `config_userconf'.
Mark Wooding [Thu, 4 Jun 2020 19:07:30 +0000 (20:07 +0100)]
lib/configuration.c, etc.: Remove arguments from `config_userconf'.

Nobody ever did anything with the HOME argument at all.  Passing in PW
might have been slightly valuable, but configuration is only retrieved
infrequently.

Besides, this is the start of a sequence of changes to how configuration
files are found.

4 months agodisobedience/rtp.c: Allow setting a `disorder-playrtp' instance name.
Mark Wooding [Wed, 3 Jun 2020 20:47:41 +0000 (21:47 +0100)]
disobedience/rtp.c: Allow setting a `disorder-playrtp' instance name.

This way, multiple processes can be running at the same time without
interfering or getting too badly confused.

4 months agolib/configuration.c, lib/uaudio-rtp.c: Allow tweaking MTU-discovery.
Mark Wooding [Wed, 3 Jun 2020 20:01:15 +0000 (21:01 +0100)]
lib/configuration.c, lib/uaudio-rtp.c: Allow tweaking MTU-discovery.

Apparently under some circumstances, Linux tries to do path MTU
discovery with RTP transmissions, so it (a) sets DF on outgoing packets
and then (b) ignores the `fragmentation-needed' errors coming back!
This option attempts to work around this foolishness.

Configuration is accepted on all platforms for portability's sake, but
is only effective on Linux.

4 months agolib/configuration.c, lib/uaudio-rtp.c: Allow configuring payload size.
Mark Wooding [Wed, 3 Jun 2020 19:58:08 +0000 (20:58 +0100)]
lib/configuration.c, lib/uaudio-rtp.c: Allow configuring payload size.

This is useful in unicast (or multicast-routing?) situations where
packets will traverse networks with unusually small MTU.

4 months agodisobedience/queue.c: Don't ramp up network activity when not playing.
Mark Wooding [Tue, 2 Jun 2020 01:53:29 +0000 (02:53 +0100)]
disobedience/queue.c: Don't ramp up network activity when not playing.

If you paused the current track, or disabled playing, then Disobedience
would send a `queue' command every second, eating about 2.5 kB/s of
network for no good reason.  Fix this.

4 months agolib/addr.c: Handle `AF_UNIX' sockets in `netaddress_resolve'.
Mark Wooding [Mon, 1 Jun 2020 11:48:20 +0000 (12:48 +0100)]
lib/addr.c: Handle `AF_UNIX' sockets in `netaddress_resolve'.

A `netaddress' is supposed to permit Unix-domain sockets, but this
doesn't actually work in most places because addresses need resolving
before use, and `netaddress_resolve' just delegates to `getaddrinfo',
which doesn't understand Unix-domain sockets at all.

Fix this by synthesizing an appropriate `struct addrinfo *' list if the
address family is `AF_UNIX'.

4 months agolib/addr.c: Introduce our own `freeaddrinfo' function.
Mark Wooding [Mon, 1 Jun 2020 11:28:31 +0000 (12:28 +0100)]
lib/addr.c: Introduce our own `freeaddrinfo' function.

I plan to return fake `struct addrinfo' lists from `netaddress_resolve',
but I can't make one which can be freed using `freeaddrinfo''s secret
recipe, so I must make my own veneer.

5 months agolib/client.[ch]: Delete `disorder_client_af' which is no longer used.
Mark Wooding [Tue, 5 May 2020 17:21:07 +0000 (18:21 +0100)]
lib/client.[ch]: Delete `disorder_client_af' which is no longer used.

5 months agoclients/playrtp.c: Replace the hairy interface-scanning heuristics.
Mark Wooding [Tue, 5 May 2020 17:19:30 +0000 (18:19 +0100)]
clients/playrtp.c: Replace the hairy interface-scanning heuristics.

When we apply these heuristics, we already /have/ a known, working,
connection to the server.  So we can just use the address that the
kernel gave us for our stream reception address.

Replace the old hairy heuristics, and delete their support functions.

5 months agolib/client.[ch]: Add functions for reading the connection endpoint addresses.
Mark Wooding [Tue, 5 May 2020 17:18:36 +0000 (18:18 +0100)]
lib/client.[ch]: Add functions for reading the connection endpoint addresses.

Nothing uses these yet.

5 months agoclients/playrtp.c, lib/configuration.[ch]: Static config for `playrtp'.
Mark Wooding [Mon, 4 May 2020 17:30:54 +0000 (18:30 +0100)]
clients/playrtp.c, lib/configuration.[ch]: Static config for `playrtp'.

The `disorder-playrtp' program already reads the client configuration.
This change sets defaults for a number of parameters which could
previously only be changed from the command line, which is a problem
because `disorder-playrtp' is commonly invoked by Disobedience which
doesn't allow one to set a command-line.

These various tweaks are experimental, and may change, or even be
removed, in some later version.  The `rtp_request_address' and
`rtp_always_request' options, in particular, might be replaced by some
more complicated policy mechanism.

5 months agoclients/playrtp.c: Improve message reporting a unicast stream request.
Mark Wooding [Mon, 4 May 2020 17:28:51 +0000 (18:28 +0100)]
clients/playrtp.c: Improve message reporting a unicast stream request.

Suggested by Ian Jackson: thanks.

5 months agoclients/playrtp.c: Fix the RTP-stream request syntax.
Mark Wooding [Mon, 4 May 2020 17:28:39 +0000 (18:28 +0100)]
clients/playrtp.c: Fix the RTP-stream request syntax.

Previously, the `-' syntax was an undocumented (and booby-trapped) way
to inform the rest of the program that it should request a unicast
stream.  If we see this, then we apply some heuristics to select an
interface to bind to, and ask the server to hurl packets at it.

This is unsatisfactory.  One might want to set a particular port, say
because other ports are firewalled off by default.  And one might want
to set a particular address if the heuristics go wrong.

As a first step, overhaul the command-line parser to accept an address
and port name/number.  We still apply the old heuristics if no address
is provided explicitly, and we get the kernel to select a port number if
none is given.

This change is rather larger than I usually like, but there doesn't seem
to be a useful intermediate state.  Sorry.

5 months agoclients/playrtp.c: Make the `getaddrinfo' hints structure writable.
Mark Wooding [Mon, 4 May 2020 17:27:19 +0000 (18:27 +0100)]
clients/playrtp.c: Make the `getaddrinfo' hints structure writable.

I'm going to want to update this -- specifically the `ai_family' member
-- according to things I find at runtime.

5 months agoclients/playrtp.c: Insert a paragraph heading to break the monotony.
Mark Wooding [Mon, 4 May 2020 17:26:23 +0000 (18:26 +0100)]
clients/playrtp.c: Insert a paragraph heading to break the monotony.

This will make more sense later, I promise.

5 months agolib/uaudio-rtp.c: Always allow clients to request unicast RTP streams.
Mark Wooding [Mon, 4 May 2020 15:30:57 +0000 (16:30 +0100)]
lib/uaudio-rtp.c: Always allow clients to request unicast RTP streams.

This seems frequently useful.

5 months agolib/uaudio-rtp.c: Use dedicated per-family sockets for on-demand clients.
Mark Wooding [Mon, 4 May 2020 18:35:36 +0000 (19:35 +0100)]
lib/uaudio-rtp.c: Use dedicated per-family sockets for on-demand clients.

I want to allow on-clients to be able to request unicast streams even if
the primary RTP mode is something else.  That means that we can't use
the master socket for these on-demand streams unless we figure out its
address family.  This is simpler.

5 months agolib/uaudio-rtp.c: Set the send buffer for the IPv6 on-demand socket.
Mark Wooding [Mon, 4 May 2020 18:32:27 +0000 (19:32 +0100)]
lib/uaudio-rtp.c: Set the send buffer for the IPv6 on-demand socket.

Inexplicably missing.

5 months agolib/uaudio-rtp.c: Squidge up the socket-closing code.
Mark Wooding [Mon, 4 May 2020 18:30:39 +0000 (19:30 +0100)]
lib/uaudio-rtp.c: Squidge up the socket-closing code.

I plan to add another one, and the commonality in the code gets lost if
it's written out vertically.

5 months agolib/uaudio-rtp.c: Fix initial values for socket descriptors.
Mark Wooding [Mon, 4 May 2020 18:26:42 +0000 (19:26 +0100)]
lib/uaudio-rtp.c: Fix initial values for socket descriptors.

The code in `rtp_stop' checks for the sentinel value -1 when trying to
close sockets.  Without this, it might get (and then ignore!) a spurious
`EBADF' when shutting down.

5 months agolib/uaudio-rtp.c: Factor out setting the send-buffer size on a socket.
Mark Wooding [Mon, 4 May 2020 18:24:21 +0000 (19:24 +0100)]
lib/uaudio-rtp.c: Factor out setting the send-buffer size on a socket.

This is a preliminary step.  We'll want the same logic for other sockets
soon.

5 months agolib/configuration.c: Factor out common validation code.
Mark Wooding [Mon, 4 May 2020 17:30:01 +0000 (18:30 +0100)]
lib/configuration.c: Factor out common validation code.

I noticed in passing that `validate_non_negative' and
`validate_positive' were nearly identical.  Factor out the common part.

5 months agolib/configuration.c: Don't require a `broadcast' address in `request' mode.
Mark Wooding [Mon, 4 May 2020 15:31:43 +0000 (16:31 +0100)]
lib/configuration.c: Don't require a `broadcast' address in `request' mode.

It doesn't make any sense, so this is just annoying.

5 months agoMerge branch '5.2.x'
Mark Wooding [Tue, 5 May 2020 22:18:08 +0000 (23:18 +0100)]
Merge branch '5.2.x'

* 5.2.x:
  server/schedule.c: Maintain separate variables for raw and resolved tracks.
  lib/printf.h, libtests/t-printf.c: Bodge to inhibit warning from GCC 9.

5 months agoserver/schedule.c: Maintain separate variables for raw and resolved tracks. 5.2.x
Mark Wooding [Tue, 5 May 2020 19:06:05 +0000 (20:06 +0100)]
server/schedule.c: Maintain separate variables for raw and resolved tracks.

GCC 9 correctly points out that, if `trackdb_resolve' fails, we try to
print a null pointer in the error message, rather than the offending
track name.

Fix this by not reusing the same variable for two different jobs with
overlapping lifetimes.

5 months agolib/printf.h, libtests/t-printf.c: Bodge to inhibit warning from GCC 9.
Mark Wooding [Tue, 5 May 2020 18:53:45 +0000 (19:53 +0100)]
lib/printf.h, libtests/t-printf.c: Bodge to inhibit warning from GCC 9.

It seems that GCC 9 now peers closely at field-width specifiers in
`printf' format strings to make sure that they're sensible.  This is a
good thing except when you're trying to test how your `printf'-like
function copes with out-of-range field width specifiers.

Add a new macro `INHIBIT_PRINTF_FORMAT_CHECKING' to turn off the magic
GCC attribute, and use it in `t-printf.c' to prevent GCC from breaking
the build.

5 months agodebian/changelog: Prepare to develop the next version.
Mark Wooding [Mon, 4 May 2020 18:51:27 +0000 (19:51 +0100)]
debian/changelog: Prepare to develop the next version.

5 months agoclients/playrtp.c: Don't crash if an interface has a null address.
Mark Wooding [Mon, 4 May 2020 15:25:35 +0000 (16:25 +0100)]
clients/playrtp.c: Don't crash if an interface has a null address.

Just skip it and move on.

5 months agoclients/playrtp.c: Don't crash if given `-' on the command line.
Mark Wooding [Mon, 4 May 2020 13:10:23 +0000 (14:10 +0100)]
clients/playrtp.c: Don't crash if given `-' on the command line.

That just means that we didn't get the `-' from the server, so we must
open a connection for ourselves.  We'll still need it to request the RTP
stream.

5 months agolib/macros.c: Use `void (*)(void)' as the universal function-pointer.
Mark Wooding [Sun, 3 May 2020 15:19:23 +0000 (16:19 +0100)]
lib/macros.c: Use `void (*)(void)' as the universal function-pointer.

Newer versions of GCC complain about all kinds of explicit function-
pointer conversions unless (a) the arguments are /really/ similar,
or (b) they're to this specific `universal' function-pointer type.

The code which sets and uses these things looks safe to use, so I don't
think we need any further countermeasures.

5 months agolib/mime.c: Add a comment explaining the intentional `case' fall-through.
Mark Wooding [Sun, 3 May 2020 15:18:28 +0000 (16:18 +0100)]
lib/mime.c: Add a comment explaining the intentional `case' fall-through.

This is sufficient to muffle a newish GCC warning.

5 months agoMark `help' and `version' functions as not returning.
Mark Wooding [Sun, 3 May 2020 15:16:18 +0000 (16:16 +0100)]
Mark `help' and `version' functions as not returning.

They don't; and later versions of GCC complain about potential `switch'
fall-through mistakes without this.

Fixing this is a simple matter of adding `attribute((noreturn))' in the
right places.  Note that `server/gstdecode.c' doesn't share the common
attribute-macro machinery.

5 months agoRelease 5.2. 5.2
Mark Wooding [Sat, 2 May 2020 14:56:36 +0000 (15:56 +0100)]
Release 5.2.

Much overdue!

5 months agoPut myself as the primary maintainer.
Mark Wooding [Sat, 2 May 2020 22:41:45 +0000 (23:41 +0100)]
Put myself as the primary maintainer.

5 months agotests/dtest.py: Force a sensble locale if we don't have one.
Mark Wooding [Sat, 2 May 2020 23:21:24 +0000 (00:21 +0100)]
tests/dtest.py: Force a sensble locale if we don't have one.

Otherwise the server gets sad when it tries to convert track names
containing non-ASCII characters.  I picked `C.UTF-8' as being available
even when not explicitly configured.

5 months agoserver/Makefile.am: Add the codec test for Ogg Vorbis.
Mark Wooding [Sat, 2 May 2020 18:58:59 +0000 (19:58 +0100)]
server/Makefile.am: Add the codec test for Ogg Vorbis.

Now that we have our fuzzy comparison, this is safe to permit.

5 months agoserver/Makefile.am: Allow discrepancies for lossy codecs.
Mark Wooding [Sat, 2 May 2020 18:56:06 +0000 (19:56 +0100)]
server/Makefile.am: Allow discrepancies for lossy codecs.

It seems that `libMAD' on ARM32 doesn't produce the same output as it
does on x86; and the ARM64 version is a looooong way off.  I've not
investigated, but I suspect details of floating point and/or SIMD
optimization.  Anyway, smallish $L_\infty$ distance isn't especially
concerning.  After all, we're trying to make sure that we're using the
decoders right, rather than that the decoders conform to the relevant
specifications.

5 months agoscripts/compare-raw, server/Makefile.am: Add script for comparing raw audio.
Mark Wooding [Sat, 2 May 2020 18:53:28 +0000 (19:53 +0100)]
scripts/compare-raw, server/Makefile.am: Add script for comparing raw audio.

It does a very stupid comparison of corresponding samples to ensure that
they're not too far apart.  This is still an improvement over using
cmp(1).

5 months agoclients/playrtp.c: Configure the backend audio device before use.
Mark Wooding [Sat, 2 May 2020 17:01:02 +0000 (18:01 +0100)]
clients/playrtp.c: Configure the backend audio device before use.

This means it stands a chance of working if your audio device has a
weird mixer channel-name.

5 months agodebian/.gitignore: Move existing patterns from top-level `.gitignore'.
Mark Wooding [Sat, 2 May 2020 17:07:43 +0000 (18:07 +0100)]
debian/.gitignore: Move existing patterns from top-level `.gitignore'.

5 months agodebian/: Add .gitignore
Ian Jackson [Sat, 2 May 2020 15:12:44 +0000 (16:12 +0100)]
debian/: Add .gitignore

Ignores these files, which are generated by dpkg-buildpackage -uc -b

 debian/.debhelper/
 debian/build/
 debian/disobedience.debhelper.log
 debian/disobedience.postinst.debhelper
 debian/disobedience.postrm.debhelper
 debian/disobedience.substvars
 debian/disorder-gstreamer.debhelper.log
 debian/disorder-gstreamer.substvars
 debian/disorder-playrtp.debhelper.log
 debian/disorder-playrtp.substvars
 debian/disorder-server.debhelper.log
 debian/disorder-server.postinst.debhelper
 debian/disorder-server.postrm.debhelper
 debian/disorder-server.preinst.debhelper
 debian/disorder-server.prerm.debhelper
 debian/disorder-server.substvars
 debian/disorder.debhelper.log
 debian/disorder.substvars
 debian/tmp/

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2 years agoexamples/disorder.init.in: Read settings from `/etc/default/disorder'.
Mark Wooding [Tue, 24 Jul 2018 19:03:07 +0000 (20:03 +0100)]
examples/disorder.init.in: Read settings from `/etc/default/disorder'.

Most usefully, one can tweak locale settings here.

2 years agoserver/dump.c: Try to set the locale on startup.
Mark Wooding [Tue, 24 Jul 2018 19:02:27 +0000 (20:02 +0100)]
server/dump.c: Try to set the locale on startup.

Otherwise we get annoying cronspam if the configuration contains funny
characters.

2 years agocgi/cgimain.c: Make the CGI program be (a little) locale-aware.
Mark Wooding [Mon, 23 Jul 2018 01:26:53 +0000 (02:26 +0100)]
cgi/cgimain.c: Make the CGI program be (a little) locale-aware.

Otherwise it can't properly parse configuration files which contain
non-ASCII characters, e.g., for transforming pieces of track names.

2 years agoclients/disorder.c: Force line buffering when writing log.
Mark Wooding [Sat, 21 Jul 2018 14:26:21 +0000 (15:26 +0100)]
clients/disorder.c: Force line buffering when writing log.

Otherwise it looks fine on a terminal, but that's not very useful.  If a
program tries to read the log over a pipe, then it sees nothing for a
good long while until the buffer gets flushed.

This change is specific to the `log' command.  Output for other commands
comes out at the same time anyway.

2 years agodisobedience/control.c: Follow user toolbar style in full-size window.
Mark Wooding [Fri, 20 Jul 2018 11:02:06 +0000 (12:02 +0100)]
disobedience/control.c: Follow user toolbar style in full-size window.

Compact mode forces the icons-only style still, because smaller.

2 years agolib/uaudio-pulseaudio.c: Add volume control support.
Mark Wooding [Fri, 20 Jul 2018 02:17:54 +0000 (03:17 +0100)]
lib/uaudio-pulseaudio.c: Add volume control support.

Now that we have everything in place, implement PulseAudio volume
control.

2 years agolib/uaudio-pulseaudio.c: Rewrite using the asynchronous API.
Mark Wooding [Fri, 20 Jul 2018 02:15:16 +0000 (03:15 +0100)]
lib/uaudio-pulseaudio.c: Rewrite using the asynchronous API.

It's really hard to do volume control using the `simple' synchronous
API, because that involves `introspection' requests to the server, which
aren't part of the API, and it involves knowing the stream index, which
the API won't give us.

The rewrite isn't especially painful.

2 years agodisobedience, playrtp: Have `playrtp' handle volume control.
Mark Wooding [Fri, 20 Jul 2018 02:06:56 +0000 (03:06 +0100)]
disobedience, playrtp: Have `playrtp' handle volume control.

If the server is playing the audio directly, then it handles the volume
control too, as before.

If the server's transmitting using RTP, DisObedience /used/ to try to
twiddle the volume itself.  Instead, arrange for it to request volume
adjustment of the running `disorder-playrtp' instance via its socket
interface.

This has two advantages.

  * Firstly, `disorder-playrtp' actually knows which audio API it's
    using and therefore which method for fiddling with the volume will
    work best.  Indeed, DisObedience doesn't even have any configuration
    for selecting audio APIs, so it's only ever right by coincidence.
    On the other hand, `disorder-playrtp' has all of the necessary
    machinery.

  * Secondly, PulseAudio in particular has independent volume controls
    per input.  DisObedience has no hope of guessing which of these is
    the right one for `disorder-playrtp' without help, and it's cleaner
    just to give the whole job to `disorder-playrtp'.

2 years agolib/: Use Salsa20/8 for random bits, rather than RC4.
Mark Wooding [Tue, 17 Jul 2018 12:00:26 +0000 (13:00 +0100)]
lib/: Use Salsa20/8 for random bits, rather than RC4.

It's faster and produces better quality random bits; RC4's biases are
somewhat notorious.

2 years agoconfigure.ac: Add `chromium' and `google-chrome' to browser possibilities.
Mark Wooding [Fri, 20 Jul 2018 10:49:01 +0000 (11:49 +0100)]
configure.ac: Add `chromium' and `google-chrome' to browser possibilities.

Prefer Chromium over the fully Googly version because free software and
less spyware.

2 years agoconfigure.ac, debian/rules: Use `sensible-browser' by default.
Mark Wooding [Fri, 20 Jul 2018 10:44:20 +0000 (11:44 +0100)]
configure.ac, debian/rules: Use `sensible-browser' by default.

Use this rather than `x-www-browser' because the former can be
influenced by individual users by setting `BROWSER', while the latter
uses a symlink set by the system administrator and ignores individual
user preferences.

2 years agoCHANGES.html: Fix miscapitalization of `Disobedience'.
Mark Wooding [Fri, 20 Jul 2018 11:06:41 +0000 (12:06 +0100)]
CHANGES.html: Fix miscapitalization of `Disobedience'.

Where did I get the idea that it was supposed to be like this?

2 years agoCHANGES.html: Mention GStreamer-based tracklength plugin.
Mark Wooding [Fri, 20 Jul 2018 10:50:11 +0000 (11:50 +0100)]
CHANGES.html: Mention GStreamer-based tracklength plugin.

2 years agoplugins/tracklength-gstreamer.c: Remove unused header inclusion.
Mark Wooding [Fri, 13 Jul 2018 11:11:11 +0000 (12:11 +0100)]
plugins/tracklength-gstreamer.c: Remove unused header inclusion.

2 years agoplugins/tracklength-gstreamer.c: Use `GST_SECOND' instead of `1000...'.
Mark Wooding [Fri, 13 Jul 2018 10:55:02 +0000 (11:55 +0100)]
plugins/tracklength-gstreamer.c: Use `GST_SECOND' instead of `1000...'.

Honestly I'm rather surprised that I typed the right number of zeroes.

2 years agodebian/control: Demote `disorder-server' requirement on `httpd-cgi'.
Mark Wooding [Thu, 12 Jul 2018 00:47:51 +0000 (01:47 +0100)]
debian/control: Demote `disorder-server' requirement on `httpd-cgi'.

Now `Recommends', since it works OK without a webserver, though it does
limit your options for controlling it to the provided dedicated
clients (and many others which someone else develops).

2 years agoplugins/Makefile.am: Build standalone tracklength program.
Mark Wooding [Wed, 11 Jul 2018 11:56:36 +0000 (12:56 +0100)]
plugins/Makefile.am: Build standalone tracklength program.

This is mostly how I've been testing it; it seems harmless to include it
here.

2 years agoplugins/tracklength-gstreamer.c: Rewrite to use `GstDiscoverer'.
Mark Wooding [Wed, 11 Jul 2018 11:54:27 +0000 (12:54 +0100)]
plugins/tracklength-gstreamer.c: Rewrite to use `GstDiscoverer'.

The old version worked, but was fiddly, and very slow at some MP3
files.  It seems that if you start playing for a few milliseconds and
then ask, then you get a good answer, but since I found this out by
tripping over the `GstDiscoverer' machinery that GStreamer already has,
it seemed like a better idea to just use that.  Which means almost all
of the code has gone.

2 years agodebian/: Rename `disorder-server' templates so Debhelper can find them.
Mark Wooding [Wed, 11 Jul 2018 01:20:33 +0000 (02:20 +0100)]
debian/: Rename `disorder-server' templates so Debhelper can find them.

Oops.  I bungled 026a384f68227a00b2d33ca196d7c498ba643d4a.

2 years agoplugins/tracklength-gstreamer.c: Add GStreamer-based tracklength plugin.
Mark Wooding [Tue, 10 Jul 2018 10:40:09 +0000 (11:40 +0100)]
plugins/tracklength-gstreamer.c: Add GStreamer-based tracklength plugin.

Now we can have the proper lengths for all supported files.

2 years agoconfigure.ac, debian/: Set up correct dependencies for GStreamer.
Mark Wooding [Tue, 10 Jul 2018 10:38:33 +0000 (11:38 +0100)]
configure.ac, debian/: Set up correct dependencies for GStreamer.

This involves an unpleasant back-channel from the configure script to
the Debian packaging machinery to explain which GStreamer version it
chose, so that we can set the proper package names.

2 years agodebian/control: Rename `disorder-gstdecode' to `disorder-gstreamer'.
Mark Wooding [Tue, 10 Jul 2018 10:37:03 +0000 (11:37 +0100)]
debian/control: Rename `disorder-gstdecode' to `disorder-gstreamer'.

This package will include other GStreamer-based goodies.

2 years agodebian/control: Remove server dependency on `sox'.
Mark Wooding [Tue, 10 Jul 2018 10:30:43 +0000 (11:30 +0100)]
debian/control: Remove server dependency on `sox'.

It's not needed because the Debian build always uses `libsamplerate'.

2 years agodebian/control: Order `Build-Depends' alternatives by preference.
Mark Wooding [Tue, 10 Jul 2018 10:29:30 +0000 (11:29 +0100)]
debian/control: Order `Build-Depends' alternatives by preference.

I think this is mostly for the benefit of maintainers using it as a
cribsheet of packages to install.

2 years agoserver/gstdecode.c: Remove pointless casts to `GstElement'.
Mark Wooding [Tue, 10 Jul 2018 10:28:25 +0000 (11:28 +0100)]
server/gstdecode.c: Remove pointless casts to `GstElement'.

The `pipeline' already is one.

2 years agoserver/gstdecode.c: Label dest element correctly on link failure.
Mark Wooding [Tue, 10 Jul 2018 10:27:33 +0000 (11:27 +0100)]
server/gstdecode.c: Label dest element correctly on link failure.

2 years agoserver/gstdecode.c: Report more useful messages for missing plugins.
Mark Wooding [Tue, 10 Jul 2018 10:26:56 +0000 (11:26 +0100)]
server/gstdecode.c: Report more useful messages for missing plugins.

2 years agoserver/gstdecode.c: Dissect the message more portably.
Mark Wooding [Tue, 10 Jul 2018 10:25:29 +0000 (11:25 +0100)]
server/gstdecode.c: Dissect the message more portably.

We can use `gst_message_get_structure' in both versions, so do that
rather than ifdeffery.  Use the `GST_MESSAGE_TYPE' macro to get the
type, for future compatibility.

2 years agoserver/gstdecode.c: Unref reference-counted things properly.
Mark Wooding [Tue, 10 Jul 2018 10:22:35 +0000 (11:22 +0100)]
server/gstdecode.c: Unref reference-counted things properly.

Use the correct functions, which really are available in both versions,
so we can eliminate some ifdeffery.

Also restructure `decoder_pad_arrived' to not leak the new pad's caps.

2 years agoserver/gstdecode.c: With GStreamer 0.10, borrow the existing caps.
Mark Wooding [Tue, 10 Jul 2018 10:21:05 +0000 (11:21 +0100)]
server/gstdecode.c: With GStreamer 0.10, borrow the existing caps.

Otherwise we'd leak them.

2 years agodebian/: Rewrite using Debhelper.
Mark Wooding [Fri, 1 Dec 2017 12:04:10 +0000 (12:04 +0000)]
debian/: Rewrite using Debhelper.

The old `debian/rules' was a nightmare.  Modern Debhelper is really
quite pleasant, and makes short work of jobs which the old do-it-all-by-
hand script made a horrible meal out of.  Really, the diffstat summary

29 files changed, 146 insertions(+), 440 deletions(-)

says everything I need to know.

Being fair, though, this is quite an overhaul, but I've tried hard to
minimize the fallout.  These are the user-visible changes that I'm aware
of.  Any other changes are unintentional bugs.

  * The `disorder-server' cron script has changed name from
    `/etc/cron.daily/disorder' to `.../disorder-server'.  I could have
    avoided this, but I decided that it was actually better like this.
    The package scripts include the necessary machinery for renaming the
    configuration file.

  * I'm using `dh_installdocs' now, and it has its own heuristics about
    whether to compress documentation files.  As a result, a number of
    the smaller files in `/usr/share/doc/disorder' are no longer
    compressed.  Maybe some users will have to adjust bookmarks or
    something; if this breaks scripts, then I'm afraid that dealing with
    the wreckage is what you signed up for when you wrote those scripts.

Internally, the differences are more significant.

  * A number of affordances for configuring the Debian build have been
    removed or changed; I'm not going to make a list, mostly because the
    `debian/rules' file is now so trivial.  I'm inclined to say that
    retaining these would have been a bad idea.  I view the Debian
    packaging as a route to a stable, standard binary package, best
    built in a fresh, clean, minimal environment provided by something
    like `sbuild'.  I don't object to nonstandard packages at all: I
    just think they're best made and maintained by actually patching the
    code.

  * I've added `#DEBHELPER#' markers to the package scripts, and deleted
    some of the smaller ones entirely.  Debhelper doesn't make a whole
    lot of difference to the `disorder-server' postinst script, which is
    the big one, but losing the `disobedience' scripts is a clear win.

  * Debhelper wants to run `make check' during the package build.  I
    think this is a good idea, but it involves a little extra work.
    Because `sbuild' by default forces `LC_ALL' to `POSIX', the
    `queue.py' test fails about half the time; overriding `LC_ALL' to
    `C.UTF-8' in `debian/rules' hacks around this.  The `t-addr' library
    test wants to check resolution of service names, which introduces a
    build-dependency on `netbase' to provide `/etc/services'.  I would
    have had to include a dependency on `wget', but I chose to include
    the necessary test files inline instead.

2 years agolibtests: Include the Unicode test files directly.
Mark Wooding [Sat, 2 Dec 2017 21:44:38 +0000 (21:44 +0000)]
libtests: Include the Unicode test files directly.

Rather than fetch the files using `wget' at test time, fire up `gzip' to
decompress them from local copies.  The files compress really rather
well, so this is an overall saving in disk space relative to the
previous version -- especially since we now share the test files among
all build trees rather than having a separate copy in each.  On the
other hand, they're moderately large things to have in the source
distribution, though small compared to the `images/' tree.

Of course, the main reason for doing this is to completely eliminate the
need for external network connectivity during a build.

The copyright notice, at https://www.unicode.org/copyright.html, appears
to be compatible with the GPL (which is good, because I think we'd have
had a problem using these files even if we didn't distribute them).
I've included the copyright notice as COPYING.unicode-tests, in order to
comply with requirement (a).

Should it be necessary to update the copies of the test files, there's a
(slightly hairy) make target `update-unicode-tests' which can be invoked
by hand to do this.

2 years agoREADME: Update my copyright claim.
Mark Wooding [Wed, 29 Nov 2017 23:15:47 +0000 (23:15 +0000)]
README: Update my copyright claim.

2 years agodebian/rules: Omit disorder-gstdecode(8) from `disorder-server' package.
Mark Wooding [Wed, 29 Nov 2017 20:05:51 +0000 (20:05 +0000)]
debian/rules: Omit disorder-gstdecode(8) from `disorder-server' package.

Otherwise it turns up in two packages, and there is sadness.

2 years agoREADME: Update dependency versions.
Mark Wooding [Wed, 29 Nov 2017 11:45:45 +0000 (11:45 +0000)]
README: Update dependency versions.

2 years agodebian/control: Include `libdb5.3' as a suitable version.
Mark Wooding [Wed, 29 Nov 2017 11:41:28 +0000 (11:41 +0000)]
debian/control: Include `libdb5.3' as a suitable version.

2 years agoconfigure.ac, acinclude.m4, lib/regexp.[ch]: Support `libpcre2'.
Mark Wooding [Wed, 29 Nov 2017 11:37:56 +0000 (11:37 +0000)]
configure.ac, acinclude.m4, lib/regexp.[ch]: Support `libpcre2'.

This is the future of `pcre', so we'll have to support it sooner or
later.  Indeed, I think this probably counts as `later'.

2 years agoConcentrate knowledge about the `pcre' API in one place.
Mark Wooding [Wed, 29 Nov 2017 11:28:18 +0000 (11:28 +0000)]
Concentrate knowledge about the `pcre' API in one place.

Introduce a new `regexp' API in the library which knows about `pcre' and
actually invokes `pcre_...' functions.  Remove this knowledge from
everywhere else.

The new API is, of course, suspiciously similar to `pcre' in many ways,
but there are some differences.

  * Sizes, lengths, and offsets, are all `size_t' now.  In particular,
    this means that the `ovector' type has changed.

  * Errors are reported differently: rather than returning a pointer to
    a static string, `regexp_compile' writes the error string into a
    caller-provided buffer.

Observant readers might notice that these changes make the interface
more similar to the `pcre2' API.  They'd be right, and this is not a
coincidence.  But for now, there's no functional change.

2 years agoRemove ifdeffery for `HAVE_PCRE_H'.
Mark Wooding [Wed, 29 Nov 2017 11:22:48 +0000 (11:22 +0000)]
Remove ifdeffery for `HAVE_PCRE_H'.

This isn't actually an optional extra: the build simply won't work
without it, so the ifdeffery is just unnecessary complication.  Remove
it all.

Also, remove `#include <pcre.h>' from files which don't actually need
it.

2 years agoconfigure.ac, server/gstdecode.c: Support GStreamer 1.0.
Mark Wooding [Sun, 26 Nov 2017 20:28:20 +0000 (20:28 +0000)]
configure.ac, server/gstdecode.c: Support GStreamer 1.0.

I currently don't have plans to drop support for GStreamer 0.10, though
the differences are quite significant.

2 years agoconfigure.ac, server/Makefile.am: Refactor GStreamer autoconfery.
Mark Wooding [Sun, 26 Nov 2017 20:25:59 +0000 (20:25 +0000)]
configure.ac, server/Makefile.am: Refactor GStreamer autoconfery.

  * Introduce `--with-gstreamer=VERSIONS' configure option, which
    searches for the (space-separated) VERSIONS in order.

  * Pick up the `gstapp' and `gstaudio' libraries from `pkg-config'
    rather than probing randomly at `gstreamer-plugins-base-0.10' and
    hoping for the best.

  * Define a preprocessor symbol explaining which version we found.

2 years agoserver/gstdecode.c: Limit the buildup of internal buffers.
Mark Wooding [Sun, 26 Nov 2017 20:30:00 +0000 (20:30 +0000)]
server/gstdecode.c: Limit the buildup of internal buffers.

Block upstream decoding if we start to build up too many buffers
(presumably because downstream is waiting for real time to pass while it
plays audio at us).

The magic number 16 is plucked from nowhere in particular.  I have no
idea how to choose a number properly.

2 years agoserver/gstdecode.c: Add `-s' option to omit DisOrder's usual framing.
Mark Wooding [Sun, 26 Nov 2017 19:30:41 +0000 (19:30 +0000)]
server/gstdecode.c: Add `-s' option to omit DisOrder's usual framing.

The result can be piped into something like

play -b16 -c2 -esigned-integer -r44100 -L -traw -

to verify that its output approximates decoded audio.

2 years agodoc/disorder-gstdecode.8.in: Typeset option dashes correctly.
Mark Wooding [Sun, 26 Nov 2017 19:28:50 +0000 (19:28 +0000)]
doc/disorder-gstdecode.8.in: Typeset option dashes correctly.

2 years agotests/dtest.py: Refer to the home directory via a symlink.
Mark Wooding [Mon, 27 Nov 2017 10:18:11 +0000 (10:18 +0000)]
tests/dtest.py: Refer to the home directory via a symlink.

Pathnames during `make distcheck' are remarkably long, even if the
original project path is very short.  Indeed, the previous change which
added the test name into the `testroot' path is enough to push the
server's socket name over the magic 108-byte limit.

As an additional hack, arrange to refer to the home directory via a
symbolic link in `/tmp' (or wherever $TMPDIR points), which should be
much shorter.  The symlink is deleted on test completion, because
otherwise we'll fill up `/tmp' with cruft, but I hope this doesn't cause
too much in the way of diagnostic trouble.

2 years agotests/dtest.py: Maintain a separate test root for each test.
Mark Wooding [Mon, 27 Nov 2017 02:03:52 +0000 (02:03 +0000)]
tests/dtest.py: Maintain a separate test root for each test.

Now they can run in parallel without breaking each other, which is nice.
It's nice for two reasons: firstly, Automake changed behaviour and runs
tests in parallel by default nowadays; and secondly, the tests are
rather slow because they involve a bunch of waiting around for things,
and waiting for stuff in parallel is easy.

The downside is that we end up gobbling a lot of disk space with all of
the logfiles.  I think this is a good trade.

2 years agoserver/Makefile.am: Link `disorder_gstdecode' with `-lpcre'.
Mark Wooding [Fri, 17 Nov 2017 22:16:46 +0000 (22:16 +0000)]
server/Makefile.am: Link `disorder_gstdecode' with `-lpcre'.

Linkers which don't transitively follow shared-library dependencies
complain.  This is fair enough, because there's a real direct dependency
here.

2 years agodisobedience/misc.c: Muffle warning about `gdk_pixbuf_new_from_inline'.
Mark Wooding [Fri, 17 Nov 2017 22:15:38 +0000 (22:15 +0000)]
disobedience/misc.c: Muffle warning about `gdk_pixbuf_new_from_inline'.

Maybe we should use GResource at some point, but (a) it involves some
awful XML disaster, and (b) it's looking like way more effort than I
want to spend right now.

2 years agolib/configuration.c: Remove `type_stringlist', which nothing was using.
Mark Wooding [Fri, 17 Nov 2017 22:15:13 +0000 (22:15 +0000)]
lib/configuration.c: Remove `type_stringlist', which nothing was using.