string: Introduce arr_realloc() and check for integer overflow. Use __builtin_mul_overflow() for the check. This builtin was introduced in gcc-5, so we need to bump the lowest supported version. Re-implement para_realloc() as a trivial wrapper for arr_realloc() to simplify and to avoid duplicating the size check.
string: Rename para_calloc() -> zalloc(). Reword the documentation a bit since the function has never been a wrapper for calloc(3). No code changes.
afh: Constify definition of audio format handlers. The audio_format_handler structure contains only pointers, and the ->init method of each instance initializes these pointers to constant values. The ->init() method is thus useless at best, and it prevents the structures from being declared constant. This patch removes ->init() of struct audio_format_handler and the public afh_init() which iterates over all audio formats to call each ->init() method. The audio format handlers are modified to define an instance of the structure rather than an init function which fills the fields of the given structure. The structure can be declared constant, but not static because afh_common.c needs a way to refer to it. We rely on weak symbols to deal with audio format handlers which are not compiled in. The codec-independent code in afh_common.c defines a weak instance of the audio_format_handler structure for each audio format. The command handlers which are compiled in override the weak symbol with their own definition. The afh receiver used to define afh_init() as its (receiver!) init function, which no longer exists. Since receiver init functions are optional, we don't need to supply a replacement. However, play.c calls ->init() of the afh_receiver unconditionally. This call needs to be removed to avoid a null pointer dereference.
Shorten copyright notice. The GPLv2 line does not add any additional information, so drop it. This leaves a single line of legalese text for most files, which is about the amount of screen real estate it deserves. This patch was created with the following script (plus some manual fixups): awk '{ if (NR <= 5) { gs = gensub(/.*Copyright.* ([0-9]+).*Andre Noll.*/, "\\1", "g") if (gs != $0) year = gs next } if (NR == 6 && year != "") printf("/* Copyright (C) %s Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */\n", year) print }'
server: Store max chunk size in database. This number is needed up-front for the initialization of the fec data structures. Currently we recompute it from the chunk table each time the file is opened for streaming. We can only get rid of the chunk table concept if we tell the VSS by other means how to obtain this information. Fortunately there is an unused 4-byte field in the on-disk afhi structure, which is always zero at the moment. This patch starts to use this field to store the maximal chunk size. For backwards compatibility, when the afhi structure is loaded from disk at stream time, we check if the field is zero and recompute the max chunk size as before in this case. Although the maximal chunk size is generally only needed on the server side, for consistence we expose it though a new status item along with chunk_tv and friends.
Fix signedness issues in format strings. Compiling with -Wformat-signedness (not enabled so far) causes many warnings because of format strings which specify an unsigned type but correspond to an argument of signed type, or vice versa. This commit fixes all these mismatches. For "%u", "%d", "%lu", "%ld" we let the format string match the type of the argument, but for "%x" we need to cast the argument to a suitable unsigned type. After this patch the tree compiles cleanly with -Wformat-signedness given. The warning will be enabled in a subsequent commit.
afh: Make ->suffixes array const. Not only the individual strings are constant, but also the array itself.
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.
Update year in copyright headers. Done with files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2014\)* Andre Noll') sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2014 Andre Noll/Copyright (C) \1 Andre Noll/1' $files In previous years we ran a similar script to set the second year in the range to the current year. This is kind of silly, so let's get rid of this useless information. This commit replaces "Copyright (C) A-B" by "Copyright (C) A" in all file headers, i.e. only the first year (A) is left in. Accurate information including time stamps for each change can be obtained from the git history.
Assorted typo fixes in comments. Quite a few..
doc: Change email address to maan@tuebingen.mpg.de The mail server on systemlinux.org was down for more than a week lately, so let's use an alternative official address. This commit changes all maan@systemlinux.org addresses to maan@tuebingen.mpg.de. Most .c and .h files contain the email address in the copyright header, so they must all be patched. Three other files contain the address for a different reason: * README lists email and git, gitweb and home page URLs * configure.ac needs it for configure -h * version.c contains it for the -V option of all commands
flac afh: Fix off-by-one bug in meta_eof_cb(). After the full file has been read, the file position equals the number of available bytes. The eof callback did not report EOF in this case.
Change copyright year to 2014. This year, we're really on time. The changes in this patch were created by the following silly script: files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2013\)* Andre Noll') sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2013 Andre Noll/Copyright (C) \1-2014 Andre Noll/1' $files sed --in-place= -e 's/Copyright (C) 2013 Andre Noll/Copyright (C) 2013-2014 Andre Noll/1' $files
Change copyright year to 2013. Better late than never.
Change year in copyright message to 2012.
Always include stdbool.h. This adds the #include statement for stdbool.h to para.h. This allows to get rid of the individual includes in *.c. More importantly, since all *.c files include para.h, booleans will now be available everywhere so that we won't need to touch dozens of files anymore whenever a boolean is added to a public structure.
Implement the flac audio format handler. This adds another audio format to para_server and para_afh. Since meta data tags flac are essentially vorbis comments, they are fully supported. However, the audio format handler accepts only flac files with fixed block size, and ogg/flac is not supported either at this point.
Initial support for FLAC (the free lossless audio codec). This adds tests for flac headers and libraries to configure.ac and adds configure options to override the default location of these files. Moreover, a (non-working) implementation of the flac audio format handler and the flac decoder are introduced. All new functions are defined as empty dummies to be filled with content in subsequent commits.