summaryrefslogtreecommitdiff
path: root/mp3dec_filter.c (follow)
Commit message (Collapse)AuthorAge
* mp3dec: Replace MAD_TO_SHORT() by a function.Andre Noll2026-04-11
| | | | | | | The function is a bit longer than the macro, but it is also much easier to read and clearly conveys the types being converted. The mad_fixed_t type is the right choice for the input parameter because synth.pcm.samples is a two-dimensional array of mad_fixed_t.
* Merge topic branch t/spdx into masterAndre Noll2026-03-26
|\ | | | | | | | | | | | | | | | | | | | | Switch to SPDX licence identifiers A single patch which replaces the first comment line of most .c and .h files containing the copyright notice by standardized SPDX (Software/System Package Data Exchange) nomenclature. * t/spdx: Switch to SPDX identifiers.
| * Switch to SPDX identifiers.Andre Noll2026-03-17
| | | | | | | | | | | | | | | | Generated with sed -i 's|Copyright.*Andre Noll.*|SPDX-License-Identifier: GPL-2.0 */|g' *.c *.h followed by manually tweaking the result a bit. No license change intended.
* | Drop mp3dec_ prefix from static mp3dec_consume().Andre Noll2026-03-22
| | | | | | | | | | Only filter methods, i.e. the entry points into this compilation unit, should get the prefix.
* | Improve documentation of the mp3dec filter.Andre Noll2026-03-22
|/ | | | A bit of dedox and a sentence about the constant mp3dec filter structure.
* doxygen: Hide user_data variables.Andre Noll2025-10-08
| | | | | These just clutter the generated documentation, particularly the list of global variables.
* Include regex.h from para.h.Andre Noll2025-05-19
| | | | Every .c file includes it anyway.
* Constify buffer tree API.Andre Noll2024-05-08
| | | | | | A lot of functions of the buffer tree API don't modify the memory referenced by the pointers passed. This patch marks these pointer arguments as constant.
* Speed up mp3dec filter.Andre Noll2024-05-08
| | | | | | | | | Avoid calling btr_get_input_queue_size() as this is potentially expensive (depending on the number of chunks in the input queue) and unnecessary. The user time of para_play for a ~4m long mp3 file on a very slow machine went down from 168s to 150s. Speedup: 11%
* Consolidate EOF error codes.Andre Noll2023-03-11
| | | | | | Currently we have ~15 error codes which indicate an EOF condition. One should suffice, so drop all codes except the generic E_EOF and use that everywhere.
* Merge topic branch t/overflow into masterAndre Noll2022-10-03
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This series implements a new memory allocation API which checks for overflows. The first part of the series just renames the main allocation functions. Later patches in the series implement allocators which take two size_t arguments (like calloc(3)) and check whether the multiplication overflows by employing the __builtin_mul_overflow() primitive supported by gcc and clang. This requires us to bump the lowest supported gcc and clang version. * refs/heads/t/overflow: build: Compile with -ftrapv. string: Introduce arr_zalloc(). string: Introduce arr_alloc(). string: Introduce arr_realloc() and check for integer overflow. string: Rename para_calloc() -> zalloc(). string: Rename para_malloc() -> alloc(). string: Overhaul para_strdup().
| * string: Introduce arr_alloc().Andre Noll2022-07-29
| | | | | | | | | | | | | | | | Change all callers of alloc() which pass a product of two integers as the allocation size to call the new function instead. This function aborts if the multiplication overflows. With arr_alloc() in place, alloc() reduces to a trivial wrapper which calls new arr_alloc() with the first argument equal to one.
| * string: Rename para_calloc() -> zalloc().Andre Noll2022-07-29
| | | | | | | | | | Reword the documentation a bit since the function has never been a wrapper for calloc(3). No code changes.
| * string: Rename para_malloc() -> alloc().Andre Noll2022-07-29
| | | | | | | | | | | | | | Just because it's shorter and matches the naming of the new allocators we are about to introduce. The bulk of this patch was created with sed -i 's/para_malloc/alloc/g' *.c *.h yy/mp.y
* | Rename ->{pre,post}_select methods to ->{pre,post}_monitor.Andre Noll2022-08-25
|/ | | | | | | The word "monitor" is neutral and continues to be correct after the switch from select(2) to poll(2). Pure rename, nothing to see here.
* Shorten copyright notice.Andre Noll2017-09-22
| | | | | | | | | | | | | | | | | | | | | 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 }'
* Convert filters to lopsub.Andre Noll2017-03-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the *_filter.m4 gengetopt files by the filter_cmd lopsub suite, where each filter is realized as a subcommand. Due to this change, para_filter needs to be linked with -llopsub. The filter structure is now stored in the user_data pointer provided by lopsub, allowing to get rid of the global filters[] array, the FILTER_ENUM macro and the corresponding enumeration constants. The removal of the ->goo_help member of struct filter makes this structure constant. Hence ->init() of struct filter can also go away. We still can tell whether a filter is supported by checking the user_data pointer: if it is NULL, the filter is unsupported. The new filter_supported() helper in filter_common.c is provided for convenience. Parsing of the filter command line options is now performed generically, and the ->parse_config() method is renamed to ->setup(), an optional function which is supposed to perform semantic checks and the one-time setup of the filter, if any. It is accompanied by ->teardown() which replaces ->free_config(). The conversion of the individual filters is easy since most filters have a simple syntax or take no arguments at all. The resample_filter, however, needs a different way to copy the wav parameters from the lopsub parse result to the wav parms structure. A suitable macro, LLS_COPY_WAV_PARMS is added to check_wav.h for this purpose. The old COPY_WAV_PARMS needs to stay until para_write, the only other user of the macro, has been converted as well. The section heading of the manual page has changed slightly, causing t0005 to fail. Hence this test needs a slight adjustment.
* Update year in copyright headers.Andre Noll2015-01-12
| | | | | | | | | | | | | | | | 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.deAndre Noll2014-08-18
| | | | | | | | | | | | | | 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
* sched: Directly pass context pointer to pre/post_select().Andre Noll2014-05-25
| | | | | | | | | | | | | | | The patch is large, but it's fairly straight forward: Instead of a task pointer all ->pre_select() and ->post_select() methods now receive the context pointer that was passed to the scheduler when the task was registered. This allows to kill the public task_context(). Two pre_select/post_select functions are not directly called by the scheduler: session_post_select(), generic_recv_pre_select(). These are changed to receive a proper struct rather than a void pointer. Note that generic_filter_pre_select() is not changed in this manner because some filters do not provide a pre_select wrapper but set task->pre_select to generic_filter_pre_select().
* task_register() conversion: filter tasksAndre Noll2014-05-25
|
* Change copyright year to 2014.Andre Noll2014-02-22
| | | | | | | | | 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
* Revamp ggo help.Andre Noll2013-06-13
| | | | | | | | | | | | | This adds usage and description fields to struct ggo_help and changes ggo_print_help() to optionally print these. The boolean detailed_help flag of ggo_print_help() is replaced by a bitmask which lets the caller specify what to print. Four pre-defined masks are used to print the normal help, the detailed help, the help for modules (receivers, filters, writers) and the detailed module help. The new macro DEFINE_GGO_HELP can be employed to create a struct ggo_help from a gengetopt structure.
* sched: Rename new_post_select back to post_select.Andre Noll2013-04-30
|
* sched: Kill old ->post_select variant.Andre Noll2013-04-30
| | | | It has no more users.
* mp3dec: Switch to the alternative post select method.Andre Noll2013-04-30
|
* Change copyright year to 2013.Andre Noll2013-03-25
| | | | Better late than never.
* Cleanup filter command line parsers.Andre Noll2012-10-21
| | | | | | | All these functions call the gengetopt parser which aborts on errors. Hence it is pointless to check the return value of the parser. The patch also renames most of the *args_info structs to "conf".
* Simplify ggo makefile.Andre Noll2012-08-27
| | | | | | | | | | | | | Currently we have three different targets for creating *_cmdline.[ch] files. This is because receivers, filters and writers need slightly different command line options. This patch defines the common options in the ggo makefile and moves additional parameters to the individual .m4 files so that a single target to create *_cmdline.[ch] is now sufficient. The name of the command line parsers of some filters and writers changed due to this unification, so these are updated accordingly.
* Merge branch 't/btr_improvements'Andre Noll2012-07-19
|\ | | | | | | | | | | | | | | 146316 btr_exec_up(): Also ask given node. 6d9c35 btr: Introduce btr_add_output_dont_free(). 4ac313 btr: Remove btr_free_node(). Has been cooking in next for a week.
| * btr: Remove btr_free_node().Andre Noll2012-07-08
| | | | | | | | | | | | | | | | | | This has turned out to be source for bugs. Deallocate everything in btr_remove_node() hence making removing the node and freeing its resources an atomic operation. To avoid dangling pointers to freed btrn nodes, the argument of btr_remove_node() is changed to to struct btr_node **btrnp.
* | mp3dec: Remove dead store.Andre Noll2012-06-13
|/ | | | | | mp3dec_filter.c:133:3: warning: Value stored to 'ret' is never read ret = mad_stream_sync(&pmd->stream); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Change year in copyright message to 2012.Andre Noll2012-01-07
|
* Always include stdbool.h.Andre Noll2011-12-18
| | | | | | | | | 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.
* mp3dec: Avoid possible endless loop.Andre Noll2011-09-09
| | | | | | | | | | | | | If an error occurs during frame decode at the end of an 8K buffer, the code in mp3dec.c might loop forever because we miss to consume the data of all frames that have been decoded so far during this iteration of the scheduler loop. The two callers of used_mad_buffer_bytes() both call btr_consume() next, and this fix requires to call the same two function once more from another location. So it is natural to move the btr_consume() call into used_mad_buffer_bytes() and rename the latter function to mp3dec_consume().
* mp3dec: Fix possible endless loop.Andre Noll2011-08-18
| | | | | | | | | | If the header of the last frame of a (corrupt) mp3 file can be decoded but the rest of the frame can not, the mp3 decoder may end up in a busy loop. Fix this by performing the same check as for errors during header decode. This adds some code duplication but as we are late in the release cycle, let's go for the minimal fix for now.
* mp3dec: Handle decode errors gracefully.Andre Noll2011-08-09
| | | | | | | Currently decoding damaged mp3 files leads to very audible artefacts even if only a single frame is corrupt. This patch instructs the mp3 decoder to synchronize the stream on decode errors and to continue the decode process. Only on fatal errors the input buffer is discarded.
* mp3dec: Kill need_bad_data_delay().Andre Noll2011-08-09
| | | | This added quite some complexity for no real gain.
* mp3dec: Allocate correct output buffer size also for mono files.Andre Noll2011-08-09
| | | | | | | | | Currently the buffer size is chosen to hold 4 bytes per sample even for mono files where 2 bytes per sample suffice. Since the channel count does not change within a frame, use the cached value in pmd->channels rather than the MAD_NCHANNELS macro for each sample.
* Replace 2010 in copyright message by 2011.Andre Noll2011-01-17
|
* Introduce decoder_execute().Andre Noll2010-07-13
| | | | | | | All four decoders support the same two commands: "sample_rate" and "channels". This patch adds a public function to filter_common.c which implements these two commands and is called by all decoders. This allows to kill four copies of code with identical functionality.
* Cosmetics: Rename samplerate to sample_rate.Andre Noll2010-07-13
| | | | | A subsequent patch will introduce sample_format which looks much nicer than sampleformat. So let's use the underscored variant throughout.
* Reduce decoder latency.Andre Noll2010-06-18
| | | | | | | | | | If large/many FEC slices are used, the decoder gets large amounts of data in one chunk. Currently it decodes as much as it can which may take several 100 milliseconds on slow machines -- enough to cause buffer underruns for the alsa writer. This patch teaches the decoders to convert only a small amount of data in one go in order to give the other buffer tree nodes a chance to run.
* Change year in COPYRIGHT to 2010.Andre Noll2010-04-05
| | | | Hey, this is earlier than last year :)
* Don't use ENAVAIL.Andre Noll2010-01-18
| | | | | NetBSD doesn't know it, and the error text does not fit well. So replace it by a paraslash error message.
* mp3dec: Don't check for bad data delay on errors.Andre Noll2010-01-13
|
* filter: Remove allocation of filter buffers.Andre Noll2010-01-12
| | | | fn->buf is not used any more.
* mp3dec: Kill non-btr code.Andre Noll2010-01-12
|
* mp3dec: Improve error message.Andre Noll2010-01-09
|
* Switch audiod over to the buffer tree API.Andre Noll2010-01-07
| | | | Still a bit rough and there are too many btr merges.