Commit Graph

2644 Commits

Author SHA1 Message Date
Enrico Weigelt
30cd345581 fixing several imports to work via pkg-config
This patch fixes several imports to use pkg-config instead of certain
esoteric tests.
2008-10-15 20:39:46 +02:00
Max Kellermann
047043d2a8 locate: use g_utf8_casefold() instead of string_toupper()
string_toupper() and strDupToUpper() were not able to deal with
character sets other than US-ASCII.  Use GLib's g_utf8_casefold()
for strings.
2008-10-15 19:36:37 +02:00
Max Kellermann
7366191f0d mapper: moved musicDir initialization from path.c
Moved the musicDir variable and its initialization code from path.c to
mapper.c.
2008-10-15 19:36:33 +02:00
Max Kellermann
76779f0fbe path: allow starting MPD with non-existing music directory
When the music directory is not mounted yet, let MPD start anyway.
2008-10-15 19:36:31 +02:00
Max Kellermann
8746a58ab9 path, tag_id3: use g_convert() instead of charConv.c
GLib provides an easier API for character set conversion than iconv().
Use g_convert() / g_convert_with_fallback() for all character
conversions.  We should optimize the path.h API later to return a
newly allocated buffer, so we can just pass GLib's return value.
2008-10-15 19:36:30 +02:00
Max Kellermann
e89599eaad use GLib
GLib is a nice and portable utility library.  We are going to use it
from now on, and eliminate a lot of duplicated code from MPD.  Why
invent the wheel again and again?
2008-10-15 19:35:04 +02:00
Max Kellermann
2a47e90cf5 tag_id3: fix indentation
Indentation was broken in tag_id3.c: it used 4 spaces instead of tabs.
2008-10-15 19:29:46 +02:00
Max Kellermann
cf7ed8c5df idle: client command "noidle" aborts idle 2008-10-15 18:21:57 +02:00
Max Kellermann
6eb62e4761 client: optimized client_input_received()
Use memchr() instead of manually traversing the input buffer.  Update
the client's properties after all commands have been processed.  Check
for buffer overflow once.
2008-10-15 18:21:45 +02:00
Max Kellermann
0031eaaff5 pulse: clarify the meaning of multiple server names
The manual page suggests that you can specify multiple servers, but it
did not clarify what that means.
2008-10-15 07:49:32 +02:00
Max Kellermann
62ee702877 listen: pass protocol family to establishListen()
The caller already knows the protocol family, and we can eliminate the
complicated switch statement in establishListen() if we just pass this
information.  This seems more robust.
2008-10-15 07:30:24 +02:00
Max Kellermann
ba594cfec0 listen: use getaddrinfo() instead of gethostbyname()
getaddrinfo() is more robust and has proper IPv6 support.  The new
code tries to bind to all IP addresses returned by getaddrinfo().
2008-10-15 07:20:53 +02:00
Max Kellermann
a3e3d2c950 command: added command "idle"
"idle" waits until something noteworthy happens on the server,
e.g. song change, playlist modified, database updated.  This allows
clients to keep up to date without polling.
2008-10-14 22:38:14 +02:00
Max Kellermann
30c86d8ae6 alsa: added #ifdefs around SND_PCM_NO_AUTO_xxx
These macros are not available in older libasound versions (1.0.13
fails, 1.0.16 is ok).  Ignore the configuration if the constants are
not defined.
2008-10-14 22:37:27 +02:00
Richard Brown
50e038d1ef Makefile.am: don't override $(docdir)
Makefile.am sets docdir = $(prefix)/share/doc/$(PACKAGE). This
overrides the setting specified in ./configure --docdir.
2008-10-14 18:32:46 +02:00
Max Kellermann
da1c0cd6d7 playlist: don't use uninitialized local variable (typo)
Instead of the uninitialized local variable "s", I should have used
"uri".
2008-10-14 17:23:24 +02:00
Max Kellermann
df5f16b54e configure.ac: enable unix socket support by default 2008-10-14 17:23:14 +02:00
Max Kellermann
50ecbec3de configure.ac: removed deprecated checks
Removed some configure checks which aren't used anymore since we use
C99.
2008-10-14 17:23:11 +02:00
Max Kellermann
731c629c6a configure.ac: disabled the C++ and fortran checks
Why check for C++ and fortran compilers?  This hack was borrowed from
Qball's gmpc git repository.
2008-10-14 17:23:06 +02:00
Max Kellermann
e9ed10de3a configure.ac: added --enable-debug, --enable-werror, --enable-profile
Add more configure options which control how MPD is compiled.
--enable-debug is always enabled, until there is a stable release.
2008-10-14 17:23:00 +02:00
Max Kellermann
b0c1cf7590 configure.ac: enable -pedantic
Yet another gcc flag which gives us lots of interesting warnings.
2008-10-14 17:21:58 +02:00
Max Kellermann
c4a43f8a9d oss: use unsigned integer for ioctl constants
The OSS constants overflow a signed integer, use unsigned instead.
2008-10-14 17:21:57 +02:00
Max Kellermann
f01a08d5c2 oss: convert several macros to enum
C enums are nicer than CPP macros.
2008-10-14 17:21:53 +02:00
Max Kellermann
37b69759da configure.ac: moved CFLAGS checks down
Some warning flags may cause errors during library detection code.  Do
the CFLAGS checks at the end.
2008-10-14 17:21:51 +02:00
Max Kellermann
86782faa18 alsa: optionally disable resampling and others
Added mpd.conf options for disabling automatic resamling, sample
format and channel conversion.  This way, users may choose to override
ALSA's automatic resampling, and use libsamplerate instead.
2008-10-14 17:21:49 +02:00
Max Kellermann
79a1811c11 shout: fix manual page typo
A ".TP" was missing, and broke the manual page's layout.
2008-10-14 17:21:47 +02:00
Max Kellermann
ba892cbcb0 changed package name to "mpd-mk", updated version number
This git branch has become a real MPD fork now.  Time to change the
package name to the code name "mpd-mk".  Set the version number to
"0.14~git" to mark this as a non-released version.
2008-10-14 17:21:27 +02:00
Max Kellermann
197caee151 update: don't follow relative symlinks
Don't follow relative symlinks which point into the music directory.
This allows you to organize music with symbolic links, without MPD
managing separate copies of each song.
2008-10-14 11:10:54 +02:00
Max Kellermann
f521c12d20 ls: removed myStat(), isFile(), isDir()
The mapper code has replaced these functions.
2008-10-14 11:10:51 +02:00
Max Kellermann
5b71d5f6f7 mapper: new song-to-filesystem mapper library
The mapper library maps directory and song objects to file system
paths.  With this central library, the code mixture in path.c should
be cleaned up, and we will be able to add neat features like aliasing.
2008-10-14 11:10:49 +02:00
Max Kellermann
a52a9fc1fc playlist: moved code to playlist_save.c
playlist_print_song() and playlist_print_uri() handle charset
conversion and (optional) music directory prefixing.
2008-10-14 11:10:47 +02:00
Max Kellermann
308bc230b2 song: pass const song pointer to song_get_url()
song_get_url() doesn't modify the song object.
2008-10-14 11:10:44 +02:00
Eric Wong
06c8a9ed0b {dir,song}vec: fix off-by-one errors in {dir,song}vec_delete
Found by Valgrind while looking for another bug...

Hmm.. I should really just make this code generic since
they're duplicated...
2008-10-14 11:10:00 +02:00
Max Kellermann
f71ac4d479 song: stat file in song_file_update(), don't use isMusic()
isMusic() used to be a very inefficient function: with every
invocation, it did another stat() on the specified file.  There is
only one caller, do the stat() there manually and use hasMusicSuffix()
instead of isMusic().
2008-10-13 16:56:00 +02:00
Max Kellermann
94a5a5a985 update: always look up parent directory in updatePath()
By always creating the parent directory, we can use delete_name_in()
without further lookups.  The parents which may non exist will be
pruned later.  An update request for a non-existing or empty directory
should be quite unusual, so this doesn't add any measurable overhead.
2008-10-13 16:55:55 +02:00
Max Kellermann
a52343732b update: pass base file name to updateInDirectory()
In order to optimize buffer usage, pass only the base file name to
updateInDirectory().  This way, updateInDirectory() may choose when to
allocate a larger buffer for the full path.
2008-10-13 16:55:54 +02:00
Max Kellermann
270a6ebd69 update: moved code to make_subdir() 2008-10-13 16:46:51 +02:00
Max Kellermann
3e9ed15e76 update: added delete_name_in()
delete_name_in() is similar to delete_path(), but it does not need to
look up the parent directory.
2008-10-13 16:46:32 +02:00
Max Kellermann
69617438a9 dirvec: dirvec_find() compares basename
It is invalid to pass a path with the wrong dirname to dirvec_find().
To be able to find a subdirectory only by its basename, compare only
the basename of both paths.
2008-10-13 16:33:04 +02:00
Max Kellermann
3b6ff84393 directory: added directory_get_name()
directory_get_name() returns the base name of the directory.
2008-10-13 16:32:39 +02:00
Max Kellermann
bc85e92a72 playlist: don't use isPlaylist() in deletePlaylist()
The only caller of deletePlaylist() appends PLAYLIST_FILE_SUFFIX, so
we can be sure it's already there.  We don't need to stat the file,
since unlink() does all the checking.
2008-10-13 16:30:44 +02:00
Max Kellermann
07c9b62764 audio: don't clear input_audio_format on openAudioDevice(NULL)
Commit 80a2c937 broke resume after pause: it cleared the
input_audio_format when it attempted to simplify a complicated
expression.  Don't clear it, just assign input_audio_format if a new
format was specified.
2008-10-13 14:31:18 +02:00
Max Kellermann
5ea2e198f9 directory: pass const pointers to inline functions
The inline functions directory_is_empty() and directory_get_path()
don't modify the object - pass constant object pointers to them.
2008-10-13 09:56:57 +02:00
Eric Wong
313405edb6 songvec: avoid holding nr_lock during free(3)
We only need to lock sv->nr changes to prevent traversals ( why
it's called "nr_lock").  free(3) is a "slow" function on my
system; so we can avoid unnecessarily holding a lock long for
longer than needed.
2008-10-13 09:55:07 +02:00
Eric Wong
3035a3303d update: allow music_root updates to be queued
Previously only updates with subdirectories being
specified could be queued.  No harm in queueing
full updates.
2008-10-13 09:55:03 +02:00
Eric Wong
8d907fb9fa directory: use mpd_sizeof_str_flex_array for path, too
This way we avoid unnecessary heap allocations.
2008-10-13 09:55:00 +02:00
Eric Wong
8867bd554c tag_item: avoid wasting space when struct is unpackable
Not all compilers support struct packing, and those that don't
shouldn't be punished for it.
2008-10-13 09:40:14 +02:00
Eric Wong
c641aabe33 song: song_get_url: fix "/" prefix for songs in music_root 2008-10-13 09:39:02 +02:00
Aaron McEwan
2139d8bba8 shout: make the protocol configurable
Added configuration parameter "protocol" which lets the user choose
from 3 shout protocols.  This adds support for real shoutcast servers.
2008-10-12 12:14:51 +02:00
Max Kellermann
ff69f12259 shout: use strcmp() instead of strncasecmp()
Case insensitivity isn't helpful, and comparing only the first 3 bytes
of a configured value may encourage users to supply wrong or
misleading values.
2008-10-12 12:13:27 +02:00