Max Kellermann
600e132280
wavpack: calculate outsamplesize with audio_format_frame_size()
2008-11-12 21:25:02 +01:00
Max Kellermann
ef80464c0c
ogg: revert "use ogg_fopen() instead of ogg_open()"
...
Unfortunately, ov_fopen() is not supported by libvorbis versions older
than 1.2.
2008-11-12 08:38:04 +01:00
Max Kellermann
b67a8e4d6e
aac: shift the input buffer before the full check
...
When the buffer was full, but everything was already consumed,
fillAacBuffer() would not attempt to flush and refill it.
2008-11-12 08:32:21 +01:00
Max Kellermann
432da18e44
aac: make the input buffer static
...
Allocate the input buffer within the AacBuffer struct.
2008-11-12 08:29:40 +01:00
Max Kellermann
487e05c67d
aac: reject SEEK commands
...
The aac plugin does not support seeking. Reject SEEK requests by
calling decoder_seek_error(). Quit the plugin's main loop only when
STOP is received.
2008-11-12 08:25:09 +01:00
Max Kellermann
a9723e661a
aac: get decoder command from decoder_data()
...
Removed a superfluous decoder_get_command() call.
2008-11-12 08:25:06 +01:00
Max Kellermann
35a4ca2421
aac: convert audio_format to temporary variable
...
The audio_format variable is only used and initialized for
decoder_initialized(). Move it into that block to save some bytes on
the stack.
2008-11-12 08:21:00 +01:00
Max Kellermann
39fa60769c
aac: removed method file_decode()
...
aac_stream_decode() was basically copy+pasted from aac_decode().
Since stream_decode() can also decode files, eliminate aac_decode().
2008-11-12 08:17:50 +01:00
Max Kellermann
e19b53f814
aac: check the buffer length in the ADIF parser
...
Check whether enough data has been read yet.
2008-11-12 08:16:54 +01:00
Max Kellermann
b30ec73099
aac: use unsigned integers and size_t where appropriate
2008-11-12 08:16:38 +01:00
Max Kellermann
9806355d4c
aac: check if the stream is seekable before length check
...
If the stream is not seekable, don't try to decode all frames to find
out the total song time.
2008-11-12 07:46:01 +01:00
Max Kellermann
f6765c4d8b
aac: removed attribute "atEof"
...
Use input_stream_eof() instead.
2008-11-12 07:41:54 +01:00
Max Kellermann
eff21067f0
mpc: assume the result fo of mpc_decoder_decode() is unsigned
...
According to the documentation, mpc_decoder_decode() returns an
mpc_uint32_t. Since the special return value (mpc_uint32_t)-1
translates to a very large long integer, this may cause segmentation
faults if not interpreted properly.
2008-11-12 07:14:18 +01:00
Max Kellermann
0a6f4048d0
mpc: don't assume the stream is stereo
...
Don't hard-code the factor "2".
2008-11-12 07:07:40 +01:00
Max Kellermann
8d1ffb1684
mpc: get decoder command from decoder_data()
...
Removed 3 superfluous decoder_get_command() invocations.
2008-11-12 07:07:12 +01:00
Max Kellermann
731e99c26e
mpc: moved code to mpc_to_mpd_buffer()
...
mpc_to_mpd_buffer() converts a whole chunk at a time. This eliminates
3 local variables in mpc_decode().
2008-11-12 07:06:47 +01:00
Max Kellermann
975d5cd77e
mpc: make the buffer large enough for one mpc frame
...
Don't split the buffer conversion loop. When libmpcdec returns a
chunk, convert and send the whole chunk at a time. This moves several
checks out of the loop, and greatly improves performance.
2008-11-12 07:03:44 +01:00
Max Kellermann
865757835e
mpc: use GLib instead of utils.h/log.h
...
Don't use deprecated MPD libraries.
2008-11-12 07:02:29 +01:00
Max Kellermann
1414a3de4c
mpc: declare buffer as int32_t[]
...
The buffer is always casted to int32_t* anyway; declare it as int32_t
array, and remove the cast.
2008-11-12 07:02:06 +01:00
Max Kellermann
06c60888dc
mpc: eliminated the local variable "eof"
...
Since each "eof=true" is followed by "break", the variable is
superfluous.
2008-11-11 21:39:50 +01:00
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