Commit Graph

3393 Commits

Author SHA1 Message Date
Max Kellermann
97080b796c ogg: removed stray "}"
Due to an unnoticed merge error, there was a superfluous "}".  Remove
it.
2008-11-11 21:39:31 +01:00
Max Kellermann
53c17db5e9 ogg: use ogg_fopen() instead of ogg_open()
Move the reponsibility for freeing the file handle to libvorbis.
2008-11-11 21:33:10 +01:00
Max Kellermann
448ff32c96 ogg: use GLib instead of utils.h/log.h 2008-11-11 21:33:01 +01:00
Max Kellermann
401e77b258 decoder: fixed typo in assertion
decoder_file_decode() should check for plugin->file_decode, not
plugin->stream_decode().
2008-11-11 21:23:30 +01:00
Max Kellermann
0cba1ae312 ogg: get decoder command from decoder_data()
Eliminate two decoder_get_command() invocations from the main loop.
2008-11-11 21:21:54 +01:00
Max Kellermann
7b575b55c2 ogg: flush buffer after every ov_read() call
Don't let the buffer grow until it is full, flush it whenever there is
data available.
2008-11-11 21:15:01 +01:00
Max Kellermann
67814eddff mp3: support stream tags
Parse ID3 tags, even when they are in the middle of the stream.  Very
few streams provide embedded ID3 tags.  Most of them send only
Shoutcast "icy" tags, which limits the practical usefulness of this
patch.
2008-11-11 20:53:24 +01:00
Max Kellermann
514c37b0cd mp3: eliminated duplicate command check
When a command is received, decode_next_frame_header() and
decodeNextFrame() return DECODE_BREAK.  This is already checked by
both callers, which means that we can eliminate lots of
decoder_get_command() checks.
2008-11-11 20:50:37 +01:00
Max Kellermann
1bfa6a94e2 player: fix race condition during tag update
When a tag is updated, the old tag was freed before the new one was
created.  Reverse the order to be sure that other threads always see a
valid pointer.

This still leaves a possible race condition, but it will be addressed
later.
2008-11-11 20:46:55 +01:00
Max Kellermann
acf0d141be playlist: track song metadata changes
When the tag of the current song changes (e.g. a new tag was sent in
the stream), update the playlist, so clients pick up the new tag.
2008-11-11 20:46:55 +01:00
Max Kellermann
81d2076bcf oggflac: removed the obsolete try_decode() method 2008-11-11 17:17:06 +01:00
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