aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins (unfollow)
Commit message (Collapse)AuthorFilesLines
2008-10-26renamed src/inputPlugins/ to src/decoder/Max Kellermann15-5609/+0
These plugins are not input plugins, they are decoder plugins. No CamelCase in the directory name.
2008-10-25removed internal copy of libmp4ffMax Kellermann1-1/+1
MPD shouldn't integrate sources of other libraries. Since libmp4ff is part of libfaad, we should remove the old copy from src/mp4ff and link with the current version from libfaad instead.
2008-10-23mp3: send 24 bit PCM dataMax Kellermann1-63/+24
libmad produces samples of more than 24 bit. Rounding that down to 16 bits using dithering makes those people lose quality who have a 24 bit capable sound device. Send 24 bit PCM data, and let the receiver decide whether to apply 16 bit dithering.
2008-10-23mp3: use sizeof(sample) instead of hard-coded "2"Max Kellermann1-2/+3
We are going to convert the code to 24 bit; don't hard-code a sample size of 2 bytes.
2008-10-21ffmpeg: don't pass pointer as hexadecimal stringMax Kellermann1-20/+27
Casting a pointer to some sort of integer and formatting it into a string isn't valid. A pointer derived from this hex string won't work reliably. Since ffmpeg doesn't provide a nice API for passing our pointer, we have to think of a different hack: ffmpeg passes the exact URL pointer to mpdurl_open(), and we can make this string part of a struct. This reduces the problem to casting the string back to the struct. This is still a workaround, but this is "sort of portable", unless the ffmpeg people start messing with the URL pointer (which would be valid according to the API definition).
2008-10-21ffmpeg: detect which ffmpeg headers should be includedMax Kellermann1-0/+6
Since ffmpeg svn r12865, you have to include libavcodec/avcodec.h instead of avcodec.h. This cannot be checked at compile time, instead we have to add a check to configure.ac. Viliam's original ffmpeg plugin was based on the newer ffmpeg library, while my Debian installation had the older version. My attempt to correct his include statements wasn't correct after all.
2008-10-18ffmpeg: make internal functions staticMax Kellermann1-22/+12
The mpdurl_* code is internal, don't expose them. Also don't initialize struct members with NULL.
2008-10-17ffmpeg: new decoder pluginViliam Mateicka1-0/+416
[mk: fixed indent, changed copyright statement, added autoconf test, fixed includes paths, fixed 2 gcc warnings, don't close input stream twice]
2008-10-17Makefile.am: don't compile disabled decoder pluginsMax Kellermann14-143/+17
Don't compile the sources of disabled decoder plugins at all, and don't attempt to register these.
2008-10-17input_stream: removed nmemb argumentMax Kellermann1-1/+1
The nmemb argument isn't actually useful, and one of nmemb and size was always passed as 1. Remove it.
2008-10-10mp3: dither an arbitrary number of channelsMax Kellermann1-6/+3
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.
2008-10-10mp3: hard-code dithering to 16 bitsMax Kellermann1-8/+6
The dithering function audio_linear_dither() worked for signed 16 bits only anyway, having a variable "bits" just disables important gcc optimizations.
2008-10-10audio_format: renamed sampleRate to sample_rateMax Kellermann11-52/+51
The last bit of CamelCase in audio_format.h. Additionally, rename a bunch of local variables.
2008-10-08use the "bool" data type instead of "int"Max Kellermann5-18/+18
"bool" should be used in C99 programs for boolean values.
2008-10-08don't include os_compat.hMax Kellermann4-0/+5
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-09-29use C99 struct initializersMax Kellermann10-100/+65
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.
2008-09-29decoder: renamed plugin methodsMax Kellermann1-3/+3
Why have a "_func" prefix on all method names? Also don't typedef the methods, there is no advantage in that.
2008-09-29switch to C99 types, part IIMax Kellermann3-11/+11
Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
2008-09-29Switch to C99 types (retaining compat with old compilers)Eric Wong3-8/+8
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.
2008-09-23flac: removed FlacData.chunk_lengthMax Kellermann2-8/+2
chunk_length can be converted to a local variable, because it is always reset to 0 after it was used.
2008-09-23flac: merged flacSendChunk() into flac_common_write()Max Kellermann1-17/+16
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.
2008-09-23flac: removed generic sample size supportMax Kellermann1-32/+26
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_*().
2008-09-23flac: added special functions for 8 and 32 bitMax Kellermann1-0/+37
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!
2008-09-23flac: added optimized converter for 16 bitMax Kellermann1-0/+17
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().
2008-09-23flac: use signed integers in flac_convert_stereo16()Max Kellermann1-6/+4
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.
2008-09-23flac: moved code from flacWrite() to _flac_common.cMax Kellermann4-129/+97
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.
2008-09-23flac: assume the buffer is empty in flacWrite() IIMax Kellermann1-7/+2
The previous patch on this topic was incomplete: it still added data->chunk_length when calling flac_convert(). Remove this, too.
2008-09-23audio_format: added audio_format_sample_size()Max Kellermann2-3/+4
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.
2008-09-23start using prefixcmp()Eric Wong1-1/+1
LOC reduction and less noise makes things easier for tired old folks to follow.
2008-09-23mp3: fix long line, I can't read past 80 colsEric Wong1-1/+2
2008-09-17mp3: fix buffer overflow when max_frames is too largeMax Kellermann1-0/+5
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.
2008-09-12mp4: fix potential integer overflow bug in the mp4_decode() functionTerry1-0/+7
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.
2008-09-07audio_format: converted typedef AudioFormat to struct audio_formatMax Kellermann9-11/+11
Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
2008-09-07fix -Wcast-qual -Wwrite-strings warningsMax Kellermann2-8/+21
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.
2008-08-29oggflac: fix GCC warningsMax Kellermann1-9/+9
Fix lots of "unused parameter" warnings in the OggFLAC decoder plugin. Not sure if anybody uses it anymore, since newer libflac obsoletes it.
2008-08-29tag: fix the shout and oggflac pluginsMax Kellermann1-2/+4
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.
2008-08-29wavpack: tag_new() cannot failMax Kellermann1-5/+0
Since tag_new() uses xmalloc(), it cannot fail - if we're really out of memory, the process will abort.
2008-08-29tag: renamed functions, no CamelCaseMax Kellermann10-58/+57
2008-08-29tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_itemMax Kellermann11-43/+43
Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
2008-08-26moved global variable "ob" to outputBuffer.hMax Kellermann2-0/+6
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.
2008-08-26flac: decoder command means EOFMax Kellermann2-11/+9
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.
2008-08-26mp3, flac: check for seek command after decoder_read()Max Kellermann2-4/+16
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.
2008-08-26check decoder_command!=NONE instead of decoder_command==STOPMax Kellermann5-13/+14
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.
2008-08-26mp3: converted the MUTEFRAME_ macros to an enumMax Kellermann1-9/+12
Also introduce MUTEFRAME_NONE; previously, the code used "0".
2008-08-26mp3: converted the DECODE_ constants to an enumMax Kellermann1-8/+13
2008-08-26wavpack: don't use "isp" before initializationMax Kellermann1-4/+1
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).
2008-08-26wavpack: moved code to wavpack_open_wvc()Max Kellermann1-79/+66
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().
2008-08-26simplified code in the ogg decoder pluginMax Kellermann1-25/+25
Return early when the player thread sent us a command. This saves one level of indentation.
2008-08-26added decoder_read()Max Kellermann8-66/+17
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.
2008-08-26wavpack: added InputStreamPlus.decoderMax Kellermann1-4/+7
The "decoder" object reference will be used by another patch.