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 }'
ogg: Abstract out custom header code. The ogg/vorbis audio format handler employs the callback mechanism of oac_get_file_info() to replace the metadata packet of an ogg/vorbis stream by a fixed sized dummy packet. The same approach should also be used for the ogg/opus audio format handler because ogg/opus metadata can be arbitrary large too. As a preparation for modifying the ogg/opus audio format handler to skip the metadata header in this way, this commit makes the infrastructure available to all audio format handlers which employ the ogg container format by providing a public interface in ogg_afh_common.c. The central data structure is struct oac_custom_header, which replaces the former vorbis_get_header_data structure. The layout of the new structure is only known to ogg_afh_common.c. Users of this API need to call the accessor functions declared in ogg_afh_common.h. Only the ogg/vorbis audio format handler is converted to the new API. A subsequent patch will make the ogg/opus audio format handler the second user.
Prefix public functions of ogg_afh_common.c with "oac". This way it is clear that these are not functions provided by libogg. Pure rename. no real changes.
afh: Unify name of init functions. The init functions of the mp3 and ogg audio format handlers lacked the _afh part in the name which all other audio format handlers have.
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 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().
ogg_afh: Add a comment about the three vorbis header packets. With this information at hand, it's easier to understand how the vorbis packet callback works.
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.
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
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.
ogg_afh: Kill dead store. ogg_afh.c:108:3: warning: Value stored to 'ret' is never read ret = -E_OGG_PACKET_IN; ^ ~~~~~~~~~~~~~~~~
Move statements after declarations. This gets rid of gcc warnings of the form warning: ISO C90 forbids mixed declarations and code when compiled with -Wdeclaration-after-statement.
vorbis: Write out _all_ pending ogg pages. ogg_stream_flush() does not necessarily write out all pending ogg packets into a single ogg page. So we have to call this function in a loop until it returns zero to make sure we have a complete ogg/vorbis header. This fixes a bug in the vorbis dummy header patch set which caused corrupt replacement headers for ogg files whose header spanned more than one ogg page.
Revert "Create three ogg pages when skipping vorbis comments." This reverts commit 3569c4ac0d5b35318e741b0123bc707473261ad9 since it did not fix the problem at all. A proper fix is provided in the next commit.
Create three ogg pages when skipping vorbis comments. This works around a shortcoming in older versions of libogg. It makes get_header() create a separate ogg page for each of the three header packets in an ogg/vorbis stream instead of combining packets #2 and #3. The patch also adds a couple of debug log messages which print the size of the individual ogg packets and ogg pages.
Introduce get_header() for ogg/vorbis. Define the get_header() method for the ogg vorbis audio format handler which replaces ogg packet #2 by a dummy packet which contains no meta data. We call ogg_get_file_info() with afhi == NULL which only passes the first three ogg packets to the given callback but does not compute the chunk table. Ogg packet #1 and #3 are copied unmodified into the header.