Commit Graph

2458 Commits

Author SHA1 Message Date
Max Kellermann 9b5ce27c3b configure.ac: check if "struct ucred" is available
By default, glibc 2.8 hides struct ucred behind the _GNU_SOURCE
macro.  I don't want to enable that globally, because it may encourage
the use of non-portable functions.  Test if "struct ucred" is
available, and enable _GNU_SOURCE if required.

For details about that issue, see glib's bug database:

 http://sources.redhat.com/bugzilla/show_bug.cgi?id=6545
2008-10-16 14:59:26 +02:00
Max Kellermann 3b20fa4f3f configure.ac: reformatted AC_ARG_ENABLE section
Make the configure.ac script more readable by wrapping lines and using
proper indentation.
2008-10-16 08:40:55 +02:00
Max Kellermann b53365949a configure.ac: find more libraries with pkg-config
Detect the following libraries with pkg-config: libshout, libid3tag,
libmad.
2008-10-16 08:33:29 +02:00
Max Kellermann da83f2bbe7 configure.ac: removed iconv option
We're using GLib's character set conversion functions instead of iconv
now.
2008-10-16 08:31:21 +02:00
Max Kellermann beec15ddaa command: special case for "add /"
The undocumented command "add /" adds the full music database to the
playlist.  Don't interpret this special path as a local file path.
2008-10-16 07:40:34 +02:00
Max Kellermann f9222fdabe playlist: also allow world-readable local files
Allow a local user to not only add his own files, but also all
world-readable files (mode 0444).
2008-10-15 23:10:05 +02:00
Max Kellermann f1ab4d2c1b song: check file type in song_file_update()
Don't load non-regular files.
2008-10-15 22:43:24 +02:00
Max Kellermann 8c0060fae4 playlist: added support for adding songs not in the music database
Clients which have authenticated via unix socket may add local files
to the MPD playlist, provided that they own the file.
2008-10-15 22:35:13 +02:00
Max Kellermann 0b44cad2ce command: print error message on "addid" failure
Returning the playlist_result value from a command handler does not
make sense.  Call print_playlist_result() there, and forward its
return value.
2008-10-15 22:35:04 +02:00
Max Kellermann 961a349f15 playlist: moved code to song_by_url()
Replace some complicated checks from addToPlaylist() to the simpler
function song_by_url().
2008-10-15 22:35:00 +02:00
Max Kellermann 6d3488c8b3 song: added song_in_database()
Some functions assume that a song is not in the database when it is a
remote song.  Based on that, they decide whether they are responsible
for freeing the song struct.  Add a special function which checks
whether a song is in the database (currently equal to song_is_file()).
2008-10-15 22:34:47 +02:00
Max Kellermann 4a7ad5b618 listen, client: enable SO_PASSCRED, get client's uid
Enable authentication over unix sockets.  Store the client's uid in
the client struct.
2008-10-15 22:34:21 +02:00
Max Kellermann fa56ff3d52 update: don't skip hidden files
Skip only the special directory entries "." and "..", don't skip all
other "hidden" files.
2008-10-15 20:51:01 +02:00
Max Kellermann 92513c3309 shout: check for vorbisenc library
The switch from ogg.m4 to pkg-config intentionally disabled
libvorbisenc.  Enable it when shout_ogg is used.
2008-10-15 20:40:04 +02:00
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