Max Kellermann
a9bd64b1dd
update: splitted reap_update_task()
...
Handle the DELETE and UPDATE events in separate callbacks:
song_delete_event() safely deletes a song, and update_finished_event()
is called when database update is complete.
2009-01-04 20:30:23 +01:00
Max Kellermann
5e6ac50583
initialize GError pointers
...
GLib mandates that you initialize all GError objects with NULL prior
to passing it.
2009-01-04 19:51:54 +01:00
Max Kellermann
530f0b71de
path, tag: don't allocate GError for charset conversion
...
Pass NULL instead of &error to g_convert(). We're not interested in
the error object.
2009-01-04 19:50:22 +01:00
Max Kellermann
da69382273
path: removed pfx_dir()
...
Use GLib's g_build_filename() instead of pfx_dir().
2009-01-04 19:37:19 +01:00
Viliam Mateicka
1a04e57168
renaming mixer.h to mixer_api.h
2009-01-04 19:15:18 +01:00
Max Kellermann
fed719197c
song: allocate the result of song_get_url()
2009-01-04 19:09:34 +01:00
Max Kellermann
ea8ae68e6f
directory: added directory_is_root()
...
directory_is_root() is cheaper than
isRootDirectory(directory_get_path()).
2009-01-04 19:08:52 +01:00
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