- 10 Oct, 2008 3 commits
-
-
Max Kellermann authored
The mp3 plugin did not use the MAD_NCHANNELS() value correctly: when a stream was not stereo, it was assumed to be mono, although the correct number was passed to MPD. libmad doesn't support more than 2 channels, but this change allows gcc to optimize its inlining strategy.
-
Max Kellermann authored
The dithering function audio_linear_dither() worked for signed 16 bits only anyway, having a variable "bits" just disables important gcc optimizations.
-
Max Kellermann authored
The last bit of CamelCase in audio_format.h. Additionally, rename a bunch of local variables.
-
- 08 Oct, 2008 2 commits
-
-
Max Kellermann authored
"bool" should be used in C99 programs for boolean values.
-
Max Kellermann authored
When there are standardized headers, use these instead of the bloated os_compat.h.
-
- 29 Sep, 2008 4 commits
-
-
Max Kellermann authored
The old struct initializers are error prone and don't allow moving elements around. Since we are going to overhaul some of the APIs soon, it's easier to have all implementations use C99 initializers.
-
Max Kellermann authored
Why have a "_func" prefix on all method names? Also don't typedef the methods, there is no advantage in that.
-
Max Kellermann authored
Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
-
Eric Wong authored
Seeing the "mpd_" prefix _everywhere_ is mind-numbing as the mind needs to retrain itself to skip over the first 4 tokens of a type to get to its meaning. So avoid having extra characters on my terminal to make it easier to follow code at 2:30 am in the morning. Please report any new issues you may come across on Free toolchains. I realize how difficult it can be to build/maintain cross-compiling toolchains and I have no intention of forcing people to upgrade their toolchains to build mpd. Tested with gcc 2.95.4 and and gcc 4.3.1 on x86-32.
-
- 23 Sep, 2008 11 commits
-
-
Max Kellermann authored
chunk_length can be converted to a local variable, because it is always reset to 0 after it was used.
-
Max Kellermann authored
Since flacSendChunk() is a trivial function and is only used in one location, move the code there. The advantage is that calling decoder_data() directly returns the decoder_command value, so we can eliminate one decoder_get_command() call.
-
Max Kellermann authored
Support for bit rates except 16 bits (and 8 bits on little endian) has always been broken. Since we added optimized functions for 8, 16, 24/32 bits, we can remove the generic flac_convert() function. Instead of removing it, convert it to a wrapper function for flac_convert_*().
-
Max Kellermann authored
Same optimization for 8 and 32 bit files, like the previous patch for 16 bit. Along the way, this patch adds 24 bit FLAC support!
-
Max Kellermann authored
flac_convert_16() runs a lot faster than the generic (and quite buggy) function flac_convert(). flac_convert_16() is only used for non-stereo files, since there is already flac_convert_stereo16().
-
Max Kellermann authored
By mistake, I casted the sample value to uint16_t, which is wrong. This patch simplifies the code by using a int16_t pointer instead of casting to int16_t* every time.
-
Max Kellermann authored
There is still a lot of duplicated code in flac_plugin.c and oggflac_plugin.c. Move code from flac_plugin.c to _flac_common.c, and use the new function flac_common_write() also in oggflac_plugin.c, porting lots of optimizations over to it.
-
Max Kellermann authored
The previous patch on this topic was incomplete: it still added data->chunk_length when calling flac_convert(). Remove this, too.
-
Max Kellermann authored
The inline function audio_format_sample_size() calculates how many bytes each sample consumes. This function already takes into account that 24 bit samples are 4 bytes long, not 3.
-
Eric Wong authored
LOC reduction and less noise makes things easier for tired old folks to follow.
-
Eric Wong authored
-
- 17 Sep, 2008 1 commit
-
-
Max Kellermann authored
The function decodeFirstFrame() allocates memory based on data from the mp3 header. This can make the buffer size allocation overflow, or lead to a DoS attack with a very large buffer. Cap this buffer at 8 million frames, which should really be enough for reasonable files.
-
- 12 Sep, 2008 1 commit
-
-
Terry authored
A crafted mp4 file could cause an integer overflow in mp4_decode function in src/inputPlugins/mp4_plugin.c. mp4ff_num_samples() function returns some tainted value. sizeof(float) * numSamples is an integer overflow operation if numSamples is too huge, so xmalloc will allocate a small memory region. I constructe a mp4 file, and use faad2 to open the file. mp4ff_num_samples() returns -1. So I think mpd bears from the same problem.
-
- 07 Sep, 2008 2 commits
-
-
Max Kellermann authored
Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
-
Max Kellermann authored
The previous patch enabled these warnings. In Eric's branch, they were worked around with a generic deconst_ptr() function. There are several places where we can add "const" to pointers, and in others, libraries want non-const strings. In the latter, convert string literals to "static char[]" variables - this takes the same space, and seems safer than deconsting a string literal.
-
- 29 Aug, 2008 5 commits
-
-
Max Kellermann authored
Fix lots of "unused parameter" warnings in the OggFLAC decoder plugin. Not sure if anybody uses it anymore, since newer libflac obsoletes it.
-
Max Kellermann authored
During the tag library refactoring, the shout plugin was disabled, and I forgot about adapting it to the new API. Apply the same fixes to the oggflac decoder plugin.
-
Max Kellermann authored
Since tag_new() uses xmalloc(), it cannot fail - if we're really out of memory, the process will abort.
-
Max Kellermann authored
-
Max Kellermann authored
Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
-
- 26 Aug, 2008 11 commits
-
-
Max Kellermann authored
This releases several include file dependencies. As a side effect, "CHUNK_SIZE" isn't defined by decoder_api.h anymore, so we have to define it directly in the plugins which need it. It just isn't worth it to add it to the decoder plugin API.
-
Max Kellermann authored
It was possible for the decoder thread to go into an endless loop (flac and oggflac decoders): when a "STOP" command arrived, the Read() callback would return 0, but the EOF() callback returned false. Fix: when decoder_get_command()!=NONE, return EOF==true.
-
Max Kellermann authored
When we introduced decoder_read(), we added code which aborts the read operation when a decoder command arrives. Several plugins however did not expect that when they were converted to decoder_read(). Add proper checks to the mp3 and flac decoder plugins.
-
Max Kellermann authored
The code said "decoder_command==STOP" because that was a conversion from the old "dc->stop" test. As we can now check for all commands in one test, we can simply rewrite that to decoder_command!=NONE.
-
Max Kellermann authored
Also introduce MUTEFRAME_NONE; previously, the code used "0".
-
Max Kellermann authored
-
Max Kellermann authored
The old code called can_seek() with the uninitialized pointer "isp.is". Has this ever worked? Anyway, initialize "isp" first, then call can_seek(&isp).
-
Max Kellermann authored
Move everything related to finding and initializing the WVC stream to wavpack_open_wvc(). This greatly simplifies its error handling and the function wavpack_streamdecode().
-
Max Kellermann authored
Return early when the player thread sent us a command. This saves one level of indentation.
-
Max Kellermann authored
On our way to stabilize the decoder API, we will one day remove the input stream functions. The most basic function, read() will be provided by decoder_api.h with this patch. It already contains a loop (still with manual polling), error/eof handling and decoder command checks. This kind of code used to be duplicated in all decoder plugins.
-
Max Kellermann authored
The "decoder" object reference will be used by another patch.
-