Commit Graph

3032 Commits

Author SHA1 Message Date
Max Kellermann 9eed41911f decoder: return void from decode() methods
The stream_decode() and file_decode() methods returned a boolean,
indicating whether they were able to decode the song.  This is
redundant, since we already know that: if decoder_initialized() has
been called (and dc.state==DECODE), the plugin succeeded.  Change both
methods to return void.
2008-11-11 17:13:44 +01:00
Max Kellermann 05e69ac086 replay_gain: don't include os_compat.h
os_compat.h is deprecated and should be replaced with well-defined
standard headers.
2008-11-11 16:38:33 +01:00
Max Kellermann bc1999f815 replay_gain: use GLib instead of utils.h/log.h
Eliminated deprecated libraries.
2008-11-11 16:38:26 +01:00
Max Kellermann 8a40e0b495 replay_gain: use pcm_volume() to apply replay gain
The currently replay_gain_apply() implementation duplicates code from
pcm_volume(), except that it uses a floating point scale.  Eliminate
all duplicated code from and make it utilize the pcm_volume() library
function.  This introduces replay gain support for 24 bit audio.
2008-11-11 16:38:12 +01:00
Max Kellermann cb28487d10 pcm_utils: allow volume levels greater than 100% in pcm_volume()
Allow pcm_volume() to increase volume.
2008-11-11 16:38:10 +01:00
Max Kellermann edcd45df94 pcm_volume: added constant PCM_VOLUME_1
It may be desirable to change the range of integer volume levels
(e.g. to 1024, which may utilize shifts instead of expensive integer
divisions).  Introduce the constant PCM_VOLUME_1 which describes the
integer value for "100% volume".  This is currently 1000.
2008-11-11 16:32:32 +01:00
Max Kellermann ad77a3e0ac pcm_utils: added inline function pcm_float_to_volume() 2008-11-11 16:29:02 +01:00
Max Kellermann 5ddde0aac7 replay_gain: converted struct replay_gain_info elements to an array
Having an array instead of individual variables allows the use of the
replay_gain_mode enum as an array index.
2008-11-11 16:24:27 +01:00
Max Kellermann 5e686add91 wavpack: added wavpack_tag_float()
The function simplifies wavpack_replaygain(), because it already
contains the float parser, and it works with a fixed buffer instead of
doing expensive heap allocations.
2008-11-11 16:21:09 +01:00
Max Kellermann c883d761ab wavpack: make the "key" argument to wavpack_tag() const
This allows us to remove the "static char[]" hack.
2008-11-11 16:19:29 +01:00
Max Kellermann e2c07dbbbc ogg: ogg_getReplayGainInfo() returns replay_gain_info pointer
Some code simplification.  Avoid pointers to pointers.
2008-11-11 16:19:00 +01:00
Max Kellermann 837cefdb04 replay_gain: converted replay_gain_mode to an enum
Prefer C enums over CPP macros.
2008-11-11 16:18:31 +01:00
Max Kellermann e9c3497cd2 replay_gain: removed superfluous author name comment
The author's name is already mentioned in the copyright declaration.
2008-11-11 15:55:34 +01:00
Max Kellermann 114b3c1e78 replay_gain: no CamelCase
Renamed functions and variables.
2008-11-11 15:55:34 +01:00
Max Kellermann 54ad08ab37 replay_gain: renamed sources to replay_gain.c, replay_gain.h
No CamelCase file names.
2008-11-11 15:55:34 +01:00
Max Kellermann 130659e856 decoder: fixed assertion failure for decoder==NULL in decoder_read()
The assertion on dc.state in decoder_read() was too strict: when a
decoder tried to call decoder_read() from tag_dup(), the decoder state
was NONE.  Allow this special case.
2008-11-11 15:55:28 +01:00
Max Kellermann ff1acefb21 decoder: removed plugin method try_decode()
Instead of having a seprate try_decode() method, let the
stream_decode() and file_decode() methods decide whether they are able
to decode the song.
2008-11-10 15:07:01 +01:00
Max Kellermann 10eea9d981 decoder: fall back to next plugin
When a plugin is unable to decode a song, try the other plugins.
2008-11-10 15:02:47 +01:00
Max Kellermann cad37b2e5a decoder: wrapper functions for methods stream_decode() and file_decode()
Added lots of assertions to the wrapper functions.
2008-11-10 15:02:38 +01:00
Max Kellermann 84b540f435 decoder: added more assertions
Added a lot of assertions checking the state of the decoder plugin.
2008-11-10 15:02:26 +01:00
Max Kellermann 23a4ce4444 flac: call flac_process_metadata() for ogg files
The flac plugin wasn't initialized properly when an OGG file was being
decoded.  For some reason, flac_process_metadata() was explicitly not
called for OGG files.  Since that seems to fix the issue, make it
always call flac_process_metadata().
2008-11-10 14:49:34 +01:00
Max Kellermann 0e87f85598 flac: enable the oggflac plugin with older libflac versions
Since decoder_list.c does not include the libflac headers, it cannot
know whether to add the oggflac plugin to the decoder list.  Solve
this by always enabling the oggflac sub-plugin, even with older
libflac versions.  When the libflac API cannot support oggflac,
disable the plugin at runtime by returning "false" from its init()
method.
2008-11-10 14:39:42 +01:00
Max Kellermann 505959f74d flac: enable oggflac with libflac
The "oggflac" plugin was enabled only if HAVE_FLAC_COMMON was
defined.  HAVE_FLAC_COMMON however is only an automake variable, and
is never available in decoder_list.c.  Make decoder_list.c depend on
HAVE_FLAC||HAVE_OGGFLAC instead.
2008-11-10 14:37:37 +01:00
Daniel Schömer 1256f90825 log: properly check log_threshold 2008-11-09 22:27:58 +01:00
Max Kellermann c9c7dc6e00 decoder: updated API documentation
Updated documentation on the stream_decode() and file_decode() return
values.
2008-11-09 22:10:48 +01:00
Max Kellermann ab24e203cd wavpack: removed try_decode() method
Wavpack's try_decode() implementation does nothing useful, it only
duplicates code already in stream_decode() / file_decode(), and slows
down MPD.
2008-11-09 22:10:48 +01:00
Max Kellermann b054ad0ea6 flac: make the init() method check for oggflac support
Disable flac's "oggflac" sub-plugin when libflac does not support
ogg-flac files.
2008-11-09 22:01:47 +01:00
Max Kellermann 72eba30cf4 decoder: converted dc.error to a dc.state value
The player did not care about the exact error value, it only checked
whether an error has occured.  This could fit well into
decoder_control.state - introduce a new state "DECODE_STATE_ERROR".
2008-11-08 15:48:00 +01:00
Max Kellermann 8cbdc2667e decoder: removed "plugin" from the decoder struct
decoder.plugin was a write-only attribute.
2008-11-08 13:33:44 +01:00
Laszlo Ashin 343a8a20e3 wavpack: make 24-bit samples available for mpd
This patch makes 24-bit samples available for mpd. I tested with the
WavPack Test Suite found on wavpack.com:

 http://www.rarewares.org/wavpack/test_suite.zip

Every test file worked fine.
2008-11-08 13:11:10 +01:00
Laszlo Ashin 3e338da871 wavpack: check last_byte in push_back_byte() method
At this moment the wavpack lib doesn't use the return value of the
push_back function, which has an equivalent meaning of the return
value of ungetc().  This is a lucky situation, because so far it
simply returned with 1 as a hard coded value.  From now on the
function will return EOF on error.  (This function makes exactly one
byte pushable back.)
2008-11-08 13:10:15 +01:00
Laszlo Ashin cfd55b29bd wavpack: wrapper for converting void* to struct wavpack_input*
A new function has been added to do a cast and a little check in the
wavpack-mpd input stream wrapper.
2008-11-08 13:09:07 +01:00
Laszlo Ashin 2b4a410bb0 wavpack: put braces around one line code blocks
I think this makes the code more easily modifiable and prevents some
annoying mistakes.
2008-11-08 13:08:21 +01:00
Laszlo Ashin d68df99ef4 wavpack: added prefix to local function names
There are some functions in the wavpack-mpd input streams wrapper
which had too commonly used names (especially can_seek). I prefixed
these with "wavpack_input_".
2008-11-08 13:07:40 +01:00
Laszlo Ashin ff2e69c003 wavpack: unified code style
Not every function header has its return type in a distinct line. This
patch corrects that.  This way there is more space for the arguments.
2008-11-08 13:07:09 +01:00
Max Kellermann 343f2ac3fc configure.ac: enable _ogg_common.c when flac is enabled
The build failed when the oggvorbis and oggflac decoders were
disabled, because the flac decoder references a symbol from
_ogg_common.c.
2008-11-07 17:21:21 +01:00
Max Kellermann 2172505f5c configure.ac: added AC_CONFIG_SRCDIR 2008-11-07 17:14:52 +01:00
Tom Servo ea92576219 listen: fix namespace collision on OpenSolaris
The listen.c module breaks the build because the variable name used
("sun") for the Unix domain socket part collides with something else
on an OpenSolaris system, likely Sun specific.  Renaming it to _sun
(or something else of choice) fixes the build.

[mk: renamed to "s_un"]
2008-11-07 10:33:48 +01:00
Laszlo Ashin 2e0ba90208 wavpack: check wvc seekability
Using wvc streams the seekableness depends on the seekability of the
wvc stream as well.
2008-11-06 06:48:33 +01:00
Laszlo Ashin 56d2b51056 wavpack: close wvc stream on error
The input stream opened for wvc is not closed in an if branch.  A
close call has been added.
2008-11-06 06:48:33 +01:00
Laszlo Ashin 089c9b7e5c wavpack: enable seeking
Somehow seeking is disabled on all kinds of wavpack playbacks now in
the git version.  This patch corrects that.
2008-11-06 06:48:33 +01:00
Max Kellermann dcfb205c46 input_curl: retrieve error message from ERRORBUFFER
libcurl provides better error messages than curl_multi_strerror() when
you set the ERRORBUFFER option.
2008-11-06 06:48:30 +01:00
Max Kellermann e2d7318a18 input_curl: return 0 on error from read()
The read() method must not return a negative value.  Make it return 0
on error, just like the file input stream.  Also set the "error"
attribute to -1.
2008-11-06 06:44:19 +01:00
Max Kellermann a8e81326d0 input_curl: enable FAILONERROR
I had this option enabled during development, but at some point, it
must have gotten lost.  FAILONERROR makes the curl stream fail when
the server returns a status code 400 or higher.  We are not interested
in the server's error document.
2008-11-06 06:36:25 +01:00
Max Kellermann 91c1a279e4 MPD version 0.14~alpha1
First alpha version for the upcoming version 0.14.
2008-11-05 21:50:53 +01:00
Max Kellermann 19d3345ab8 path: removed superfluous error check in path_set_fs_charset()
The code which had a possible error condition had been removed.
2008-11-05 21:42:55 +01:00
Max Kellermann 5b2e981253 log: check if log_charset is set
When logging to a file, log_charset would be NULL and g_convert()
would abort.
2008-11-05 21:40:08 +01:00
Max Kellermann fce8fa0b31 NEWS: updated 0.14 changelog
Adding some of the most important changes since 0.13.
2008-11-05 21:30:05 +01:00
Max Kellermann 2916ef84e4 NEWS: reformatted 0.14 items
Trying to bring a little bit of structure into that list.
2008-11-05 21:29:25 +01:00
Max Kellermann 551aa767ae README: added version number to GPL
MPD is licensed under the version 2 of the GNU General Public License
version 2.  Also added "General".
2008-11-05 21:29:04 +01:00