| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
We are going to convert the code to 24 bit; don't hard-code a sample
size of 2 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
The mpdurl_* code is internal, don't expose them. Also don't
initialize struct members with NULL.
|
|
|
|
|
|
| |
[mk: fixed indent, changed copyright statement, added autoconf test,
fixed includes paths, fixed 2 gcc warnings, don't close input stream
twice]
|
|
|
|
|
| |
Don't compile the sources of disabled decoder plugins at all, and
don't attempt to register these.
|
|
|
|
|
| |
The nmemb argument isn't actually useful, and one of nmemb and size
was always passed as 1. Remove it.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
The dithering function audio_linear_dither() worked for signed 16 bits
only anyway, having a variable "bits" just disables important gcc
optimizations.
|
|
|
|
|
| |
The last bit of CamelCase in audio_format.h. Additionally, rename a
bunch of local variables.
|
|
|
|
| |
"bool" should be used in C99 programs for boolean values.
|
|
|
|
|
| |
When there are standardized headers, use these instead of the bloated
os_compat.h.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Why have a "_func" prefix on all method names? Also don't typedef the
methods, there is no advantage in that.
|
|
|
|
|
| |
Do full C99 integer type conversion in all modules which were not
touched by Eric's merged patch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
chunk_length can be converted to a local variable, because it is
always reset to 0 after it was used.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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_*().
|
|
|
|
|
| |
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!
|
|
|
|
|
|
| |
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().
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
The previous patch on this topic was incomplete: it still added
data->chunk_length when calling flac_convert(). Remove this, too.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
LOC reduction and less noise makes things easier for
tired old folks to follow.
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Get rid of CamelCase, and don't use a typedef, so we can
forward-declare it, and unclutter the include dependencies.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Fix lots of "unused parameter" warnings in the OggFLAC decoder
plugin. Not sure if anybody uses it anymore, since newer libflac
obsoletes it.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Since tag_new() uses xmalloc(), it cannot fail - if we're really out
of memory, the process will abort.
|
| |
|
|
|
|
|
| |
Getting rid of CamelCase; not having typedefs also allows us to
forward-declare the structures.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Also introduce MUTEFRAME_NONE; previously, the code used "0".
|
| |
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
| |
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().
|
|
|
|
|
| |
Return early when the player thread sent us a command. This saves one
level of indentation.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
The "decoder" object reference will be used by another patch.
|
|
|
|
|
|
|
|
|
| |
If the input stream is not seekable, the try_decode() function
consumes valuable data, which is not available to the decode()
function anymore. This means that the decode() function does not
parse the header correctly. Better skip the detection if we cannot
seek. Or implement better buffering, something like unread() or
buffered rewind().
|