Commit Graph

2886 Commits

Author SHA1 Message Date
Laszlo Ashin c368a2f91c aac: fix compiler warnings on amd64 2008-11-15 11:54:22 +01:00
Laszlo Ashin 00da7db1e3 aac: don't try to free static buffer
In 432da18e a dynamic buffer was replaced by a static one but some
frees were accidently left there which caused some segfaults.
2008-11-15 11:50:25 +01:00
Avuton Olrich 0efd80d2e5 MPD version 0.14~alpha3 2008-11-14 10:29:06 -08:00
Max Kellermann 4a1ad61e8e log: check the log threshold in log_func()
The threshold was only checked in the deprecated logging functions
(ERROR(), WARNING(), ...).  Add the check to the GLib logging handler.
2008-11-14 18:27:11 +01:00
Max Kellermann 7720a1195a volume: eliminate alloca() usage
alloca() is not a portable function.  Don't use it.  Using
strncasecmp() is much more efficient anyway, because no memory needs
to be allocated and copied.
2008-11-14 18:15:33 +01:00
Max Kellermann 19131f1eda volume: moved code to oss_mixer_find() 2008-11-14 18:05:13 +01:00
Max Kellermann eb199ca207 player: don't queue song when there are 2 songs in the pipe
Don't send a "next song" request to the main thread when the current
song hasn't started playing yet, i.e. there are already two different
songs in the music pipe.  This would erase information about the song
boundary within the music pipe, and thus triggered an assertion
failure.  The bug could occur when playing very short songs which fit
into the pipe as a whole.
2008-11-14 17:55:51 +01:00
Max Kellermann 418dac6f94 player: wake up decoder before waiting for xfade chunks
Fix a deadlock: when the decoder waited for buffer space, the player
could enter a deadlock situation because it waits for more chunks for
crossfading chunks.  Signal the decoder before entering notify_wait().
2008-11-14 17:55:45 +01:00
László Áshin 440b1ea3ea wavpack: be more robust if the underlying stream is not seekable
The wavpack open function gives us an option called OPEN_STREAMING. This
provides more robust and error tolerant playback, but it automatically
disables seeking. (More exactly the wavpack lib will not return the
length information.) So, if the stream is already not seekable we can
use this option safely.
2008-11-14 15:23:18 +01:00
László Áshin c495c6f5af wavpack: tolerate less decoded data than requested
Wavpack plugin doesn't stop decoding if a block couldn't be fully
decoded, rather it tries to go on.
2008-11-14 15:23:13 +01:00
László Áshin ed6f60460d wavpack: renamed variables and modified coding style slightly 2008-11-14 15:21:44 +01:00
Max Kellermann 7b7340f703 mp3: fix SEEK command check after mp3_synth_and_send()
mp3 seeking was broken, because the command==SEEK check was never
reached.  Swap the command check order (==SEEK before !=NONE) to fix
that.
2008-11-13 14:43:19 +01:00
Max Kellermann 2dacd16b5b decoder: additional dc.command checks in decoder_data()
When a command is sent while the decoder waits for a free chunk in the
music pipe, it was not returned by decoder_data().
2008-11-13 14:43:19 +01:00
Avuton Olrich 3eb9b3218d MPD version 0.14~alpha2 2008-11-13 14:43:10 +01:00
Max Kellermann 2860b1b60f decoder: wait for the player only if the music pipe is full
Prevent superfluous wakeups and a deadlock condition.
2008-11-13 02:54:56 +01:00
Max Kellermann 1a3945b563 decoder: check dc.command at the beginning of decoder_data()
Seeking was somewhat broken in some decoder plugins because they sent
empty chunks, and never got a command.  Check the decoder command
before doing anything else in decoder_data().
2008-11-13 02:42:40 +01:00
Max Kellermann 709640422c player: chop the tail of the music pipe after CANCEL
When a CANCEL command is received, the player should drop all chunks
of the next song.  Added new funciton music_pipe_chop() which is used
for that.
2008-11-13 02:09:33 +01:00
Max Kellermann 66ce1495f0 music_pipe: continuously check the sample format of all chunks
Provide a debug function which asserts on the sample format of all
chunks.  Call this function in each iteration of the player main loop.
2008-11-13 02:06:58 +01:00
Max Kellermann 998d9a8225 decoder: ignore SEEK commands during initialization
When the decoder receives a SEEK during initialization, it should
ignore that for now.  The old code made most decoders abort.
2008-11-13 02:06:55 +01:00
Max Kellermann 1178e485cb music_pipe: check for partial frames in appended chunk
Added an additional assertion which checks partial frames in the
existing tail chunk.
2008-11-13 02:06:52 +01:00
Max Kellermann df09075afc player: assert that there was no previous "next song chunk"
When assigning the next_song_chunk variable, it must have been empty.
If not, there may be 3 songs overlapping in the music pipe.
2008-11-13 01:57:15 +01:00
Max Kellermann ae9bb92952 playlist: call clearPlayerQueue() only if song is queued II
This patch extends commit 35a16b99, and amends several 2 missing
checks.  It simplifies 2 more checks by merging "if" conditions.
2008-11-12 21:55:13 +01:00
Max Kellermann 93f488f034 wavpack: remove commented debug messages 2008-11-12 21:25:08 +01:00
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