paraslash.git
8 years agoweb: Clear DOT_FONTNAME in Doxyfile.
Andre Noll [Tue, 9 Jun 2015 17:42:31 +0000 (19:42 +0200)]
web: Clear DOT_FONTNAME in Doxyfile.

Doxygen-1.8.6. warns about DOT_FONTNAME being set:

Warning: doxygen no longer ships with the FreeSans font.
You may want to clear or change DOT_FONTNAME.
Otherwise you run the risk that the wrong font is being used for dot generated graphs.

The warning is harmless because the DOT_FONTNAME option has no effect
in our setup because HAVE_DOT is set to "NO". Setting DOT_FONTNAME
to the empty string, as recommended in the explanatory text after
the warning, silences the warning.

8 years agoweb: Update Doxyfile to doxygen-1.8.6.
Andre Noll [Tue, 9 Jun 2015 17:23:13 +0000 (19:23 +0200)]
web: Update Doxyfile to doxygen-1.8.6.

The system on which the public web pages are generated is now running
on Ubuntu-14.04 which ships doxygen-1.8.6. This version prints a
couple of warnings about obsolete tags in Doxyfile:

Warning: Tag `SYMBOL_CACHE_SIZE' at line 289 of file - has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `SHOW_DIRECTORIES' at line 483 of file - has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `HTML_ALIGN_MEMBERS' at line 820 of file - has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `USE_INLINE_TREES' at line 989 of file - has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"

This patch is the result of running doxygen -u. With the patch applied,
the above warnings go away.

There is no need to be backwards compatible here because the web pages
are not created during a normal build.

8 years agoMerge branch 'refs/heads/t/taggers'
Andre Noll [Sun, 27 Sep 2015 12:35:05 +0000 (12:35 +0000)]
Merge branch 'refs/heads/t/taggers'

Cooking in next since 2015-04-26.

* refs/heads/t/taggers:
  aac: Fix compilation without libmp4v2.
  The mp4 tagger.
  The mp3 tagger.
  The flac tagger.
  The ogg/speex tagger.
  The ogg/vorbis tagger.
  The ogg/opus tagger.
  The wma tagger.

8 years agobuild: maintainer-clean: Kill web_sync remove command.
Andre Noll [Mon, 7 Sep 2015 22:39:40 +0000 (00:39 +0200)]
build: maintainer-clean: Kill web_sync remove command.

This directory was used by a private script, but these days the script
creates its temporary files elsewhere. Hence it is no longer neccessary
to remove the directory in the receipe of the maintainer-clean target.

8 years agostring.c: Kill E_STRTOLL.
Andre Noll [Sat, 5 Sep 2015 11:01:18 +0000 (13:01 +0200)]
string.c: Kill E_STRTOLL.

This error code is unnecessary because para_atoi64() returns it only
if strtoll(3) did not perform any conversion and we have already a
more descriptive error code for this case: E_ATOI_NO_DIGITS.

Two new comments to para_atoi64() explain this in detail.

8 years agobuild: Completion headers no longer depend .c file.
Andre Noll [Wed, 2 Sep 2015 22:26:06 +0000 (00:26 +0200)]
build: Completion headers no longer depend .c file.

Due to commit 6aea41e6 (command_util.bash: Kill make_proto()) this
dependency can be dropped.

8 years agoattribute.c: Remove pointless condition in attribute_open().
Andre Noll [Sat, 29 Aug 2015 10:35:42 +0000 (12:35 +0200)]
attribute.c: Remove pointless condition in attribute_open().

ret is known to be negative at this point.

8 years agobitstream.c: Convert GET_DATA macro to inline function.
Andre Noll [Wed, 1 Apr 2015 02:55:50 +0000 (02:55 +0000)]
bitstream.c: Convert GET_DATA macro to inline function.

There is no benefit from defining this as a macro. With the inline
function we get type safety for free, and the new version is better
readable.

8 years agoparaslash 0.5.5 v0.5.5
Andre Noll [Sun, 20 Sep 2015 09:22:40 +0000 (11:22 +0200)]
paraslash 0.5.5

8 years agoMerge branch 'refs/heads/t/com_ls_compat'
Andre Noll [Thu, 17 Sep 2015 18:07:02 +0000 (20:07 +0200)]
Merge branch 'refs/heads/t/com_ls_compat'

A single commit which adds support for the new syntax for the -l and -s options
of the ls command. These options should now be specified as -l=v rather than
-lv, for example. The old syntax still works, but support will be dropped in
v0.6.0.

* fdb039 Introduce new syntax for com_ls().

8 years agobuild: Avoid bashism in configure.ac.
Andre Noll [Mon, 14 Sep 2015 18:14:25 +0000 (20:14 +0200)]
build: Avoid bashism in configure.ac.

'==' is not portable. In fact, NetBSD's /bin/sh complains about
this. The fix is trivial.

8 years agobuild: Include flac afh only if libogg is available.
Andre Noll [Mon, 14 Sep 2015 18:08:19 +0000 (20:08 +0200)]
build: Include flac afh only if libogg is available.

In configure.ac we have

AC_DEFUN([NEED_FLAC_OBJECTS], [{
test "$HAVE_OGG" = 'yes' -a "$HAVE_FLAC" = 'yes'
}])

In particular, we do not include the flac audio format handler on
systems where libflac is installed but libogg is not. In afh_common.c,
however, we only check for HAVE_FLAC. This results in a build failure
on those systems.

Fix this by modifying the check in afh_common.c to match the check
in configure.ac.

8 years agocom_add(): Allow paths and afhi to exceed 64K.
Andre Noll [Sun, 6 Sep 2015 13:05:30 +0000 (15:05 +0200)]
com_add(): Allow paths and afhi to exceed 64K.

The add command has the unnecessary limitation that for each audio
file to be added, the length of the path plus the size of serialized
audio format handler info structure (afhi) must not exceed 64K.

An afhi bigger than that is quite possible, given that it contains
the meta information of the file, for example an ID3v2 tag which can
contain almost unlimited amounts of data. If the 64K limit is exceeded,
all kinds of bad things may happen. So this issue definitely needs
to be addressed.

Specifically, save_add_callback_buffer() must be fixed. In this
function we serialize the data to be passed from the add command
handler to its callback. This includes path, afhi and the chunk table,
which are all variable in size. To cope with variable sizes, the
start of the buffer contains fields in which the offsets are stored
at which afhi and chunk table are located, relative to the start of
the serialized buffer. The problem is that the offset fields are only
16 bit wide, allowing for a maximal size of 64K.

This commit makes the offsets 32 bit wide and reorders them a
bit. Also, the CAB_AUDIO_FORMAT_OFFSET identifier is renamed to
CAB_AUDIO_FORMAT_ID_OFFSET.

8 years agoMerge branch 'maint'
Andre Noll [Sun, 6 Sep 2015 14:07:43 +0000 (16:07 +0200)]
Merge branch 'maint'

8 years agoserver.h: Improve documentation of mmd struct.
Andre Noll [Wed, 1 Apr 2015 00:25:04 +0000 (00:25 +0000)]
server.h: Improve documentation of mmd struct.

This adds a sentence to the description of the structure which explains
how the misc_meta_data structure is used for communication betweeen
the server process and the command handlers. The patch also contains
some minor language improvements.

8 years agoFix help text of mvblob commands.
Andre Noll [Thu, 3 Sep 2015 22:00:04 +0000 (00:00 +0200)]
Fix help text of mvblob commands.

No references to @member@ are allowed here since there is only one
help text for all four mvblob commands.

This bug was introduced one year ago in commit aa4b3935 (Overhaul
help texts of server and afs commands).

8 years agormblob: Generate proper BLOB_REMOVE_EVENT.
Andre Noll [Fri, 4 Sep 2015 07:24:12 +0000 (09:24 +0200)]
rmblob: Generate proper BLOB_REMOVE_EVENT.

com_rmblob_callback() of blob.c is responsible for removing blobs from
any of the four blob tables (images, lyrics, moods, playlists). After
a blob has been removed, the function generates an AFS event to tell
the other tables about the removal.

However, the call to afs_event() passes the event identifier
BLOB_RENAME rather than BLOB_REMOVE to the event handlers, which is
clearly incorrect. Fortunately, this does not matter because the only
event handler which cares about blob events is the one in mood.c,
and this handler treats the two events identically. Nevertheless,
it's is a bug that should be fixed.

This bug was introduced eight years ago when event handling was
introduced: commit 02d818d9 (Complete afs event handling).

8 years agoIntroduce new syntax for com_ls().
Andre Noll [Wed, 26 Aug 2015 20:24:02 +0000 (22:24 +0200)]
Introduce new syntax for com_ls().

The ls command is the only command that takes one-letter arguments
which immediately follow the option. For example, -lv activates
verbose listing mode. If we ever want to support short option combining
(like in rm -rf) for paraslash commands, the one-letter arguments are
problematic because, in the above example, -lv can also be interpreted
as -l -v.

This commit encourages a different syntax for the -l and -s options
of the ls command while keeping the one-letter options working
for backwards compatibility. The new official way to enable verbose
listing mode is -l=v. This is analogous to how the "stat" and "touch"
commands expect their arguments.

The ls completer and the documentation are also updated according to
the new syntax.

8 years agosetatt: Do not abort if no pattern is given.
Andre Noll [Sat, 29 Aug 2015 13:10:25 +0000 (15:10 +0200)]
setatt: Do not abort if no pattern is given.

It is an error if no pattern is given to the setatt command.
For example,

setatt foo+ bar-

should result in a syntax error because no file name pattern is given.
The code in aft.c contains an assertion to detect this type of error,
but the afs proccess terminates if the condition of the assert
statement is not fulfilled:

para_server (afs): aft.c:2557: com_setatt_callback: Assertion `p < (char *)query->data + query->size' failed.

This patch turns the assertion into a normal check which merely causes
the command to fail if no pattern was given.

The bug was introduced two years ago in commit 73299ebf (com_setatt():
Allow to specify a file name pattern).

8 years agoaudiod_command.c: Trivial whitespace fix.
Andre Noll [Tue, 18 Aug 2015 18:33:16 +0000 (20:33 +0200)]
audiod_command.c: Trivial whitespace fix.

8 years agoMerge branch 'maint'
Andre Noll [Sun, 30 Aug 2015 11:22:19 +0000 (13:22 +0200)]
Merge branch 'maint'

* maint:
  lsatt: Fix sort order.
  server: Avoid segfault in com_sender().

8 years agolsatt: Fix sort order.
Andre Noll [Fri, 28 Aug 2015 20:33:57 +0000 (22:33 +0200)]
lsatt: Fix sort order.

The -i option had the opposite effect of what the documentation
says. That is, lsatt -i sorted the attribute list by name while the
default was to sort by id. This patch reverts the logic in com_lsatt()
to let the implementation match the documentation.

8 years agoserver: Avoid segfault in com_sender().
Andre Noll [Sat, 22 Aug 2015 14:21:53 +0000 (16:21 +0200)]
server: Avoid segfault in com_sender().

If exactly one argument is given to the sender command, and this
argument is the name of an existing sender, the sender command
segfaults due to the NULL pointer dereference. The problem is an
off-by-one bug in the check for the number of arguments.

This patch makes sure we never dereference argv[2] if it is NULL.

8 years agoMerge branch 'maint'
Andre Noll [Sat, 29 Aug 2015 10:54:58 +0000 (12:54 +0200)]
Merge branch 'maint'

* maint:
  mood: Clear the score table on attribute changes.

8 years agoFix typo in server.c.
Andre Noll [Mon, 10 Aug 2015 20:28:05 +0000 (22:28 +0200)]
Fix typo in server.c.

The full stop needs to be a comma.

8 years agomm.c: Add documentation of mood comparator macros.
Andre Noll [Sun, 14 Jun 2015 13:02:11 +0000 (15:02 +0200)]
mm.c: Add documentation of mood comparator macros.

This makes doxygen a bit happier, and it's good to document the
preprocessor magic anyway.

8 years agooggdec: Add documentation of output size constants.
Andre Noll [Wed, 1 Apr 2015 02:18:29 +0000 (02:18 +0000)]
oggdec: Add documentation of output size constants.

The OGGDEC_MAX_OUTPUT_SIZE and OGGDEC_OUTPUT_CHUNK_SIZE defines in
oggdec_filter.c are undocumented. This commit adds comments for both which
explain the meaning of the two sizes.

8 years agospxdec: Fix typo in comment.
Andre Noll [Sat, 20 Jun 2015 21:10:47 +0000 (23:10 +0200)]
spxdec: Fix typo in comment.

8 years agoaudiod_command.c: Fix typo in comment.
Andre Noll [Sun, 9 Aug 2015 19:10:10 +0000 (21:10 +0200)]
audiod_command.c: Fix typo in comment.

8 years agocommand_util.bash: Kill make_proto().
Andre Noll [Tue, 13 Jan 2015 23:52:02 +0000 (00:52 +0100)]
command_util.bash: Kill make_proto().

It is always a bad idea to parse C code with a regex in a script. In
addition, it is completely unnecessary in this case.

This commit changes command_util.bash to define, in addition to the
old XXX_CMD_ARRAY, another preprocessor macro XXX__COMMAND_HANDLERS
containing the comma separated list of command handlers without
any type information instead of grepping the source files. A simple
typedef is used to declare all command handlers.

Avoiding all the grep/sed calls reduces the (warm cache) make dep
time by ~10%.

8 years agoaudiod: Clean up fd closing logic in command handlers.
Andre Noll [Tue, 13 Jan 2015 22:53:28 +0000 (23:53 +0100)]
audiod: Clean up fd closing logic in command handlers.

audiod_command.c contains this comment:

/*
 * command handlers don't close their fd on errors (ret < 0) so that
 * its caller can send an error message. Otherwise (ret >= 0) it's up
 * to each individual command to close the fd if necessary.
 */

This is a somewhat weird rule and this commit gets rid of it. Instead,
from now on the command handlers must not close their file descriptor
and handle_connect() closes it unconditionally.

The grab and stat commands need special treatment, which was the reason
for imposing the above rule. They need to keep the file descriptor open
to send the status items or the grabbed stream to the client. This
patch makes these two handlers create a copy of the descriptor with
dup(2). The new approach is simpler and less error-prone.

8 years agoserver: Remove command pointer from struct command_context.
Andre Noll [Tue, 13 Jan 2015 23:00:41 +0000 (00:00 +0100)]
server: Remove command pointer from struct command_context.

Command handlers should not know about this implementation detail.

This commit also changes parse_sb_command() to not only parse the
command line but to actually run the command in case the caller has
sufficient permissions. The function is renamed to run_command()
to reflect this change.

We use the opportunity to clean up the allocation and freeing of
the command buffer and the argument vector. Both are now freed in
the same function they were allocated, which is considered good
programming practice.

8 years agoserver: Reduce scope of struct server_command.
Andre Noll [Tue, 13 Jan 2015 23:00:05 +0000 (00:00 +0100)]
server: Reduce scope of struct server_command.

This structure is only needed in command.c, so we can make it local
to this file. As structures defined in .c files are not included
in doxygen, the reference to struct server_command in server.h must
be removed.

8 years agoaudiod: Reduce scope of struct audiod_command.
Andre Noll [Tue, 13 Jan 2015 23:49:52 +0000 (00:49 +0100)]
audiod: Reduce scope of struct audiod_command.

This structure is only used in audiod_command.c, so move the
declaration from audiod.h to audiod_command.c.

8 years agoaction_if_pattern_matches(): Always count matching rows.
Andre Noll [Sun, 5 Apr 2015 14:07:28 +0000 (14:07 +0000)]
action_if_pattern_matches(): Always count matching rows.

We missed to do this if PM_NO_PATTERN_MATCHES_EVERYTHING is set.

8 years agobuild: Unify spelling of commands and directories.
Andre Noll [Wed, 27 Aug 2014 21:33:41 +0000 (23:33 +0200)]
build: Unify spelling of commands and directories.

Always spell commands in upper case and directories in lower case.

This is a first step to auto-generate Makefile.in.

8 years agomood: Clear the score table on attribute changes.
Andre Noll [Sat, 20 Jun 2015 18:26:33 +0000 (20:26 +0200)]
mood: Clear the score table on attribute changes.

Although the comment in mood.c correctly states that the score table
must be cleared and reloaded if an attribute is added, removed or
renamed, the mood event handler misses to clear the score table.
Therefore, after reload_current_mood() has reloaded the mood object,
insertion of admissible files fails with

afs_event: table moods, event 0: key already exists in rbtree

This results in an unmodified set of admissible files.

The only other caller of reload_current_mood() clears the score table
right before the function call, so the easiest fix is to move the
call to clear_score_table() into reload_current_mood().

8 years agoclient: Add details to --key-file option.
Andre Noll [Mon, 30 Mar 2015 21:39:13 +0000 (21:39 +0000)]
client: Add details to --key-file option.

The new text lists the locations where para_clients looks for
private keys.

8 years agoclient.m4: Adjust coding style of ggo options.
Andre Noll [Mon, 30 Mar 2015 21:30:02 +0000 (21:30 +0000)]
client.m4: Adjust coding style of ggo options.

All other commands use one line per directive of each option, which
improves the readability of the ggo file. This commit changes the
.m4 file for the client options to match this style of specifying
the gengetopt options.

No real changes.

8 years agodaemon: Improve daemon_log_welcome().
Andre Noll [Mon, 15 Dec 2014 19:20:44 +0000 (20:20 +0100)]
daemon: Improve daemon_log_welcome().

This function is used within para_server and para_audiod. Adding the
"para_" prefix in daemon_log_welcome() rather than its callers avoids
the duplication. Also rename the "whoami" parameter to "name" and add
documentation for it. Finally, the build date is not really important
in the log message, so simply remove it.

8 years agosetatt: Print meaningful error message.
Andre Noll [Mon, 19 Jan 2015 19:39:21 +0000 (20:39 +0100)]
setatt: Print meaningful error message.

An attempt to set or unset a non-existing attribute currently results in

key not found in rbtree

which is a bit cryptic. This commit adds another message that clarifies
what went wrong.

8 years agovss: Perform stream change actions in vss_post_select().
Andre Noll [Sun, 21 Dec 2014 19:05:47 +0000 (19:05 +0000)]
vss: Perform stream change actions in vss_post_select().

The pre_select methods should only set the scheduler timeouts and
manipulate fd sets.

Clean up the documentation a bit while at it.

8 years agoaft.c: Remove condition which is always false.
Andre Noll [Mon, 22 Dec 2014 01:15:19 +0000 (01:15 +0000)]
aft.c: Remove condition which is always false.

aft_open() returns early if ret is non-negative, so ret is known to
be negative at this point.

Upgrade the log message severity on open failure from INFO to NOTICE
while at it.

8 years agoaft.c: Silence noisy warnings in com_add().
Andre Noll [Wed, 24 Dec 2014 02:55:52 +0000 (02:55 +0000)]
aft.c: Silence noisy warnings in com_add().

If the -a option to com_add() is not given, we ignore paths for which
guess_audio_format() returns negative. Currently the add command sends
a warning to the client for each skipped file, which may result in
very verbose output. This commit silences the warning.

8 years agoweb: fix htaccess description of snapshot tarball.
Andre Noll [Sun, 3 May 2015 10:51:13 +0000 (12:51 +0200)]
web: fix htaccess description of snapshot tarball.

Without this, the snapshot tarball file on the download web page is
annotated as "release tarball" rather than "current master snapshot".

Fix this by adding two additional patterns to the .htaccess file.

8 years agobuild: Add -Wunused-macros to CPPFLAGS on Linux.
Andre Noll [Wed, 1 Apr 2015 02:50:27 +0000 (02:50 +0000)]
build: Add -Wunused-macros to CPPFLAGS on Linux.

We already specify -Wunused which combines all -Wunused options but
does not activate the -Wunused-macros cpp warning.

8 years agoMerge branch 'maint'
Andre Noll [Sat, 30 May 2015 09:54:47 +0000 (11:54 +0200)]
Merge branch 'maint'

8 years agoMerge branch 'refs/heads/t/web-diet'
Andre Noll [Sun, 10 May 2015 18:27:35 +0000 (20:27 +0200)]
Merge branch 'refs/heads/t/web-diet'

Was cooking in next for three weeks.

* web: Remove screenshots, license and credits page.
* web: Integrate Contact page into about.
* web: Make FEATURES the new homepage, rename it to "about".
* web: Shorten feature list

8 years agoFix help text of lsblob commands.
Andre Noll [Sun, 10 May 2015 17:58:41 +0000 (19:58 +0200)]
Fix help text of lsblob commands.

The help text of the lsblob commands talked about attributes but
of course the commands list arbitrary blobs (images, lyrics, moods,
playlists).

This bug was introduced eight years ago in commit 4b80a041 (afs.cmd:
Update help output).

8 years agomanual: Improve section on decoders.
Andre Noll [Wed, 1 Apr 2015 13:55:46 +0000 (13:55 +0000)]
manual: Improve section on decoders.

Decoders are also part of para_play but only para_filter and
para_audiod are mentioned in the text.  Let's just talk about
"executables" here.

8 years agomanual: Fix paragraph on addblob commands.
Andre Noll [Wed, 1 Apr 2015 13:48:16 +0000 (13:48 +0000)]
manual: Fix paragraph on addblob commands.

These days we have the AWAITING_DATA sideband designator to distinguish
between normal and addblob commands.

8 years agoMerge branch 'refs/heads/t/audiod_acl'
Andre Noll [Sun, 3 May 2015 09:51:22 +0000 (11:51 +0200)]
Merge branch 'refs/heads/t/audiod_acl'

Cooking for about one month.

* audiod: Allow to specify usernames in --user-allow.

8 years agoAllow to start server and audiod as daemon with no logfile.
Andre Noll [Tue, 7 Oct 2014 14:02:07 +0000 (14:02 +0000)]
Allow to start server and audiod as daemon with no logfile.

Currently para_audiod and para_server won't start in the background
if no logfile is specified, so "-dL /dev/null" must be given to force
this. This is a bit tedious to type, so this commit makes "/dev/null"
the default.

To achive this, we can simply remove the gengetopt "dependon" statement
from daemon.m4. This works because if no logfile was given, log output
is written to stderr, which is redirected to /dev/null in case -d
was also given. We need to open /dev/null in read-write mode though,
but no other changes are required.

8 years agoerror.h: Fix typo in error text of E_BAD_AFSI.
Andre Noll [Mon, 6 Apr 2015 00:10:54 +0000 (00:10 +0000)]
error.h: Fix typo in error text of E_BAD_AFSI.

8 years agoaac: Fix compilation without libmp4v2.
Andre Noll [Sun, 26 Apr 2015 13:59:26 +0000 (15:59 +0200)]
aac: Fix compilation without libmp4v2.

This was broken for two reasons: First, the aac audio format handler
depends on libmp4v2 rather than libfaad. Second, we must include
aac_common if either libfaad or libmp4v2 (or both) were found. The
logic in configure.ac got this wrong.

8 years agoThe mp4 tagger.
Andre Noll [Thu, 17 Apr 2014 21:16:11 +0000 (21:16 +0000)]
The mp4 tagger.

This commit adds support for editing meta tags of mp4 files. We
employ the mp4v2 library to do the work, so fairly little code has
to be added to the aac audio format handler.

We could deactivate tag editing for mp4 files if libmp4v2 was not
detected, but since subsequent commits for the aac audio format
handler will be based on the mp4v2 library as well, we keep it simple
and deactivate aac support completely in this case.

8 years agoThe mp3 tagger.
Andre Noll [Thu, 26 Dec 2013 20:22:12 +0000 (20:22 +0000)]
The mp3 tagger.

This commit adds support for adding and modifying the ID3 tags of mp3
files. Both ID3 version 1 and version 2 are supported. If no tags
were found, a version 2 tag is added, otherwise only the existing
tags are modified.

The documentation is updated to mention that libid3tag is required
for the new feature.

8 years agoThe flac tagger.
Andre Noll [Wed, 25 Dec 2013 02:49:00 +0000 (02:49 +0000)]
The flac tagger.

This commit adds support to modify the vorbis comments of a flac
file. As usual, only the artist, title, album, year and comment tags
are supported.

As for the implementation, we first locate the vorbis comment
block by iterating over all metadata blocks. In this block
we replace each comment by the tags provided as an argument to
flac_rewrite_tags(). To work around a bug in old flac versions we
avoid to call FLAC__metadata_object_vorbiscomment_replace_comment(),
which would not replace tags as advertised. Instead we first delete
the comment and then append a new tag.

Once all tags have been replaced this way, we write out the temporary
file using FLAC__metadata_chain_write_with_callbacks_and_tempfile().
To do this we needed to convince libflac to not modify the original
file in place, which turned out to be more difficult than it should be.

8 years agoThe ogg/speex tagger.
Andre Noll [Fri, 27 Dec 2013 00:22:01 +0000 (00:22 +0000)]
The ogg/speex tagger.

This commit adds support for editing meta information of ogg/speex
files. As for ogg/opus and ogg/vorbis we make use of the generic
ogg_rewrite_tags() to write out an ogg file with modified tags. Hence
this patch only adds the speex-specific part, spx_make_meta_packet(),
which creates a meta data packet for the altered tags.

8 years agoThe ogg/vorbis tagger.
Andre Noll [Mon, 16 Dec 2013 07:35:59 +0000 (08:35 +0100)]
The ogg/vorbis tagger.

Thanks to the previous commit which implemented the generic
ogg_rewrite_tags() as part of the the ogg/opus tagger, it is rather
simple to provide the same functionality also for the ogg/vorbis
audio format.

This patch adds a new function to ogg_afh.c which creates
a vorbis-specific metadata ogg packet and passes it to
ogg_rewrite_tags().

8 years agoThe ogg/opus tagger.
Andre Noll [Sun, 15 Dec 2013 20:01:57 +0000 (21:01 +0100)]
The ogg/opus tagger.

This adds support for modifying meta tags of ogg/opus files. The heart
of this patch is ogg_rewrite_tags(), a codec-independent function
which replaces the meta packet of an ogg stream. This function will
also be used in subsequent patches which add support for ogg/vorbis
and ogg/speex files.

In order to create identically sized ogg pages for the output, the
new ogg_rewrite_tags() function calls ogg_stream_flush_fill() if it
is available. This function was introduced in libogg version 1.3.0.
So this commit adds a configure check and makes ogg_rewrite_tags()
fall back to ogg_stream_flush() on systems where libogg lacks
ogg_stream_flush_fill().

8 years agoThe wma tagger.
Andre Noll [Sun, 27 Oct 2013 17:50:14 +0000 (18:50 +0100)]
The wma tagger.

This adds infrastructure to support meta tag editing. If the new
--modify option is given to para_afh, the arguments to --title,
--artist, --album and --comment are used to alter the meta information
of the audio file. Only the wma audio format handler is extended
to support the new feature. Patches for other audio format handlers
follow.

As for the implementation, this commit adds the function pointer
->rewrite_tags to struct audio_format_handler.  This function takes
a file descriptor to a newly opened temporary file. The individual
audio format handlers are supposed to write the altered contents to
this file descriptor. On success, the temporary file is renamed on
top of the original file unless --backup is given.

Since meta tags in wma files are encoded in UTF-16 we need primitives
to convert from UTF8 to UTF16 and vice versa. These are provided by
libiconv, so we check for this library and deactivate the new features
on systems that lack libiconv.

Unfortunately the signatures of iconv() are different between Linux
and FreeBSD. To deal with this incompatibility this patch adds a
configure check to determine if the cast is necessary.

8 years agoMerge branch 'refs/heads/t/immediate-si-update'
Andre Noll [Sun, 26 Apr 2015 12:11:56 +0000 (14:11 +0200)]
Merge branch 'refs/heads/t/immediate-si-update'

Cooking in next for four weeks.

* aft: Store resolved paths when adding files.
* aft: Update mtime and file size on afhi changes.
* aft: Update status items on afs events.
* aft.c: Pass struct ls_data pointer to make_status_items().
* afs: Simplify open_next_audio_file().

Conflicts:
aft.c

9 years agoversion.c: Update copyright year to range 2002-2015.
Andre Noll [Tue, 7 Apr 2015 18:34:05 +0000 (18:34 +0000)]
version.c: Update copyright year to range 2002-2015.

Although we don't update the year in each source file any more,
version.c contains the text that is printed with --version. So this
text should be up to date, and it should be a range. This commit
changes it from "2014" to "2002-2015".

2002 seems appropriate for the first year in the range since the
initial cvs commit was in 2002. Some code is older than that, but
that's probably not important.

9 years agotouch, rm, cpsi, init: Fix initialization of para_buffer.
Andre Noll [Tue, 7 Apr 2015 23:56:11 +0000 (23:56 +0000)]
touch, rm, cpsi, init: Fix initialization of para_buffer.

Three years ago, in commit 68cb0aef (Introduce
afs_max_size_handler_data and afs_max_size_handler()) the afs callbacks
were converted to pass a pointer to an afs_max_size_handler_data
structure to the dispatcher. This structure is defined as

struct afs_max_size_handler_data {
int fd;
uint8_t band;
};

However, we missed to convert the callbacks of the three commands
mentioned in the subject. All these commands except init pass
a pointer to an int as they did before commit 68cb0aef. Since
afs_max_size_handler_data stores one additional byte (the band
designator) after the file descriptor, the dispatcher will read one
byte past the allocated space.

This bug is benign because the max size handler is usually not called
for the affected commands, since they never have more than SHMMAX
bytes of output. For com_init() we even set the private_data pointer
to NULL, so the max size handler will never be called.

Let's fix it anyway.

9 years agoweb: Remove screenshots, license and credits page.
Andre Noll [Sat, 3 Jan 2015 02:50:12 +0000 (02:50 +0000)]
web: Remove screenshots, license and credits page.

The server and audiod log files provided little information and
were constantly outdated, so this patch removes them. The para_gui
screenshot is turned into a link in the feature list where para_gui
is mentioned. This gets rid of the screenshots page.

The paraslash license is mentioned on the main page, so we don't
need a dedicated page for it. The CREDITS file stays in the git repo
of course but we don't need a web page for this either. It's fairly
static anyway.

9 years agoweb: Integrate Contact page into about.
Andre Noll [Sat, 3 Jan 2015 02:39:57 +0000 (02:39 +0000)]
web: Integrate Contact page into about.

This page contains only an email address and one sentence. The main
page is a better place for this information.

9 years agoweb: Make FEATURES the new homepage, rename it to "about".
Andre Noll [Sat, 3 Jan 2015 02:23:18 +0000 (02:23 +0000)]
web: Make FEATURES the new homepage, rename it to "about".

This commit moves the FEATURES file to web/about.html.in, switching
the syntax from grutatxt to plain html. The new file is translated into
index.html while the old main page is now available as the "News" page.

9 years agoweb: Shorten feature list
Andre Noll [Sat, 3 Jan 2015 01:58:23 +0000 (01:58 +0000)]
web: Shorten feature list

This list was a bit too verbose for a web page. This patch reduces
the level of detain to mention only the most prominent features.

9 years agoaft.c: Simplify load_afd().
Andre Noll [Wed, 24 Dec 2014 02:52:03 +0000 (02:52 +0000)]
aft.c: Simplify load_afd().

Remove the pointless variable "buf".

9 years agoMerge branch 't/lib_arg_with'
Andre Noll [Sun, 19 Apr 2015 11:49:54 +0000 (13:49 +0200)]
Merge branch 't/lib_arg_with'

Was cooking in next for three weeks.

* t/lib_arg_with:
  build: Fix curses detection.
  build: Convert curses detection to new macros.
  build: Convert libreadline detection to new macros.
  build: Convert oss detection to new macros.
  build: Convert libsamplerate detection to new macros.
  build: Convert libao detection to new macros.
  build: Convert alsa detection to new macros.
  build: Convert flac detection to new macros.
  build: Convert libid3tag detection to new macros.
  build: Convert mad detection to new macros.
  build: Convert faad detection to new macros.
  build: Convert crypto detection/selection to new macros.
  build: Convert opus detection to new macros.
  build: Convert speex detection to new macros.
  build: convert vorbis detection to new macros.
  build: Convert ogg detection to new macros.
  build: Reduce redundancy in configure.ac, convert osl detection.

9 years agoMerge branch 'maint'
Andre Noll [Sun, 19 Apr 2015 11:42:14 +0000 (13:42 +0200)]
Merge branch 'maint'

9 years agogcrypt: Initialize key size of public ASN keys.
Andre Noll [Wed, 18 Feb 2015 15:40:40 +0000 (16:40 +0100)]
gcrypt: Initialize key size of public ASN keys.

This bug could make applications acccept short keys. Not a serious
problem since (a) ASN keys are deprecated in favor of ssh keys and
(b) encrypting a 256 byte buffer fails anyways on short keys. Let's
fix it anyway.

9 years agogcrypt: Some trivial fixes.
Andre Noll [Wed, 18 Feb 2015 15:40:01 +0000 (16:40 +0100)]
gcrypt: Some trivial fixes.

Some whitespace issues, but also a typo and two instances of
superfluous parentheses.

9 years agoaft: Rename label "err" of open_and_update_audio_file().
Andre Noll [Sun, 21 Dec 2014 14:54:18 +0000 (14:54 +0000)]
aft: Rename label "err" of open_and_update_audio_file().

We also execute this on success.

9 years agoaudiod: Make struct slot_info local to audiod.c.
Andre Noll [Sun, 4 Jan 2015 04:55:43 +0000 (04:55 +0000)]
audiod: Make struct slot_info local to audiod.c.

Thanks to the previous commit there is only one user of struct
slot_info left in audiod_command.c: decoder_flags(). Moving this
function to audiod.c allows to make the structure private to audiod.c,
along with the slot array and the MAX_STREAM_SLOTS and FOR_EACH_SLOT
macros.

Since audiod_command still needs the decoder flags for the stat command,
the function is made public and renamed to audiod_get_decoder_flags().

9 years agoaudiod: Move get_play_time_slot_num() to audiod.c.
Andre Noll [Sun, 4 Jan 2015 04:39:15 +0000 (04:39 +0000)]
audiod: Move get_play_time_slot_num() to audiod.c.

audiod_status_dump() sends the play time string that corresponds
to the current slot to all connected stat clients. It first calls
the get_play_time_slot_num() helper to obtain the slot number, then
calls get_time_string(slot_num).

Currently the helper function is part of audiod_command.c, hence
we expose the slot_info structure to audiod_command.c. Moving the
helper from audiod_command.c to audiod.c is a first step to make this
structure local to audiod.c.  It also allows to remove the slot_num
parameter from get_time_string().

9 years agoalsa: Avoid alloca().
Andre Noll [Fri, 2 Jan 2015 20:10:56 +0000 (20:10 +0000)]
alsa: Avoid alloca().

It is not in POSIX.1-2001, and its use is discouraged. Fortunately,
the alsa library provides also variants which call ordinary malloc(),
so use these instead.

9 years agocommand: Make struct command_context->cmd_ptr const.
Andre Noll [Mon, 5 Jan 2015 03:28:58 +0000 (03:28 +0000)]
command: Make struct command_context->cmd_ptr const.

The fields of struct server command never need to be modified so they
can be const.

9 years agoafs.c: Trivial whitespace cleanup.
Andre Noll [Wed, 1 Apr 2015 01:34:26 +0000 (01:34 +0000)]
afs.c: Trivial whitespace cleanup.

9 years agoserver.h: Trivial whitespace/language cleanup.
Andre Noll [Wed, 1 Apr 2015 00:25:50 +0000 (00:25 +0000)]
server.h: Trivial whitespace/language cleanup.

9 years agobuild: Fix curses detection.
Andre Noll [Tue, 31 Mar 2015 21:11:10 +0000 (21:11 +0000)]
build: Fix curses detection.

We need to append to the $curses_ldflags variable rather than
overwriting it. Without this fix, --with-curses-libs is effectively
ignored.

9 years agoaudiod: Allow to specify usernames in --user-allow.
Andre Noll [Mon, 19 Jan 2015 23:25:18 +0000 (00:25 +0100)]
audiod: Allow to specify usernames in --user-allow.

It's more convenient to specify usernames rather than the UIDs of
the users who may execute an audiod command. This patch allows to
do so. For backwards compatibility we still need to accept numerical
UIDs though.

On startup we first try to convert each given --user-allow argument
to a number and regard this number as a UID. Only if the conversion
fails, we translate the argument to a username with getpwnam().
In order to not perform this conversion on each command, we allocate
a UID whitelist at startup and populate it with the UIDs derived from
both types of --user allow arguments. A pointer to the whitelist is
passed as an additional argument to handle_connect().

The documentation is updated to reflect this change.

9 years agoaft: Store resolved paths when adding files.
Andre Noll [Wed, 24 Dec 2014 03:07:48 +0000 (03:07 +0000)]
aft: Store resolved paths when adding files.

Currently the add command performs some sanity checks on the given
paths, but stores them unmodified in the audio file table if they
pass the checks. This commit removes the checks in favor of a call to
realpath(3) to get the canonicalized absolute pathname to be stored
in the audio file table.

The new code relies on POSIX.1-2008 semantics. That is, it calls
realpath() with second argument NULL to let the function allocate a
suitably sized buffer. This should not be a problem, since the old
POSIX.1-2001 version is broken by design, and all moderately recent
systems support the new semantics.

This change breaks t0004 which expects the ls -p command to print
the same paths that were used earlier to add audio files, which is
no longer true. We fix the test by simply running ls without the
-p option.

9 years agoaft: Update mtime and file size on afhi changes.
Andre Noll [Tue, 23 Dec 2014 12:52:03 +0000 (12:52 +0000)]
aft: Update mtime and file size on afhi changes.

If the current audio file is re-added to the osl database, for example
because meta tags have changed, file size and modification time change.
However, the paraslash stat command still shows the old values because
currently the virtual streaming system calls fstat(2) only once when
the audio file is opened and keeps reporting the resulting mtime and
file size values until the file is closed.

This commit introduces make_inode_status_items() which is called
from make_status_items() on AFSI_CHANGE and AFHI_CHANGE events for
the current audio file. The new function calls stat(2) on the path
obtained from the current aft row. We can't use fstat(2) since (a)
we don't have an open file descriptor any more and (b) this would
not work anyway if the original file was overwritten.

Due to the new helper, mmd->mtime can be removed. We must keep
mmd->size though, since we need the original file size for the call
to munmap().

9 years agoaft: Update status items on afs events.
Andre Noll [Mon, 22 Dec 2014 18:05:38 +0000 (18:05 +0000)]
aft: Update status items on afs events.

When a paraslash command changes the afs or afh info structures of the
current audio file, for example by re-adding the file with modified
meta tags, the stat output still reports the old values. With this
patch applied, the status items are updated immediately.

This is achieved by letting aft.c honor the AFSI_CHANGE and AFHI_CHANGE
events. If the audio file which triggered the event is the one
currently being streamed, the event handler recreates the status items.
We need two new global static variables in aft.c to track the row of
the audio file table which corresponds to the current file.

9 years agoaft.c: Pass struct ls_data pointer to make_status_items().
Andre Noll [Sun, 21 Dec 2014 18:07:40 +0000 (18:07 +0000)]
aft.c: Pass struct ls_data pointer to make_status_items().

We essentially already do that, with each field of the structure
spelled out in the argument list of make_status_items().

9 years agoafs: Simplify open_next_audio_file().
Andre Noll [Sun, 21 Dec 2014 15:24:18 +0000 (15:24 +0000)]
afs: Simplify open_next_audio_file().

This function of afs.c is called whenever the virtual streaming
system requests a new audio file. It determines the row of the audio
file table that corresponds to the audio file with highest score,
according to the current mood or playlist. The function passes this
information to open_and_update_audio_file() of aft.c which sets up
an afd structure to be passed back to the server process.

Letting open_and_update_audio_file() determine which file to
open is shorter, and it allows to get rid of two arguments to
open_and_update_audio_file().

9 years agobuild: Convert curses detection to new macros.
Andre Noll [Sun, 28 Sep 2014 15:38:35 +0000 (15:38 +0000)]
build: Convert curses detection to new macros.

9 years agobuild: Convert libreadline detection to new macros.
Andre Noll [Sun, 21 Sep 2014 14:48:01 +0000 (16:48 +0200)]
build: Convert libreadline detection to new macros.

9 years agobuild: Convert oss detection to new macros.
Andre Noll [Mon, 25 Aug 2014 21:50:01 +0000 (23:50 +0200)]
build: Convert oss detection to new macros.

This also adds the missing oss_cppflags autoconf variable and the
corresponding make rule for building the oss writer.

9 years agobuild: Convert libsamplerate detection to new macros.
Andre Noll [Sun, 24 Aug 2014 22:24:29 +0000 (00:24 +0200)]
build: Convert libsamplerate detection to new macros.

9 years agobuild: Convert libao detection to new macros.
Andre Noll [Sun, 24 Aug 2014 22:00:51 +0000 (00:00 +0200)]
build: Convert libao detection to new macros.

Splits the old check into two checks for pthread and libao.

9 years agobuild: Convert alsa detection to new macros.
Andre Noll [Sun, 24 Aug 2014 20:57:29 +0000 (22:57 +0200)]
build: Convert alsa detection to new macros.

Adds alsa_cppflags.

9 years agobuild: Convert flac detection to new macros.
Andre Noll [Wed, 30 Jul 2014 08:11:15 +0000 (10:11 +0200)]
build: Convert flac detection to new macros.

9 years agobuild: Convert libid3tag detection to new macros.
Andre Noll [Tue, 3 Jun 2014 17:42:52 +0000 (19:42 +0200)]
build: Convert libid3tag detection to new macros.

9 years agobuild: Convert mad detection to new macros.
Andre Noll [Tue, 3 Jun 2014 17:03:32 +0000 (19:03 +0200)]
build: Convert mad detection to new macros.

9 years agobuild: Convert faad detection to new macros.
Andre Noll [Sun, 4 May 2014 17:22:22 +0000 (19:22 +0200)]
build: Convert faad detection to new macros.

9 years agobuild: Convert crypto detection/selection to new macros.
Andre Noll [Fri, 2 May 2014 21:01:53 +0000 (23:01 +0200)]
build: Convert crypto detection/selection to new macros.

9 years agobuild: Convert opus detection to new macros.
Andre Noll [Sun, 20 Apr 2014 23:27:19 +0000 (23:27 +0000)]
build: Convert opus detection to new macros.