Commit Graph

3193 Commits

Author SHA1 Message Date
Max Kellermann
923d2c966f mapper: allocate the result of map_fs_to_utf8() 2009-01-04 18:59:47 +01:00
Max Kellermann
8c5470a3db playlist: log errors during loadPlaylist()
Don't call command_error() if loading a song from the playlist fails.
This may result in assertion failures, since command_error() may be
called more than once.
2009-01-04 18:59:32 +01:00
Max Kellermann
49ac6fa996 playlist: use GLib logging 2009-01-04 18:17:37 +01:00
Max Kellermann
45597cc571 ls: renamed functions, no CamelCase 2009-01-04 17:46:42 +01:00
Max Kellermann
6a008b52d1 update: removed struct delete_data
The struct delete_data has only one member left and can be eliminated.
2009-01-04 17:28:34 +01:00
Max Kellermann
ff72fff68d ls: removed hasMusicSuffix() and get_archive_by_suffix()
Determine the suffix manually, and use decoder_plugin_from_suffix()
and archive_plugin_from_suffix() instead.

This way, song_file_update_inarchive() can be optimized: it does not
have to translate its path.
2009-01-04 17:26:22 +01:00
Max Kellermann
d6b229e35c update: moved code to update_regular_file() 2009-01-04 17:26:18 +01:00
Max Kellermann
8a562c9c71 song: removed duplicate '\n' check
Newline characters are already checked in skip_path() (update.c).
2009-01-04 17:26:15 +01:00
Max Kellermann
77d3643036 ls: include cleanup
Don't include headers which are not used.  Fix some includes in
decoder_thread.c.
2009-01-04 17:26:12 +01:00
Max Kellermann
599d5820bc update: moved code to directory_exists(), fix typo
Reverse the condition: delete directories which don't exist anymore.
This typo caused a slowdown during partial database update.
2009-01-04 17:26:07 +01:00
Max Kellermann
17d8bdb427 playlist: use uri_has_scheme() instead of isRemoteUrl()
For internal checks (i.e. not in command.c), we need to check whether
an URI is in the databse, in the local file system or a remote URI
with a scheme.
2009-01-04 16:23:33 +01:00
Max Kellermann
7d87f71d83 command: check URI scheme in "addid"
Check if the URI scheme is supported by MPD, and print an error
message if not.  Optimize the checks in "add" and "playlistadd".
2009-01-04 16:22:08 +01:00
Max Kellermann
ef0b328a3c command: added variable "uri" to command handlers
Don't work with argv[1], give it the better name "uri".
2009-01-04 16:19:45 +01:00
Max Kellermann
55b6fd2f0c player_thread: fix cross-fading duplicate chunk bug
When the decoder of the new song is not fast enough, the player thread
has to wait for it for a moment.  However the variable "nextChunk" was
reset to -1 during that, making the next loop iteration assume that
cross-fading has not begun yet.  This patch overwrites it with "0"
while waiting.
2009-01-04 14:55:02 +01:00
Max Kellermann
96c18e7d15 input_curl: enabled Icy-Metadata support 2009-01-03 23:55:03 +01:00
Max Kellermann
f9e9089f42 added library for parsing icy-metadata
The icy_metadata will be used by the curl input_stream implementation.
2009-01-03 23:35:30 +01:00
Max Kellermann
700bd44fda input_stream: added tag() method
The tag() method reads a tag from the stream.  This replaces the
meta_name and meta_title attributes.
2009-01-03 23:29:45 +01:00
Max Kellermann
4be479d20c tag: added function tag_merge()
tag_merges() merges the data from two tag objects into one.
2009-01-03 23:28:51 +01:00
Max Kellermann
149f4e10cf decoder_api: moved code to do_send_tag(), free temporary tag
This patch fixes a minor memory leak: when decoder_tag() attempted to
send a merged tag object (created by tag_add_stream_tags()), and was
interrupted by a decoder command, it did not free the temporary merged
tag object.
2009-01-03 23:28:51 +01:00
Max Kellermann
77b32addf1 tag: revert g_strescape() patch
Don't use g_strescape(), because it escapes all non-ASCII characters.
Add a new function which clears all non-printable characters, not just
"newline".
2009-01-03 23:13:39 +01:00
Max Kellermann
6d2e4f4e72 player: emit PLAYLIST event when stream tag changes
Commit b3e2635a introduced a regression: when a stream tag was
changed, the playlist version had to be updated.  This was done in
syncCurrentPlayerDecodeMetadata(), called by syncPlayerAndPlaylist().
After b3e2635a, this was not called anymore.  Fix this by emitting
PIPE_EVENT_PLAYLIST.
2009-01-03 20:49:51 +01:00
Max Kellermann
38bf81285f utils: removed unused functions
Removed all allocation functions, xwrite(), xread(), ARRAY_SIZE().
Those have been superseded by GLib.
2009-01-03 14:53:42 +01:00
Max Kellermann
b42e10b839 event_pipe: use GLib logging 2009-01-03 14:53:39 +01:00
Max Kellermann
d1c4f261c8 event_pipe: use close() instead of xclose()
xclose() aims to be the signal safe version of close(). However during
cleanup, this isn't important.
2009-01-03 14:53:36 +01:00
Max Kellermann
206611e280 conf: use GLib instead of utils.h 2009-01-03 14:53:34 +01:00
Max Kellermann
63e240131e state_file: use GLib instead of utils.h / stat() 2009-01-03 14:53:29 +01:00
Max Kellermann
dcff29e5aa state_file: errors are non-fatal in read_state_file()
If the state file cannot be read, for whatever reason, don't abort
MPD.  The state file isn't _that_ important.
2009-01-03 14:53:23 +01:00
Max Kellermann
2064e8ac4c songvec, dirvec: use GLib instead of utils.h 2009-01-03 14:53:02 +01:00
Max Kellermann
457301d97b compress: use GLib instead of utils.h 2009-01-03 14:52:59 +01:00
Max Kellermann
dec4e4ca85 don't include utils.h when it isn't used 2009-01-03 14:52:56 +01:00
Max Kellermann
d17f0f435b timer: use GLib instead of utils.h 2009-01-03 14:52:53 +01:00
Max Kellermann
03524fb81c tag: use g_strescape() to eliminate evil characters
This always allocates strings on the heap, but we can delete the
stripReturnChar() function now.
2009-01-03 14:52:49 +01:00
Max Kellermann
d342e338db pcm: use GLib instead of utils.h 2009-01-03 14:52:13 +01:00
Max Kellermann
962f2407d2 pcm_utils: use the custom PRNG for volume dithering
Don't use libc's rand() function, because it is slow.  Our own trivial
linear congruential generator is good enough for dithering.
2009-01-03 14:51:47 +01:00
Max Kellermann
8ebb3196a8 listen: use GLib instead of utils.h 2009-01-03 14:51:43 +01:00
Max Kellermann
30f75f7f01 tag_id3: use GLib instead of utils.h 2009-01-03 14:51:41 +01:00
Max Kellermann
c24a102c98 tag_pool: use GLib instead of utils.h 2009-01-03 14:51:37 +01:00
Max Kellermann
2189796b96 null, fifo: use GLib instead of utils.h 2009-01-03 14:51:34 +01:00
Max Kellermann
3978b7b1ea song: use GLib instead of utils.h/log.h 2009-01-03 14:51:30 +01:00
Max Kellermann
2d6f469091 decoder_api: use GLib instead of utils.h 2009-01-03 14:51:28 +01:00
Max Kellermann
2bc0144023 client: use GLib instead of utils.h 2009-01-03 13:44:19 +01:00
Max Kellermann
0eb1166beb client: convert GREETING to a static string
The length of GREETING is known at compile time, don't use strlen().
2009-01-03 13:42:14 +01:00
Max Kellermann
3dc43bb915 strset: use GLib instead of utils.h 2009-01-03 13:38:48 +01:00
Max Kellermann
906ca3e204 dbUtils: use GLib instead of utils.h 2009-01-03 13:37:36 +01:00
Max Kellermann
6ce06a4863 audio: use GLib instead of utils.h 2009-01-03 13:36:20 +01:00
Max Kellermann
019bca2475 listen: use gethostbyname() on WIN32
WIN32 has no getaddrinfo().  Fall back to gethostbyname().
2009-01-03 13:23:03 +01:00
Max Kellermann
fa9b5fd10b event_pipe: use _pipe() on WIN32
Windows has no pipe(), it only has _pipe() with two additional
parameters.
2009-01-03 13:22:55 +01:00
Max Kellermann
59067e6a92 ao: use g_strsplit() instead of strtok_r()
g_strsplit() is more portable than strtok_r().
2009-01-03 13:20:12 +01:00
Max Kellermann
5b543e8fa6 permission: use g_strsplit() instead of strtok_r()
g_strsplit() is more portable than strtok_r().
2009-01-03 13:20:10 +01:00
Max Kellermann
6507bcccd3 permission: parse password without strtok_r()
Use strchr()/g_strndup() to extract the password.
2009-01-03 13:20:06 +01:00
Max Kellermann
3cb3baa1e2 log: don't call closelog() on !HAVE_SYSLOG 2009-01-03 13:20:01 +01:00
Max Kellermann
a8dbd8f44f update: don't check for symlinks on WIN32
WIN32 does have some kind of symbolic links (e.g. in NTFS), but the
readlink() function is not available.  Disable symlink checking for
now.
2009-01-03 13:19:58 +01:00
Max Kellermann
48aace1859 event_pipe: moved variable "main_task" to main.c 2009-01-03 13:19:01 +01:00
Max Kellermann
96814397ad sig_handlers: disable on WIN32
WIN32 doesn't have POSIX signals.  Disable the code.  For a complete
port, we will have to implement the WIN32 equivalent.
2009-01-03 12:29:42 +01:00
Max Kellermann
2cf96abcc1 command: fix adding local files on !WIN32
Due to a typo, adding local files was always denied.

Disable the second playlist_append_file() invocation on WIN32.
2009-01-03 12:29:42 +01:00
Max Kellermann
7a8ef820a4 list: removed linked list library
It's been superseded by GLib's GSList.
2009-01-02 18:41:35 +01:00
Max Kellermann
e943b9bf13 conf: use GLib's GSList library
Use GLib's singly-linked list library instead of our custom one.
2009-01-02 18:40:43 +01:00
Max Kellermann
1183236797 alsa: use GLib instead of utils.h 2009-01-02 17:56:08 +01:00
Max Kellermann
051e906d85 jack: use GLib instead of utils.h 2009-01-02 17:23:10 +01:00
Max Kellermann
1fe129330e jack: duplicate jack_get_ports() return values
JACK documentation states: "The caller is responsible for calling
free(3) any non-NULL returned value."

This does not seem to include the array elements.  Duplicate them
after jack_get_ports(), and free only the array.  Convert
JackData.output_ports to non-const.
2009-01-02 17:23:00 +01:00
Max Kellermann
38fb8a01c1 update: use GLib instead of utils.h 2009-01-02 17:22:56 +01:00
Max Kellermann
4b6d17a670 database: use GLib instead of utils.h 2009-01-02 17:22:54 +01:00
Max Kellermann
9e46c32004 playlist: use GLib instead of utils.h 2009-01-02 17:22:47 +01:00
Max Kellermann
cc4e0a786d directory: use GLib instead of utils.h 2009-01-02 16:26:19 +01:00
Max Kellermann
8cf9138541 locate: use GLib instead of utils.h 2009-01-02 16:24:16 +01:00
Max Kellermann
e5b8a3b86d archive: use GLib instead of utils.h 2009-01-02 16:22:40 +01:00
Max Kellermann
cf9bd42416 main: include main.h, fix dependencies 2009-01-02 11:21:33 +01:00
Max Kellermann
272ee5f7d2 event_pipe: replaced PIPE_EVENT_SIGNAL with main_notify
There is only one location using PIPE_EVENT_SIGNAL: to synchronize
player_command() with player_command_finished().  Use the "notify"
library instead of the event_pipe here.
2009-01-02 11:20:41 +01:00
Max Kellermann
daf7c3db5a mapper: allocate the result of map_directory_child_fs(), map_song_fs()
Don't use fixed stack buffers.
2009-01-02 10:48:55 +01:00
Max Kellermann
72255d580e mapper: allocate the result of map_uri_fs(), map_directory_fs()
Don't use fixed stack buffers.
2009-01-02 10:48:11 +01:00
Max Kellermann
b2e3b64483 update: use g_file_test() instead of stat()
If we want to check whether a file is a directory, use GLib's
g_file_test() instead of stat().
2009-01-02 10:47:31 +01:00
Max Kellermann
38e3220fd4 oggflac: don't use gcc.h
Use G_GNUC_UNUSED instead of mpd_unused (which has already been
removed).
2009-01-02 09:50:12 +01:00
Max Kellermann
0c422838a8 playlist: use g_file_test() instead of stat()
To find out whether a file exists, use g_file_test() instead of
stat(), because it is more portable and easier to use.
2009-01-01 19:22:07 +01:00
Max Kellermann
80fa9183e4 mapper: allocate playlist path from heap
Don't pass a static buffer to map_spl_utf8_to_fs().
2009-01-01 19:17:44 +01:00
Max Kellermann
886ed1b225 mapper: fall back to XDG music directory
If no music_directory is configured, fall back to the XDG music
directory, determined by
g_get_user_special_dir(G_USER_DIRECTORY_MUSIC).
2009-01-01 19:07:38 +01:00
Max Kellermann
46aedbae09 removed the signal_check libraries
Nobody is using the signal_check library anymore.

This patch also removes the SIGUSR1 handler.
2009-01-01 18:51:38 +01:00
Max Kellermann
2f71b647f4 sig_handlers: use event_pipe for delivering SIGHUP
The signal_check library went out of order when we started using the
GLib main loop.  Convert the SIGHUP handler to use event_pipe instead.
2009-01-01 18:51:17 +01:00
Max Kellermann
e93136ef0f event_pipe: added event_pipe_emit_fast()
event_pipe_emit_fast() is aimed for use in signal handlers: it doesn't
lock the mutex, and doesn't log on error.  That makes it potentially
lossy, but for its intended use, that does not matter.
2009-01-01 18:47:25 +01:00
Max Kellermann
ecb20c5f7e mixer: renamed mix_* options to mixer_*
There is no reason to use the shortcut "mix" instead of "mixer".
2009-01-01 18:36:47 +01:00
Max Kellermann
65f037eb32 cmdline: exit after --version
Don't start the daemon when MPD is called with "--version".
2009-01-01 18:26:59 +01:00
Max Kellermann
b3e2635ac1 event_pipe: added pipe_event enum and callbacks
Make the event_pipe (formerly main_notify) send/receive a set of
events, with a callback for each one.

The default event PIPE_EVENT_SIGNAL does not have a callback.  It
is still there for waking up the main thread, when it is waiting for
the player thread.
2009-01-01 18:22:11 +01:00
Max Kellermann
22bb5a5856 event_pipe: renamed functions from main_notify_* to event_pipe_*
Continuing the previous patch.
2009-01-01 18:12:14 +01:00
Max Kellermann
9f5934d95b main_notify: renamed source to event_pipe.c
We are going to migrate away from the concept of notifying the main
thread.  There should be events sent to it instead.  This patch starts
a series to implement that.
2009-01-01 18:12:00 +01:00
Max Kellermann
99f8dc0168 gcc.h: removed all duplicate macros
Removed all macros which are already provided by GLib.
2009-01-01 18:09:28 +01:00
Max Kellermann
17bdcc8bae decoder plugins: don't include gcc.h
Use GLib's G_GNUC_UNUSED instead of gcc.h's mpd_unused.
2009-01-01 18:09:24 +01:00
Max Kellermann
7dfe301b54 output plugins: don't include gcc.h
Use GLib's G_GNUC_UNUSED instead of gcc.h's mpd_unused.
2009-01-01 18:08:29 +01:00
Max Kellermann
0734acf392 null: don't include gcc.h
Use GLib's G_GNUC_UNUSED instead of macros from gcc.h.
2009-01-01 18:00:46 +01:00
Viliam Mateicka
9a70c4d06d Moving mixers to audio outputs 2008-12-31 16:46:41 +01:00
Viliam Mateicka
dd9af72a74 exporting functions 2008-12-31 15:10:53 +01:00
Max Kellermann
3cd0b90ff6 client: run client_manager_expire() in an idle event
With the GLib main loop, the client manager can install its own event
in case a client is expired.  No need for main.c to call
client_manager_expire() manually.
2008-12-31 14:30:03 +01:00
Laszlo Ashin
a12b57e1e9 ls.c: include config.h to have HAVE_CURL here 2008-12-31 13:00:33 +01:00
Max Kellermann
dd0f8e42f3 main_notify: removed lock()/unlock()
These functions are not used anymore since we use the GLib main loop.
2008-12-31 00:32:56 +01:00
Max Kellermann
2cdfd93830 client: remember GLib source id
Remove the event source from the GMainLoop object in
client_set_expired().
2008-12-31 00:29:27 +01:00
Max Kellermann
d196ffdf3a sig_handlers: call g_main_loop_quit() in SIGTERM handler
We don't need to use asynchronous events to quit MPD, we can just call
g_main_loop_quit() inside the handler.
2008-12-30 19:50:38 +01:00
Max Kellermann
d40cf1652d main: export the main_loop variable
Other libraries may need to access the main_loop reference, to add or
remove events, or to call g_main_loop_quit().
2008-12-30 19:50:22 +01:00
Max Kellermann
a3b0506cfd sig_handlers: removed SIGCHLD
We have no child processes anymore.  Remove the SIGCHLD handler.
2008-12-30 19:35:01 +01:00
Max Kellermann
f38aaa2bb7 sig_handlers: don't reload database on SIGHUP
The SIGHUP handler was used by the update process to make the main
process re-read the database.  We don't need this anymore, since the
update takes place in a thread now.
2008-12-30 19:34:05 +01:00
Max Kellermann
a1434914a7 sig_handlers: removed unused functions
Most of these functions were obsoleted when we switched to threaded
MPD.
2008-12-30 19:32:12 +01:00
Max Kellermann
71e7ce5d8e main: use the GLib main loop
This is a rather huge patch, which unfortunately cannot be splitted.

Instead of using our custom ioops.h library, convert everything to use
the GLib main loop.
2008-12-30 19:24:39 +01:00
Max Kellermann
03e650aa9e main_notify: make the read side of the pipe blocking
Currently, both sides of the pipe are blocking, although we do not
need blocking read().  Convert it back to blocking.  Eliminate the
select() from wait_main_task().
2008-12-30 19:20:36 +01:00
Max Kellermann
10b5966bf6 main_notify: removed notify object, use only pipe
To wake up the main thread, don't attempt to use a GCond/GMutex
(struct notify).  This kind of mixed wakeup method has known race
conditions.

The idea behind this patch is: for wakeups which happen while the main
thread is sleeping, use only a pipe.  For wakeups which happen while
the main thread is waiting for the player thread, we can later change
to GCond.  For now, accept the overhead of using a pipe for the
latter.

In the long run, the main thread will never wait for the player
thread, but will do everything asynchronously.
2008-12-30 19:20:20 +01:00
Max Kellermann
1f0804bdca listen: don't make the server socket non-blocking
There is no point in making the server socket non-blocking.  We call
accept() only after select() has notified us about a new connection.
2008-12-30 19:18:59 +01:00
Max Kellermann
6890183c50 utils: port set_nonblocking() to WIN32
The new WIN32 version of set_nonblocking() can only deal with sockets,
i.e. it will fail on main_notify.c.  On WIN32, we have to reimplement
main_notify.c anyway, so this is not a big deal.
2008-12-30 19:17:20 +01:00
Max Kellermann
bb55ec6b4e command: don't allow adding local files on WIN32
There are no unix sockets on WIN32, and therefore no authentication.
WIN32 might have similar capabilities, but until we implement them,
disable that MPD feature.
2008-12-30 19:14:13 +01:00
Max Kellermann
7330002960 utils: implement my_usleep() with Sleep() on WIN32
Sleep() has only millisecond granularity, but good enough for now.
2008-12-30 19:10:08 +01:00
Max Kellermann
2eaeb65666 listen: include winsock headers on WIN32
On Windows, socket declarations reside in winsock.h and ws2tcpip.h.
The POSIX headers are not available.
2008-12-30 19:07:10 +01:00
Max Kellermann
e888af98a2 bonjour: fixed "unused parameter" warnings
Add G_GNUC_UNUSED attributes.
2008-12-30 16:45:49 +01:00
Max Kellermann
13867a1e7c zeroconf: eliminated strlen() usage from initZeroconf()
To test if a string is empty, we can just see if the first byte is 0.
No need to include string.h for strlen() here.
2008-12-30 16:45:43 +01:00
Max Kellermann
49fa9708d5 zeroconf: moved code to zeroconf-avahi.c and zeroconf-bonjour.c
Moved implementation specific code to their own sources, internal
declarations in zeroconf-internal.h.
2008-12-30 16:43:58 +01:00
Max Kellermann
bbed35822e zeroconf: fail if avahi service name is invalid
If the configured avahi service name is invalid, abort MPD.  Don't
fall back to the default service name.
2008-12-30 16:43:58 +01:00
Max Kellermann
e9a3c4ce32 playlist: use GLib's random number generator
srandom() and random() are not portable.  Use GLib's implementation.
2008-12-30 16:34:32 +01:00
Max Kellermann
cdf1eaeb2c daemon: simplified daemonize_close_stdin()
Don't bother to call fstat() or isatty() on STDIN_FILENO.
2008-12-30 16:28:18 +01:00
Max Kellermann
6c0f5fc612 listen: moved redirect_stdin() to daemon.c
redirect_stdin() is a daemonization function, and disconnecting from
the standard input is always a good idea for MPD.
2008-12-30 16:28:13 +01:00
Max Kellermann
671480814c main: moved daemonize() to daemon.c 2008-12-30 16:28:07 +01:00
Max Kellermann
d99595c214 listen: eliminated freeAllListenSockets()
Merged freeAllListenSockets() into closeAllListenSockets(), because
this is its only caller.
2008-12-30 16:28:00 +01:00
Viliam Mateicka
4cc0caf1af print supported decoders in --version 2008-12-30 14:17:15 +01:00
Max Kellermann
d38a7967ab main: disable non-portable code on WIN32
Disable changeToUser(), daemonize(), killFromPidFile().
2008-12-29 17:43:00 +01:00
Max Kellermann
509d12ae88 utils: implement parsePath() with g_strdup() on WIN32
On WIN32, parsePath() now simply duplicates the input string.  There
is currently nothing special we can do here.  The old code was not
portable on WIN32.
2008-12-29 17:42:54 +01:00
Max Kellermann
d4638834f8 utils: use g_get_home_dir()
Use g_get_home_dir() to get the home directory of the current user.
This will be portable to win32.
2008-12-29 17:42:49 +01:00
Max Kellermann
db849d1eed utils: make variables more local in parsePath()
Declare variables where they are really used.
2008-12-29 17:42:46 +01:00
Max Kellermann
3c9992aead client: include winsock headers on WIN32
On Windows, socket declarations reside in winsock.h and ws2tcpip.h.
The POSIX headers sys/socket.h etc. are not available.
2008-12-29 17:42:43 +01:00
Max Kellermann
274b919966 main: use g_setenv() instead of setenv()
Removed the fallback setenv() implementation for solaris.
2008-12-29 17:37:40 +01:00
Max Kellermann
6517126204 log: removed unused logging wrappers
Removed GLib logging wrappers which are not used anymore.
2008-12-29 17:35:42 +01:00
Max Kellermann
91be85a307 main: use GLib logging 2008-12-29 17:35:40 +01:00
Max Kellermann
4d3dd1ed2a path: use GLib logging 2008-12-29 17:32:53 +01:00
Max Kellermann
29500cedff update: use GLib logging 2008-12-29 17:29:49 +01:00
Max Kellermann
ef308d9644 alsa: use GLib logging 2008-12-29 17:29:42 +01:00
Max Kellermann
74d4ec7fbb jack: use GLib logging 2008-12-29 17:29:36 +01:00
Max Kellermann
eddf5e1e5e fifo: use GLib logging 2008-12-29 17:29:31 +01:00
Max Kellermann
409ee38b42 state_file: use GLib logging 2008-12-29 17:29:23 +01:00
Max Kellermann
d4018c9966 volume: use GLib logging 2008-12-29 17:29:18 +01:00
Max Kellermann
e9b96c6e56 player_thread: use GLib logging 2008-12-29 17:29:14 +01:00
Max Kellermann
46bef03e5a tag_id3: use GLib logging 2008-12-29 17:29:10 +01:00
Max Kellermann
0a9f69eaaa listen: use GLib logging 2008-12-29 17:29:04 +01:00
Max Kellermann
d6170c30c8 utils: use GLib logging 2008-12-29 17:29:01 +01:00
Max Kellermann
173021e4eb client: use GLib logging 2008-12-29 17:28:56 +01:00
Max Kellermann
e0fe4eb722 pcm: use GLib logging 2008-12-29 17:28:49 +01:00
Max Kellermann
f4ce43b958 database: use GLib logging 2008-12-29 17:28:37 +01:00
Max Kellermann
3fa5632704 log: automatically append newline
If a log message does not include a newline character, append it.
2008-12-29 17:28:34 +01:00
Max Kellermann
95b3430f52 removed os_compat.h
Only include headers which are really needed.  os_compat.h aimed to
make MPD easily portable, but was never actually made portable.
2008-12-29 17:28:32 +01:00
Max Kellermann
041b8f697b command: use gmtime() on WIN32
gmtime_r() is not available.
2008-12-29 17:28:13 +01:00
Max Kellermann
b5c5a6b4c7 condition: removed cond_timedwait() and cond_signal_async()
These methods are unused.
2008-12-29 17:28:09 +01:00
Thomas Jansen
0d8ba194be tag_id3: strip leading and trailing whitespace from ID3 tags
Fix for bug #1491.
2008-12-29 16:37:41 +01:00
Frank Mulder
a51fada124 mp4: support the writer/composer tag
I tried to search for a certain composer in my collection, but only
non-mp4 files showed up. The source code reveals that this tag is not
read. This can be fixed by reading the 'Writer' tag field, in
mp4_plugin.c, in function mp4_load_tag.

I actually tried this, and after compiling with those lines added,
also mp4 (.m4a) files showed up when searching for a composer.
2008-12-29 11:29:01 +01:00
Viliam Mateicka
6ad7be9525 update: fixing empty filenames in archives 2008-12-29 07:26:17 +01:00
Thomas Jansen
c15ac57271 osx_plugin: migrate from pthread to glib threads 2008-12-28 22:09:42 +01:00
Thomas Jansen
36b8968e36 output: migrate from pthread to glib threads 2008-12-28 22:09:42 +01:00
Thomas Jansen
28128dc4e3 tag & tag_pool: migrate from pthread to glib threads 2008-12-28 22:09:42 +01:00
Thomas Jansen
ce5c22f4f4 condition: migrate from pthread to glib threads 2008-12-28 22:09:42 +01:00
Thomas Jansen
248cd50a20 update & main_notify: migrate from pthread to glib threads 2008-12-28 22:09:42 +01:00
Thomas Jansen
195cec505e player_thread: migrate from pthread to glib threads 2008-12-28 22:09:38 +01:00
Thomas Jansen
c01ad37d3b decoder_thread: migrate from pthread to glib threads 2008-12-28 22:09:33 +01:00
Thomas Jansen
bfb5657d6d songvec: migrate from pthread to glib threads 2008-12-28 21:02:42 +01:00
Thomas Jansen
4ed895c799 dirvec: migrate from pthread to glib threads 2008-12-28 21:02:30 +01:00
Thomas Jansen
8332a70406 idle: migrate from pthread to glib threads 2008-12-28 21:02:14 +01:00
Thomas Jansen
5e3dc6946f Include <pthread.h> where it is necessary only 2008-12-28 21:02:05 +01:00
Thomas Jansen
f31b4f46e1 Remove xpthread_* wrappers 2008-12-28 21:01:03 +01:00
Max Kellermann
1914e11466 conf: use GLib instead of utils.h/log.h 2008-12-28 19:54:49 +01:00
Max Kellermann
859aac7242 utils: removed myFgets()
Replaced myFgets() with fgets() + g_strchomp().
2008-12-28 19:54:49 +01:00
Max Kellermann
2598cdd868 buffer2array: use GLib's g_ascii_isspace()
g_ascii_isspace() includes \r and \n.  This means that lines from a
text file don't have to be chopped prior to buffer2array().
2008-12-28 19:54:39 +01:00
Max Kellermann
4b3a055ffe mikmod: use Glib instead of utils.h/log.h 2008-12-28 19:48:53 +01:00
Max Kellermann
4ca02bfcfc mikmod: convert mod_Data.audio_buffer to a static array
Don't do two allocations for the mod_Data structure.
2008-12-28 19:48:53 +01:00
Max Kellermann
7f78ed5b98 log: use GLib logging 2008-12-28 19:48:53 +01:00
Max Kellermann
59cf77bbc8 log: don't keep log file open
The log file is duped to STDOUT_FILENO and STDERR_FILENO.  No need to
keep another copy of it in out_fd all the time.  We only need it once
once in setup_log_output().
2008-12-28 19:48:53 +01:00
Max Kellermann
8fe03b8bce decoder: terminate decoder thread before MPD cleanup
When MPD exits, it should manually free all resources in use, to allow
easy memory leak debugging.  Make the decoder thread terminate during
that.
2008-12-28 19:48:53 +01:00
Max Kellermann
c01aa53e6a log: support syslog()
Allow logging to syslog if log_file is configured to "syslog".
2008-12-28 19:48:53 +01:00
Max Kellermann
c6cb611065 log: moved code to log_init_file()
Added log_init_file() and log_init_stdout(), preparing for other
logging targets.
2008-12-28 19:48:53 +01:00
Max Kellermann
d70c2e2285 log: merged initLog() and open_log_files().
The logging library currently has 3 constructor functions: initLog(),
open_log_files(), setup_log_output(), called in this order.  Merged
the first two.
2008-12-28 19:48:53 +01:00
Max Kellermann
caf47f7893 log: moved code to parse_log_level() 2008-12-28 19:48:53 +01:00
Max Kellermann
5d2c59e3f1 log: use the GLogLevelFlags type
Declare log_threshold as GLogLevelFlags.
2008-12-28 19:48:53 +01:00
Max Kellermann
2c5885e9c7 log: don't manipulate the umask
If the user wants the log files with a specific mode, he has to start
MPD with the correct umask.  Don't hard-code that.

This fixes a bug: when log cycling failed, MPD would not restore the
old umask.
2008-12-28 19:48:52 +01:00
Max Kellermann
8e9def1b5a log: moved code to open_log_file()
Merged code from open_log_files() and cycle_log_files().
2008-12-28 19:48:52 +01:00
Max Kellermann
8dc92ad284 log: deprecated "error_file" option
Removed the "error_file" option.  There is only one log file now.  If
a user wants to see only the errors, he should configure a log_level.
2008-12-28 19:48:52 +01:00
Viliam Mateicka
d838a1ad24 decoder: new plugin using modplug library 2008-12-28 17:11:18 +01:00
Pauli Virtanen
65b18644e1 Add RVA2 tag support to MPD
This patch adds RVA2 (relative volume adjustment) tag
support to mpd, as a fallback if no replaygain tags are
found. The code is almost directly from madplay (GPL).

RVA2 tags are generated for example by the "normalize" utility.

Updated by: Avuton Olrich <avuton@gmail.com>
2008-12-28 13:02:34 +01:00
Max Kellermann
ed9668f638 notify: use GLib locking
Use GLib locking (GMutex, GCond) instead of pthread because GLib is
more portable, e.g. on mingw32.
2008-12-27 20:56:06 +01:00
Max Kellermann
e8c44782d0 output_control: no static "notify" initialization
Don't use NOTIFY_INITIALIZER to initialize audio_output_client_notify.
2008-12-27 20:53:52 +01:00
Viliam Mateicka
b2fc0ee274 cmdline: fixed option_no_createdb usage 2008-12-27 20:16:32 +01:00
Max Kellermann
83fc948008 cmdline: use g_build_filename() for ~/.mpdconf
Build the path with g_build_filename().  Also use g_get_home_dir() and
g_file_test().
2008-12-27 19:46:43 +01:00
Max Kellermann
f5ff00bba4 cmdline: use GLib's option parser
Eliminate duplicated code.  The GLib code is much more mature than
MPD's custom parser.
2008-12-27 19:36:03 +01:00
Max Kellermann
357712c8f3 cmdline: use gboolean instead of int
Prepare for the migration to the GLib option parser, which uses
gboolean for flags.
2008-12-27 19:35:30 +01:00
Max Kellermann
786bb8cc33 moved command line parser to cmdline.c 2008-12-27 19:03:33 +01:00
Max Kellermann
cc3b6c2f5b audiofile: don't close onput stream in libaudiofile destroy()
The input_stream object should only be closed by the MPD core
(i.e. decoder_thread.c / decoder_run()).  A decoder plugin which
attempts to close it will result in a segmentation fault.
2008-12-27 14:34:51 +01:00
Max Kellermann
0fe0425dee disable archive API without plugins
When there are no archive plugins, we do not need the archive API at
all.  Drop all its overhead.
2008-12-27 14:33:41 +01:00
Max Kellermann
9220e0edff Merge branch 'experimental' of git://git.musicpd.org/metyl/mpd
Conflicts:

	configure.ac
	src/ls.h
	src/output/shout_plugin.c
2008-12-27 13:34:51 +01:00
Max Kellermann
1bd3cde062 playlist: fix stored playlist modifications with absolute paths
When save_absolute_paths_in_playlists was enabled in mpd.conf, MPD
broke all playlists when manipulated using the "playlistdelete"
command.  The reason was that map_directory_child_fs() was used, which
doesn't accept slashes in the file name.  Use the new map_uri_fs()
function instead.
2008-12-24 22:04:24 +01:00
Max Kellermann
a94e59ca21 stored_playlist: fix integer overflow in length estimation
With a large maximum playlist length, the integer multiplication
"playlist_max_length * MPD_PATH_MAX" may overflow.  Change that to a
division.  This was not a dangerous bug, since it was only used for
a quick estimate.
2008-12-24 17:40:41 +01:00
Max Kellermann
7f98ba24c7 ffmpeg: case AV_NOPTS_VALUE to int64_t
The old code casted it to a 32 bit integer, which cut off bits.
AVFormatContext.duration is a int64_t, so use this type.
2008-12-24 11:56:53 +01:00
Max Kellermann
82ef85a309 ffmpeg: don't assign "0" to pointer
Use NULL instead.  Found by sparse.
2008-12-24 11:49:37 +01:00
Max Kellermann
fefd3d6fb7 Makefile.am: fix sparse invocation
Added missing includes.
2008-12-24 11:49:09 +01:00
Max Kellermann
fc723803a4 mp3: "tag" argument is unused when libid3tag is disabled
Add G_GNUC_UNUSED attributes.
2008-12-24 11:07:58 +01:00
Max Kellermann
4716ef1014 listen: "port" argument is unused when TCP support is disabled
Add a G_GNUC_UNUSED attribute.
2008-12-24 11:07:58 +01:00
Max Kellermann
0d9d82a932 pcm_utils: check pcm_convert()==0
It is illegal to pass an empty audio buffer around.  pcm_resample()
sometimes seems to result in 0 samples, maybe related to
libsamplerate.  To work around that problem, add special checks after
both pcm_convert() invocations.  Removed the pcm_resample()==0 checks
from pcm_convert().
2008-12-24 03:08:39 +01:00
Max Kellermann
d2d11d70a8 client: always attempt to flush deferred buffers
When a response is very long (e.g. a large playlist > 100k songs),
most of it will end up in the deferred buffers.  Filling the deferred
queue is very expensive currently, because a new buffer is allocated
for every client_write() operation.  This may lead to long delays, and
the client might give up and disconnect meanwhile.  This patch makes
MPD attempt to flush the deferred queue as often as possible, to work
around this problem.  Due to the MPD 0.14 code freeze, we should not
optimize the buffering code now.
2008-12-24 03:00:08 +01:00
Viliam Mateicka
d96cda95a1 shout: fixed bad error message printout 2008-12-23 18:05:25 +01:00
Viliam Mateicka
4674d0442a shout: fixed bad error message printout 2008-12-23 18:00:37 +01:00
Max Kellermann
3b2a752d0e Merge branch 'http_buffer_remove' of git://git.musicpd.org/avuton/mpd 2008-12-21 19:40:06 +01:00
Avuton Olrich
e75e40085f Remove obsolete http_buffer* stuff that went away with the new curl backend. 2008-12-20 22:16:02 -08:00
Max Kellermann
bfaaf425c2 log: map log level "SECURE" to GLib's "INFO"
Make "secure" a log level different from "default".  "secure" should be
right between "default" and "verbose".  Map "default" to Glib's
"MESSAGE" log level.
2008-12-20 17:26:49 +01:00
Emanuele Giaquinta
213c021eac Remove useless statement. 2008-12-17 16:49:33 +01:00
Max Kellermann
5d56b6ced8 player_control: check if errored_song is set
getPlayerErrorStr() assumes that pc.errored_song is set when an error
occured.  Since the song may have been deleted meanwhile, add a NULL
check.
2008-12-17 16:46:12 +01:00
Max Kellermann
13192546a8 playlist: clear pc.errored_song on delete
When a (remote) song is deleted from the playlist, there may still be
a reference to it in pc.errored_song.  Clear this reference.
2008-12-17 16:45:49 +01:00
Emanuele Giaquinta
25c04a97d3 Remove useless computation. After the pthread_cond_wait loop there are at least MIN(od->bufferSize, size) free bytes in the buffer. Thus MIN(od->bufferSize - od->len, size) is always equal to MIN(od->bufferSize, size). 2008-12-17 15:56:43 +01:00
Emanuele Giaquinta
c584d6b087 Remove useless statement, curpos is initialized at the beginning of the loop. 2008-12-17 15:56:43 +01:00
Emanuele Giaquinta
c36a6b0aee Factor computation. 2008-12-17 15:56:43 +01:00
Emanuele Giaquinta
a4f0c7b457 Use MIN. 2008-12-17 15:56:43 +01:00
Emanuele Giaquinta
df80ae86ee Call CloseComponent after AudioUnitUninitialize. 2008-12-17 15:56:43 +01:00
Viliam Mateicka
37796699cf archiveapi: archive plugin for ISO files 2008-12-16 21:48:26 +01:00
Viliam Mateicka
ddcf0a4078 archiveapi: archive plugin for ZIP files 2008-12-16 21:46:11 +01:00
Viliam Mateicka
98fd9b7da8 archiveapi: archive plugin for BZ2 files 2008-12-16 21:45:59 +01:00
Viliam Mateicka
77946a901f update: adding archive updating related code 2008-12-16 21:42:42 +01:00
Viliam Mateicka
455b39fa26 song: adding support for songs in archives 2008-12-16 21:42:42 +01:00
Viliam Mateicka
4d604a7540 ls: adding get_archive_by_suffix() function 2008-12-16 21:42:42 +01:00
Viliam Mateicka
c73ebac4af new archive api, input_archive stream 2008-12-16 21:42:34 +01:00
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
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
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
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
b0f1bc4856 Makefile.am: distribute input_curl.h
input_curl.h was missing in the tarball because it was not listed in
$(mpd_headers).
2008-11-05 21:23:56 +01:00
Max Kellermann
7f880ab8ba main: print usage to stdout
Using the logging library here is inappropriate.
2008-11-05 20:52:14 +01:00
Max Kellermann
130fa94423 log: convert messages to system charset
When logging to the terminal, we should print messages in the system
character set.  Convert all messages in this case.
2008-11-05 18:39:13 +01:00
Max Kellermann
787c6f5e18 log: use bool
Use the bool data type for flags.
2008-11-05 18:39:10 +01:00
Max Kellermann
4c967a6ba2 log: provide a GLib logging handler
Install a default handler which writes to stdout or stderr, and
prepends a time stamp.  This looks just like the 0.13.x logger.
2008-11-05 18:38:55 +01:00
Max Kellermann
a5348a3786 log: use GLib message logging
The logging functions from log.h are deprecated, and the code should
use GLib logging instead.  Make ERROR(), WARNING() etc. call g_logv()
internally.
2008-11-05 18:38:30 +01:00
Max Kellermann
a05fa5cdbb log: no CamelCase
Renamed the variable "logLevel" to "log_threshold".
2008-11-05 18:38:23 +01:00
Max Kellermann
08aaf57ff0 log: removed warning buffer
The warning buffer is a complex piece of code for no good reason.
Remove it and find a better solution, e.g. open the log file earlier.
2008-11-05 18:37:40 +01:00
Max Kellermann
b35ca9e5c4 main: initialize locale (LC_CTYPE)
Initialize libc's locale functions.  Currently, we are only interested
in LC_CTYPE (character classification), because this is what is used
by GLib's g_get_charset().
2008-11-05 18:37:39 +01:00
Max Kellermann
2a1a37107f path: don't allocate charset twice
Make the local variable "charset" const, and don't duplicate its
value.  It is already duplicated by path_set_fs_charset().
2008-11-05 18:26:45 +01:00
Max Kellermann
6a7a26fe42 path: get filesystem charset from GLib
GLib provides the function g_get_filename_charsets() which determines
the file system character set.  This changes MPD's fallback: GLib
prefers UTF-8 as a fallback.  MPD used to fall back to ISO Latin 1.
2008-11-05 18:25:57 +01:00
Max Kellermann
3002fd18cb path: no CamelCase
Rename variables and functions.
2008-11-05 18:21:52 +01:00
Max Kellermann
259c6ed164 enable GLib threading
Call g_thread_init() from main() to enable the GLib features which
make it thread safe.
2008-11-05 18:21:49 +01:00
Max Kellermann
06f9b6c379 main: don't close all file descriptors on startup
Removed closeAllFDs().  The caller is responsible for closing all file
handles.
2008-11-05 18:21:36 +01:00
Max Kellermann
5d6e96e986 pulse: removed reconnect interval
The output thread automatically waits some time before retrying to
open the device.  Don't duplicate this check in the pulse plugin.
2008-11-05 08:10:13 +01:00
Max Kellermann
3defcef5f3 pulse: check if connection is open in pulse_cancel()
The pulse plugin crashed with a segmentation fault when the pulse
server was killed.
2008-11-05 08:06:39 +01:00
Max Kellermann
eedbd28ec9 wavpack: read_bytes() should not return after partial reads
libwavpack expects the read_bytes() stream method to fill the whole
buffer, and fails badly when we return a partial read (i.e. not enough
data available yet).  This caused wavpack streams to break.
Re-implement the buffer filling loop.
2008-11-05 07:24:57 +01:00
Max Kellermann
010a27cd95 wavpack: don't close the stream
The input_stream object is opened and closed by the caller.
2008-11-05 07:13:55 +01:00
Max Kellermann
85a7d1a148 decoder: removed stream_types
Instead of checking the stream_types bit set, we can simply check
whether the methods stream_decode() and file_decode() are implemented.
2008-11-04 17:10:19 +01:00
Max Kellermann
59c20e5afe wavpack: removed NULL element from tagtypes
The number of tag types is known at compile time.  Use the GLib macro
G_N_ELEMENTS instead of having a NULL element at the end.
2008-11-04 17:10:17 +01:00
Max Kellermann
66eb3e90c3 wavpack: use enum tag_type
Don't store tag type values in a plain integer, use the proper enum.
2008-11-04 17:10:13 +01:00
Max Kellermann
946e69b2f6 wavpack: use GLib instead of utils.h / log.h
Replace deprecated code with GLib.
2008-11-04 17:10:10 +01:00
Max Kellermann
097bccd4ae wavpack: read first byte from wvc stream
Instead of manually waiting for the input stream to become ready (to
catch server errors), just read the first byte.  Since the
wavpack_input has the capability to push back one byte, we can simply
re-feed it.  Advantage is: decoder_read() handles everything for us,
i.e. waiting for the stream, polling for decoder commands and error
handling.
2008-11-04 17:10:03 +01:00
Max Kellermann
3cf54591e9 wavpack: use the bool data type
Use boolean true/false instead of 1/0.
2008-11-04 17:10:01 +01:00
Max Kellermann
b6ea410ca7 wavpack: no CamelCase
Renamed functions and variables.
2008-11-04 17:08:59 +01:00
Max Kellermann
c1dfa52cbf wavpack: fix indent
Fixed the indent of the switch statement in format_samples_int().
2008-11-04 17:08:57 +01:00
Max Kellermann
fef14683ae mp4: get decoder command from decoder_data()
Eliminate a superfluous decoder_get_command() call.  decoder_data()
already returns the command.
2008-11-04 17:05:08 +01:00
Max Kellermann
11404b5d10 mp4: initialize audio_format before decoder_initialized()
Removed the duplicate audio_format initialization.
2008-11-04 17:05:05 +01:00
Max Kellermann
290347c482 mp4: use decoder_read() instead of input_stream_read()
decoder_read() handles decoder commands, and should be used in decoder
plugins.
2008-11-04 17:05:02 +01:00
Max Kellermann
9ecfc57c3a mp4: pass struct mp4_context to the mp4ff_callback_t methods
We need the decoder object, so we have to begin passing a new struct
to these callbacks, instead of only the pointer to the input_stream
object.
2008-11-04 17:05:00 +01:00
Max Kellermann
632dc7c96b mp4: use GLib instead of utils.h / log.h
Replace deprecated code with GLib.
2008-11-04 17:04:57 +01:00
Max Kellermann
01706dd46c mp4: use tag_is_empty() instead of passing the tag_is_found flag
The API of mp4_load_tag() was strange: it always returned a tag
object, no matter if a tag was found in the file; the existence of a
tag was indicated with the tag_found integer reference.  This flag is
superfluous, since we can simply check whether the tag is empty or
not.
2008-11-04 17:04:54 +01:00
Max Kellermann
02a172f2c2 mp4: static mp4ff_callback_t variables
Allocate the mp4ff_callback_t object on the stack.  This is easier to
handle, since we don't have to free it.  Incidentally, this fixes a
memory leak in mp4_load_tag().
2008-11-04 16:55:12 +01:00
Max Kellermann
8712a1f7bf mp4: no CamelCasee
Renamed functions and variables.
2008-11-04 16:55:12 +01:00
Max Kellermann
ab07cdd453 ffmpeg: removed loop from mpd_ffmpeg_read()
The function decoder_read() already cares about the decoder command,
and loops until data is available.  Reduced mpd_ffmpeg_read() to no
more than the decoder_read() call.
2008-11-04 16:55:12 +01:00
Max Kellermann
292334a27a ffmpeg: removed ffmpeg_context.codec
That variable is never used except during initialization in
ffmpeg_helper().
2008-11-04 16:55:12 +01:00
Max Kellermann
7e84c73b17 ffmpeg: moved code to ffmpeg_find_audio_stream() 2008-11-04 16:55:12 +01:00
Max Kellermann
5e486964e8 ffmpeg: no CamelCase
Renamed variables.
2008-11-04 16:55:11 +01:00
Max Kellermann
e26bff9b92 tag: added tag_is_empty() 2008-11-04 16:55:11 +01:00
Max Kellermann
d7b2d93ccc osx: fix gcc warnings
Fix prototypes and unused variables.
2008-11-04 11:26:04 +01:00
Max Kellermann
37696dcbbf osx: adapt to new output plugin API
The OS X output plugin wasn't adapted to the new output plugin yet,
because I had no Mac to test...
2008-11-04 11:19:37 +01:00
Max Kellermann
095a62a1d0 decoder: update dc.error after input stream failure
dc.error wasn't updated when the input stream failed to initialize.
2008-11-03 21:49:47 +01:00
Max Kellermann
75d2a39768 input_curl: use curl_multi_info_read()
The function curl_multi_info_read() provides access to errors from the
curl easy interface.
2008-11-03 21:49:43 +01:00
Max Kellermann
fdf0d46e3d player: converted PLAYER_ERROR_* to enum 2008-11-03 21:49:40 +01:00
Max Kellermann
eca0e6db3b player: removed "volatile" attributes
Removed the "volatile" attributes from several variables which are not
important for synchronization.
2008-11-03 21:49:36 +01:00
Max Kellermann
862bbc21a1 player: no CamelCase
Renamed variables and internal functions.  Most of the
player_control.h API remains in CamelCase for now.
2008-11-03 21:49:29 +01:00
Max Kellermann
cfaf85e37d decoder: converted DECODE_ERROR_* to enum 2008-11-03 21:48:17 +01:00
Max Kellermann
ec6d26788a decoder: removed "volatile" modifier
The variable "next_song" is already protected by a memory barrier.
"total_time" is not important for synchronization, and we don't need
"volatile" here.
2008-11-03 21:44:12 +01:00
Max Kellermann
863badd91e decoder: no CamelCase
Renamed variables and functions.
2008-11-03 21:43:02 +01:00
Max Kellermann
b3dfcfef52 decoder_api: send song tag in decoder_data()
Before passing the first chunk to the audio output device, send the
current song's tag.
2008-11-03 20:20:09 +01:00
Max Kellermann
ac96022c1d decoder_api: automatically send stream tag
If an input stream provides tags (e.g. from an icecast server), send
them in the decoder_data() and decoder_tag() methods.  Removed the
according code from the mp3 and oggvorbis plugins - decoders shouldn't
have to care about stream tags.

This patch also adds the missing decoder_tag() invocation to the mp3
plugin.
2008-11-03 18:24:01 +01:00
Max Kellermann
8bb2da063f tag: added function tag_has_type()
tag_has_type() checks whether the tag contains one or more items with
the specified type.
2008-11-03 18:24:00 +01:00
Max Kellermann
b9d456a041 decoder_api: no CamelCase
Renamed variables.
2008-11-03 17:56:41 +01:00
Max Kellermann
f70dccdce1 configure.ac: separate the "aac" and "mp4" decoder tests
MPD used to have a copy of the mp4ff library.  Since that has been
removed, AAC suport was disabled when there was no libmp4ff.  Separate
the libmp4ff test, and enable AAC support no matter if libmp4ff is
available.
2008-11-03 16:48:12 +01:00
Max Kellermann
9074f924e9 alsa: initialize "device" with NULL
When using autodetection, AlsaData.device wasn't properly initialized
with NULL.  This broke autodetection randomly.
2008-11-03 07:40:54 +01:00
Max Kellermann
e6f334a088 mod: removed boolean globals for lazy init
The variables mod_mikModInitiated and mod_mikModInitError were used to
control lazy initialization, but they are superfluous now.
2008-11-03 07:32:02 +01:00
Max Kellermann
bb15c3bd45 mod: always initialize libmikmod
The "mod" decoder plugin was being initialized lazily, but was
deinitialized unconditionally.  That led to segmentation faults.
Convert mod_initMikMod() to be the global module initialization
method.  The MPD core should care about lazy initialization.
2008-11-03 07:30:42 +01:00
Max Kellermann
79d70f124d output: don't allow length==0
Nobody should call playAudio() with an empty chunk.  Add some
assertions on that.
2008-11-02 20:16:56 +01:00
Max Kellermann
cc164cc884 player: don't play empty chunks
An empty chunk may happen when it only contains a tag, but no PCM
data.  Don't call playAudio() then.
2008-11-02 20:14:55 +01:00
Max Kellermann
e5137706d1 ffmpeg: fix boolean inversion in ffmpeg_tag()
ffmpeg_tag() deleted the tag when ffmpeg_helper() returned success.
The return value was interpreted incorrectly, it should return the tag
on success.
2008-11-02 17:32:40 +01:00
Max Kellermann
1e0acb2e1a removed unused sources
Cleaning up artifacts from a merge gone wrong.  Also remove the
ringbuf library, which is not being used.
2008-11-02 17:16:07 +01:00
Max Kellermann
fb233df7a9 player: copy stream tag to the song struct
Non-local songs used to have no tags.  If the decoder sends us a tag,
we should incorporate it into the song struct.  This way, clients can
always show the correct song name (if provided by the server).
2008-11-02 17:13:26 +01:00
Max Kellermann
7e7704e42b player: added player.song
Always remember which song is currently being sent to the audio
device.
2008-11-02 17:10:26 +01:00
Max Kellermann
accc82cd6c ffmpeg: don't rewind stream in url_close()
Rewinding the stream here is not useful, but may consume valuable
resources (and time).
2008-11-02 17:10:12 +01:00
Max Kellermann
2124df1390 decoder: rewind input stream after try_decode()
The try_decode() method may have read some data from the stream, which
is now lost.  To make this data available to other methods, get it
back by rewinding the input stream after each try_decode() invocation.

The ogg and wavpack plugins did this manually and inconsistently; this
code can now be removed.
2008-11-02 17:10:02 +01:00
Max Kellermann
395aa4e847 decoder: moved code to decoder_try_decode() 2008-11-02 17:07:39 +01:00
Max Kellermann
5183d85886 player: send chunk tag to audio device
If a chunk contains a tag, send it to the audio output device.  Few
output plugins support this, e.g. shout has support for sending tags.
2008-11-02 17:07:31 +01:00
Max Kellermann
aa9b31f1cf crossfade: copy tag
If the source chunk has a tag, merge it into the destination chunk.
The source chunk gets deleted after that, and this is our last chance
to grab the tag.
2008-11-02 17:07:13 +01:00
Max Kellermann
0f80428fda ffmpeg: use decoder_read() wrapper instead of direct input_stream_read()
decoder_read() checks the decoder command.  Without this patch, the
ffmpeg plugin could become unresponsive.
2008-11-02 17:06:53 +01:00
Max Kellermann
4d069b4991 ogg, ffmpeg: try to decode, even when the stream is not seekable
Ogg and ffmpeg detection was disabled when the stream was not
seekable, because the detection was too expensive.  Since the curl
input stream can now rewind the stream cheaply, we can re-enable
detection on streams.
2008-11-02 17:06:32 +01:00
Max Kellermann
460b15d29c input_curl: buffered rewinding
During codec detection, the beginning of the stream is consumed.  This
is a common operation, which takes a lot of time when handling remote
resources.  To optimize this, remember the first 64 kB of a stream.
This way, we can rewind the stream without actually fetching the start
of the stream again.
2008-11-02 17:06:15 +01:00
Max Kellermann
020c04e702 decoder_api: added decoder_tag()
Provide an API for submitting additional tags from the stream.
2008-11-02 17:02:28 +01:00
Max Kellermann
5b13f067cd aac, mod: moved decoder command check into loop condition
Avoid while(true) loops, and convert them to a loop with a proper
condition.
2008-11-02 17:02:23 +01:00
Max Kellermann
3f6fcfd38e aac, mod: don't check for SEEK command
Since the aac and mod plugins have told MPD that they cannot seek, MPD
will never send a SEEK command to them.  Removed the SEEK comand
checks from both plugins.
2008-11-02 17:02:00 +01:00
Max Kellermann
c9e15bc418 decoder_api: pass "seekable" flag to decoder_initialized()
Don't pass the "seekable" flag with every decoder_data() invocation.
Since that flag won't change within the file, it is enough to pass it
to decoder_initialized() once per file.
2008-11-02 17:01:51 +01:00
Max Kellermann
c7a374bdcb music_pipe: add tag pointer to the music_chunk struct
Each music chunk can now carry a tag object.  Decoder plugins which
support it (e.g. oggvorbis) may use this to inject decoded tags into
their output.
2008-11-02 17:01:00 +01:00
Max Kellermann
fcc11bc9d8 music_pipe: added functions chunk_init() and chunk_free()
These two functions will care about memory allocation and deallocation
in the future.
2008-11-02 16:58:49 +01:00
Max Kellermann
85b6ff7b59 music_pipe: document struct music_chunk
Add doxygen compatible comments.
2008-11-02 16:58:45 +01:00
Max Kellermann
b42dad9b05 music_pipe: removed "volatile"
The "volatile" keyword doesn't help here, because we have proper
memory barriers, but it disables some optimizations.  Remove it.
2008-11-02 16:58:42 +01:00
Max Kellermann
39bf84aa9f music_pipe: renamed "size" to "num_chunks"
The name "num_chunks" expresses the meaning of the variable better.
2008-11-02 16:57:37 +01:00
Max Kellermann
5347cca29d music_pipe: no CamelCase
Rename all variables and struct members.
2008-11-02 16:57:16 +01:00
Max Kellermann
8490c1b4cf music_pipe: set bit_rate and time in music_pipe_append()
Don't bother to pass these values as parameters to tail_chunk().
2008-11-02 16:57:15 +01:00
Max Kellermann
cd61f6570f music_pipe: moved code to music_chunk_append() 2008-11-02 16:56:49 +01:00
Max Kellermann
e9e9d2bc2d music_pipe: renamed "ob" to "music_pipe"
Last music_pipe rename patch: renamed the global variable (singleton).
2008-11-02 16:56:09 +01:00
Max Kellermann
d430b1dc54 music_pipe: more wrapper functions
Replace all direct music_pipe struct accesses with wrapper functions.
The compiled machine code is the same, but this way, we can change
struct internals more easily.
2008-11-02 16:55:53 +01:00
Max Kellermann
260a0cc33c music_pipe: use GLib instead of utils.h
Eliminate the deprecated utils.h memory allocation functions.
2008-11-02 16:55:48 +01:00
Max Kellermann
8b1f6ff3c8 decoder: replaced music_pipe.audioFormat with dc.out_audio_format
.. and rename dc.audioFormat to dc.in_audio_format.  The music pipe
does not need to know the audio format, and its former "audioFormat"
property indicated the format of the most recently added chunk, which
might be confusing when you are reading the oldest chunks.
2008-11-02 16:55:43 +01:00
Max Kellermann
30fca5e5a9 music_pipe: pass frame size to tail_chunk()
Don't make tail_chunk() calculate the frame size again.
2008-11-02 14:18:34 +01:00
Max Kellermann
fd0f195bb7 music_pipe: renamed ob_* functions to music_pipe_*
Rename all functions to the new prefix.
2008-11-02 14:18:34 +01:00
Max Kellermann
8964c69a64 music_pipe: renamed struct output_buffer to struct music_pipe
.. and rename ob_chunk to struct music_chunk.
2008-11-02 14:15:47 +01:00