Max Kellermann
5aa1afe693
command: reject unsupported URI schemes
...
When a client-specified URI has a scheme which is not supported, do
not try to open it as a local file, but provide a meaningful error
message.
2008-12-16 21:23:29 +01:00
Max Kellermann
c50115f9a2
ls: added uri_has_scheme()
...
uri_has_scheme() checks if an URI contains the sub string "://", which
makes MPD assume that it is a remote URI.
2008-12-16 21:22:10 +01:00
Max Kellermann
e0be4400cf
ls: don't return suffix from parent directory name
...
When a file had no file name extension, getSuffix() could return the
extension of the parent directory (if it had one).
2008-12-16 21:22:08 +01:00
Max Kellermann
b765c62f2f
ls: reimplement getSuffix() with strrchr()
...
The old getSuffix() code was quite wasteful, and can be replaced
completely with strrchr().
2008-12-16 21:20:09 +01:00
Max Kellermann
d0024c077d
ls: use bool
...
Use the C99 "bool" data type instead of "int".
2008-12-16 21:18:33 +01:00
Max Kellermann
1d82edc6d3
ls: make printRemoteUrlHandlers() return void
...
printRemoteUrlHandlers() cannot fail, and does not need a return
value.
2008-12-16 21:18:31 +01:00
Max Kellermann
3287726736
ls: removed isValidRemoteUtf8Url()
...
The function didn't do anything useful, it was just several lines
obfuscating that it was only forwarding isRemoteUrl()'s return value.
2008-12-16 21:15:20 +01:00
Max Kellermann
3d4fb9a9a6
ls: don't include time.h
...
ls.h does not need time.h, do not include it.
2008-12-16 21:05:02 +01:00
Viliam Mateicka
88ab54d3d4
ffmpeg: fixing ffmpeg_send_packet to allow multipackets
2008-12-15 19:37:10 +01:00
Viliam Mateicka
8a412aaa27
ffmpeg: adding APE support
2008-12-15 19:34:58 +01:00
Max Kellermann
dedaf7033b
locate: ignore case when searching in song paths
...
The function strstrSearchTag() used g_utf8_casefold() to generate the
(pseudo-)lowercase version of the song's URL, but it never used the
variable.
2008-12-13 01:54:11 +01:00
Viliam Mateicka
01c591fb84
utils: moving stringFoundInStringArray() from decoder into utils
2008-12-09 17:36:10 +01:00
Max Kellermann
0dab2c5bc1
ao: use 16 bit sample format
...
There have been bug reports on MPD regarding 24 bit output via
libao/esd. The "ao" plugin does not attempt fall back to 16 bit
currently, and thus fails to play 24 bit audio (i.e. all mp3 files).
Make it always use 16 bit samples for now, until more bits are
well-tested.
2008-12-09 07:39:24 +01:00
Max Kellermann
4288cc069a
osx: use 16 bit sample format
...
The OS X output does not seem to support 24 bit audio in the way MPD
implements it currently. Fall back to 16 bit for now, and schedule
24 bit support on OS X for MPD 0.15.
2008-12-08 23:23:37 +01:00
Max Kellermann
a4512d3b9a
osx: use GLib instead of utils.h/log.h
...
One my_usleep() invocation remains, until we find out if we can delete
it.
2008-12-08 23:23:30 +01:00
Max Kellermann
b0f46c2076
osx: don't use void pointer in arithmetic
...
Cast AudioBuffer.mData to a "unsigned char*" before adding "curpos".
This fixes a gcc warning.
2008-12-08 23:23:28 +01:00
Max Kellermann
87f6f57bf6
mp3: declare variables as "enum mp3_action"
...
Variables which hold one of the DECODE_* values should be declared as
"enum mp3_action" instead of "int".
2008-12-08 16:49:19 +01:00
Avuton Olrich
a25b8acd82
update: default to follow all symlinks
...
MPD 0.13 and older followed all symbolic links. Although this can be
a security problem (as it has always been), 0.14 should offer the same
default behaviour as 0.13.
2008-12-08 10:01:20 +01:00
Max Kellermann
5b11d5a332
pcm_utils: always round up resampling buffer size
...
libsamplerate produces cracks in the sound output when the destination
buffer is too small. This is the case when pcm_convert_size() rounds
down. Use ceil(x) instead of floor(0.5+x) there to prevent a buffer
overrun.
2008-12-08 08:58:27 +01:00
Max Kellermann
0128a9e910
stored_playlist: include time.h for the time_t type
...
On some systems, the time_t data type was not present, because
stored_playlist.h didn't include the time.h header directly.
2008-12-04 23:19:31 +01:00
Viliam Mateicka
e61ba50ebd
decoder: audiofile plugin using input stream instead of file
2008-12-03 20:26:08 +01:00
Max Kellermann
6902ff2084
listen: check if AI_ADDRCONFIG is defined
...
AI_ADDRCONFIG is not available on all operating systems. Check if it
is defined in the current build environment.
2008-12-02 10:23:36 +01:00
Max Kellermann
ac0af91912
listen: enable AI_PASSIVE
...
The getaddrinfo() flag AI_PASSIVE should be used when resolving
addresses for the bind() system call.
2008-12-02 10:22:21 +01:00
Thomas Jansen
c06ce44768
replaced mpd_printf etc by G_GNUC_PRINTF
...
We want to remove gcc.h eventually. This takes care of all the G_GNUC_PRINTF
macros.
2008-12-02 03:00:02 +01:00
Thomas Jansen
e6ae40982e
replaced mpd_noreturn by G_GNUC_NORETURN
...
We want to remove gcc.h eventually. This takes care of all the
G_GNUC_NORETURN macros.
2008-12-02 02:42:19 +01:00
Thomas Jansen
c252143d51
replaced mpd_malloc by G_GNUC_MALLOC
...
We want to remove gcc.h eventually. This takes care of all the
G_GNUC_MALLOC macros.
2008-12-02 02:33:24 +01:00
Thomas Jansen
2720585731
replaced mpd_likely/mpd_unlikely by G_LIKELY/G_UNLIKELY
...
We want to remove gcc.h eventually. This takes care of all the
G_LIKELY/G_UNLIKELY macros.
2008-12-02 02:22:43 +01:00
Max Kellermann
4ca24f22f1
alsa: reverted the default buffer_time to 500 ms
...
Commit dd7711d8
removed MPD's default ALSA buffer_time. The result
was a buffer size which was way too small for playing streams on some
sound hardware, and caused skips and distorted sound. Revert the
default to 500 ms.
2008-12-01 22:37:05 +01:00
Max Kellermann
f600f4a256
shout: fixed the lame input buffer allocation
...
"float (*lamebuf)[2] = g_malloc()" does NOT allocate two float*
buffers. The formula is even wrong: it should be applied to LAME's
output buffer, not its input buffer.
Converted "lamebuf" to the two variables "left" and "right", and
allocate them independently with the exact buffer size. Set
right=left if mono output is configured.
2008-11-30 14:25:56 +01:00
Max Kellermann
a7b692a1df
shout_mp3: cast input buffer to int16_t*
...
It's easier to work with an int16_t* pointer here.
2008-11-30 14:21:40 +01:00
Max Kellermann
655ba6a637
input_curl: follow HTTP redirects
...
Follow HTTP redirects, but no more than 5.
2008-11-30 13:06:21 +01:00
Max Kellermann
422c17ceae
input_curl: send a User-Agent header
...
Send "Music Player Daemon " + VERSION as the User-Agent request
header.
2008-11-30 13:06:18 +01:00
Raphaël Rigo
5b089f85fd
update: added options which control symlink behaviour
...
The configuration options "follow_outside_symlinks" and
"follow_inside_symlinks" let the user control whether MPD should
follow symbolic links in the music directory.
[mk: converted variables to "bool"; moved configuration to
update_global_init()]
2008-11-28 10:57:39 +01:00
Max Kellermann
ced4abcd64
update: added update_global_init() and update_global_finish()
...
Those two functions are called when MPD starts and exits. It allows
the update library to perform global initialization and
deinitialization. The implementations are currently empty.
2008-11-27 19:34:54 +01:00
Max Kellermann
bd0653f440
conf: added config_get_bool()
...
In contrast to, getBoolConfigParam(), config_get_bool() properly
returns a "bool" value. In case of "unset", it returns the default
value provided by the caller.
2008-11-27 19:19:34 +01:00
Max Kellermann
910c000954
mp3: use GLib logging
...
Use GLib's g_warning(), ... instead of MPD's deprecated log.h.
2008-11-27 19:19:05 +01:00
Max Kellermann
21dade26aa
input_curl: disable Icy-Metadata
...
input_curl.c does not support parsing shoutcast metadata yet. Disable
the "Icy-Metadata" header for now, since it may cause corruptions in
the stream.
2008-11-25 18:13:15 +01:00
Max Kellermann
d85184256e
main: destroy the save_state timer on exit
...
Make valgrind happier.
2008-11-25 17:55:04 +01:00
Max Kellermann
7918785c78
output: use GLib instead of log.h/util.h
2008-11-25 17:47:46 +01:00
Max Kellermann
0277921e6a
oss: use GLib instead of utils.h/log.h
2008-11-25 17:43:28 +01:00
Max Kellermann
b76f7b769c
mvp: use GLib instead of utils.h/log.h
2008-11-25 17:37:12 +01:00
Max Kellermann
be60ff83f7
shout: use GLib instead of utils.h/log.h
2008-11-25 17:25:41 +01:00
Max Kellermann
125dad7119
shout: don't check HAVE_SHOUT
...
If the shout plugin is disabled, shout_plugin.c isn't compiled at all,
no need to check the macro definition.
2008-11-25 17:19:42 +01:00
Marc Pavot
fd1144145c
player: set elapsed=0 at song change
...
I have found something that looks like a bug in MPD:
- When a song is finished, the next one is played and the 'player'
event is emitted.
- When the client sends the status command just after this event, the
songid is the new one but the 'elapsed' time is not reseted to 0.
This is problem because I have implemented the solution using a timer
on client side to compute the elapsed time but with this bug the
elapsed time continues to be incremented on a new song.
2008-11-25 16:19:53 +01:00
Max Kellermann
c570aa20fa
ao: print error message when ao_open_live() fails
...
When ao_open_live() failed, MPD would ignore the error code in
"errno". Make it print a meaningful error message.
2008-11-25 16:18:06 +01:00
Max Kellermann
423276a384
ao: support all libao error codes
...
The function audioOutputAo_error() did not implement all possible
libao error codes. Support the rest of them, and fall back to
strerror().
2008-11-25 16:17:48 +01:00
Max Kellermann
ffc604498e
ao: use GLib instead of utils.h/log.h
2008-11-25 16:10:01 +01:00
Max Kellermann
bc55d8d78e
decoder: added missing glib.h include
2008-11-25 15:12:00 +01:00
Thomas Jansen
2555176854
tag_id3.h: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:57:30 +01:00
Thomas Jansen
bc74503a69
command.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:55:32 +01:00
Thomas Jansen
843ed730c0
client.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:48:32 +01:00
Thomas Jansen
b9fefc4564
player_thread.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:47:44 +01:00
Thomas Jansen
3742cf3abb
update.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:46:10 +01:00
Thomas Jansen
02273d96c3
sig_handlers.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:45:32 +01:00
Thomas Jansen
87751ddbd0
pcm_resample_fallback.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:44:17 +01:00
Thomas Jansen
34b1a9061e
dbUtils.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:42:47 +01:00
Thomas Jansen
3d258504a1
decoder_thread.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:41:53 +01:00
Thomas Jansen
f7d995f807
zeroconf.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:40:40 +01:00
Thomas Jansen
b31b334ba6
input_file.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:33:46 +01:00
Thomas Jansen
f0e621bcdb
input_curl.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:33:25 +01:00
Thomas Jansen
7c7b0431fe
decoder_api.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:32:53 +01:00
Thomas Jansen
c6a63f1397
main_notify.c: replaced mpd_unused by G_GNUC_UNUSED
2008-11-24 14:32:02 +01:00
Max Kellermann
14e121af90
flac, mpc, ogg, wavpack: include unistd.h for SEEK_SET
...
SEEK_SET is defined by unistd.h. Explicitly include it.
2008-11-24 10:33:08 +01:00
Max Kellermann
acbfba0698
player: disable music_pipe_check_format()
...
The music pipe audio format bugs seem to be fixed (hopefully).
Disable music_pipe_check_format() for now, since it consumes a lot of
CPU cycles.
2008-11-24 09:25:48 +01:00
Max Kellermann
116662e5a9
update: fixed shadow warning on "basename"
...
Renamed the local variable "basename", which shadows the POSIX
function basename().
2008-11-22 14:57:08 +01:00
Max Kellermann
d0779e71ab
command: format strerror() with "%s"
...
We shouldn't pass strerror() where a format string is expected.
2008-11-22 14:57:00 +01:00
Laszlo Ashin
a493aafe02
wavpack: use assert_static()
2008-11-22 14:28:11 +01:00
Laszlo Ashin
457a6f4bee
utils: introduce assert_static()
...
assert_static() will help us to find false asserts in compile time. Of
course it only works in case of expressions which can be evaluated
compile time. It cannot be used in global scope.
2008-11-22 14:28:11 +01:00
Marc Pavot
0bad84066b
command: allow clients to subscribe to specific idle events
...
The client may provide the names of idle events as arguments to the
"idle" command to inform MPD that it is only interested in these
events.
2008-11-22 13:26:21 +01:00
Max Kellermann
976d5045c6
decoder: check audio_format_valid() in all decoders
...
Refuse to play audio formats which are not supported by MPD.
2008-11-21 20:27:30 +01:00
Max Kellermann
be9e60d55e
audio_format: added audio_format_valid()
2008-11-21 20:27:05 +01:00
Max Kellermann
774417f12f
decoder: ignore decoder_data() calls with length==0
...
Pushing buffers with a zero length into the MPD core causes failures;
don't let them pass beyond the decoder plugi API.
2008-11-21 20:26:57 +01:00
Max Kellermann
63c3ebee46
flac, oggflac: use GLib instead of utils.h/log.h
2008-11-21 20:15:50 +01:00
Max Kellermann
f15fc4e99a
ffmpeg: use GLib instead of log.h
2008-11-21 20:13:41 +01:00
Max Kellermann
4a3a621caf
audiofile: use GLib instead of log.h
2008-11-21 20:13:36 +01:00
Max Kellermann
7a2fe930b8
aac: use GLib instead of utils.h/log.h
...
Removed the superfluous my_usleep() call.
2008-11-21 20:13:26 +01:00
Max Kellermann
0243e1e26d
log: print the log_domain
2008-11-21 20:13:00 +01:00
Max Kellermann
1c0c583216
state_file: save state_file every 5 minutes
...
When MPD quits in a non-clean way, the state file isn't written, and
on the next start, MPD time warps to the previous clean shutdown.
Save the state file every 5 minutes; this will probably be
configurable at a later time.
Note that we don't set a wakeup timer for that: when there is no MPD
traffic, MPD won't wake up to save the state file. This minor bug is
tolerated, because usually there is no change in MPD's state when the
main thread is idle.
2008-11-21 18:36:33 +01:00
Max Kellermann
695d8051d2
input_curl: try to seek by fast-forwarding the buffer
...
If the caller attempts to seek only a few bytes forward, chances are
good that the offset is already in the buffer. In this case, simply
fast-forward the buffer.
2008-11-21 17:10:20 +01:00
Max Kellermann
46df0fd7dc
input_curl: moved code to consume_buffer()
...
Added some assertions.
2008-11-21 16:57:55 +01:00
Max Kellermann
7779e4133a
input_curl: don't do temporary calculations with input_stream.offset
...
If someone calls seek() with an invalid (negative) offset, the curl
implementation of that method returned false, but left this invalid
offset in input_stream.offset. Move the calculation to a temporary
variable.
2008-11-21 16:56:10 +01:00
Max Kellermann
61ba50a9bc
decoder: ignore the SEEK command during startup
...
While waiting for the input stream to become ready, ignore all
commands except STOP. This fixes seeking errors with (remote) songs
which the decoder has already finished.
2008-11-20 21:08:16 +01:00
Max Kellermann
927bf45f84
ogg: moved the "errorStr" variable into the error handler
2008-11-20 20:11:00 +01:00
Laszlo Ashin
65a8822a0b
aac: get rid of gcc warnings
2008-11-20 19:20:25 +01:00
Konstantin Sobolev
7ac3abf499
update: pass UTF-8 path to skip_symlink()
...
skip_symlinks() expects an UTF-8 encoded file name, but
updateDirectory() passed ent->d_name (in file system encoding) to it.
Convert it to UTF-8 first.
2008-11-20 18:22:07 +01:00
Konstantin Sobolev
23b097593e
mapper: use the utf8_to_fs_charset() result
...
In map_directory_child_fs(), the result of utf8_to_fs_charset() was
never used, because it passed the unmodified "name" parameter to
pfx_dir().
2008-11-20 18:10:18 +01:00
Konstantin Sobolev
ddab531b4a
path: fix g_convert() argument order
...
g_convert() wants the destination character set first. This was mixed
up.
2008-11-20 17:48:11 +01:00
Max Kellermann
1f50146e29
ogg: check the ov_read() return value before the vorbis_info evaluation
...
The ov_info() return value may be corrupt when ov_read() did not
return a positive value. First check for success, then check
ov_info().
2008-11-20 12:45:17 +01:00
Max Kellermann
a8f69429b0
input_curl: don't fail when seek to EOF is requested
...
HTTP servers respond with "416 Requested Range Not Satisfiable" when a
client attempts to seek to the end of the file. Catch this special
case in input_curl_seek(). This fixes a glitch in the ogg vorbis
decoder plugin.
2008-11-20 12:45:17 +01:00
Max Kellermann
a0dd5b7f2f
curl: don't check running_handles for EOF
...
Since we are using curl_multi_info_read() / CURLMSG_DONE for detecting
end-of-response, we can remove all running_handles==0 checks. For
some reason, that has never worked correctly.
2008-11-20 12:42:42 +01:00
Max Kellermann
f61904db33
input_curl: always set eof=true on CURLMSG_DONE
...
curl_multi_info_read() is the authoritative source of the
"end-of-response" information. Always set c->eof when a CURLMSG_DONE
message is received, and check the result (success/failure) after
that.
2008-11-20 12:41:59 +01:00
Laszlo Ashin
05f4629fa3
wavpack: redo using audio_format_frame_size()
...
Somehow we lost 600e1322
after renaming some variables in ed6f6046
.
2008-11-19 00:02:06 +01:00
Max Kellermann
362ca300d6
decoder: pass the correct buffer length to pcm_convert()
...
When a global audio format is configured (setting
"audio_output_format"), decoder_data() overwrote the "length"
parameter with the size of the output buffer (result of
pcm_convert_size()). Declare a separate variable for the output
buffer length.
2008-11-18 22:45:51 +01:00
Viliam Mateicka
33b5015469
ffmpeg: read tags from AVFormatContext
...
The ffmpeg library provides some of the song metadata in the
AVFormatContext struct. Pass it from there to MPD.
2008-11-18 20:03:00 +01:00
Viliam Mateicka
eac4ed2241
audiofile: fixed misplaced if
...
[mk: by definition, tag_new() cannot fail - removed check]
2008-11-18 19:54:42 +01:00
Max Kellermann
63272d6888
music_pipe: narrowed assertion on chunk index
...
The chunk index passed to successor() must be valid, i.e. it must be
smaller than num_chunks.
2008-11-18 19:54:39 +01:00
Max Kellermann
7591403566
input_stream: size==-1 means unknown size
...
Define the special value "-1" as "unknown size". Previously, there
was no indicator for streams with unknown size, which might confuse
some decoders.
2008-11-16 20:42:08 +01:00
Max Kellermann
8882f06200
ffmpeg: fixed AVSEEK_SIZE
...
With whence==AVSEEK_SIZE, the seek function should return the file
size, not the current offset. Check the return value of
input_stream_seek().
2008-11-16 20:25:31 +01:00
Max Kellermann
9c4e97a61b
aac: detect whether to pass "uint32_t*" to NeAACDecInit2()
...
neaacdec.h declares all arguments as "unsigned long", but internally
expects uint32_t pointers. This triggers gcc warnings on 64 bit
architectures. To avoid that, make configure.ac detect whether we're
using Debian's corrected headers or the original libfaad headers. In
any case, pass a pointer to an uint32_t, conditionally casted to
"unsigned long*".
2008-11-16 20:04:49 +01:00
Max Kellermann
acfba02310
decoder: check length==0 in decoder_read()
...
When the caller passes length==0, decoder_read() entered an endless
loop. Check that condition before entering the "while" loop.
2008-11-15 19:27:30 +01:00
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
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
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
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