aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile.am (follow)
Commit message (Collapse)AuthorAgeFilesLines
* diretory: moved code to directory_save.c, directory_print.cMax Kellermann2008-10-111-0/+4
| | | | | | Remove clutter from directory.c. Everything which saves or loads to/from the hard disk goes to directory_save.c, and code which sends directory information to the client is moved into directory_print.c.
* directory: moved code to database.cMax Kellermann2008-10-111-0/+2
| | | | | | Taming the directory.c monster, part II: move the database management stuff to database. directory.c should only contain code which works on directory objects.
* directory: moved code to update.cMax Kellermann2008-10-111-0/+2
| | | | | | The source directory.c mixes several libraries: directory object management, database management and database update, resulting in a 1000+ line monster. Move the whole database update code to update.c.
* dirvec: moved code to dirvec.cMax Kellermann2008-10-111-0/+1
| | | | | | | | Having all functions as static (non-inline) functions generates GCC warnings, and duplicates binary code across several object files. Most of dirvec's methods are too complex for becoming inline functions. Move them all to dirvec.c and publish the prototypes in dirvec.h.
* autotools: tidy up make distEric Wong2008-10-051-0/+2
| | | | | | | | * Add missing headers in Makefile.am * remove mp4ff.dsp (Win32 crap) * Add scripts, m4, bs, autogen.sh to allow for hotfixes by the SCM-challenged. (downloading the source via git is NOT a lightweight operation for everybody).
* directory: replace DirectoryList with dirvecEric Wong2008-09-281-0/+1
| | | | | Small memory reduction compared to songvec since most users have much fewer dirs than songs, but still nice to have.
* Replace SongList with struct songvecEric Wong2008-09-201-0/+2
| | | | | | | Our linked-list implementation is wasteful and the SongList isn't modified enough to benefit from being a linked list. So use a more compact array of song pointers which saves ~200K on a library with ~9K songs (on x86-32).
* Merge branch 'mk/client'Eric Wong2008-09-091-2/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * mk/client: (24 commits) client: reorder function declarations client: check "expired" after command execution client: added global "expired" flag client: removed superfluous assertion client: more assertions client: moved code to sockaddr_to_tmp_string() client: replace "expired" flag with fd==-1 client: moved "expired" accesses into inline function client: no while loop in client_manager_io() client: select() errors are fatal client: use client_defer_output() in client_write() client: moved code to client_write() client: client_defer_output() can create the first defer buffer client: return early on error in client_defer_output() client: moved code to client_defer_output() client: don't free client resources except in client_close() client: allocate clients dynamically client: added function client_by_fd() client: return early in client_new() client: renamed all public functions ...
| * renamed interface.c to client.cMax Kellermann2008-09-011-2/+2
| | | | | | | | | | | | | | I don't believe "interface" is a good name for something like "connection by a client to MPD", let's call it "client". This is the first patch in the series which changes the name, beginning with the file name.
| * imported list.h from the Linux kernel sourcesMax Kellermann2008-09-011-0/+1
| | | | | | | | | | | | | | linux/list.h is a nice doubly linked list library - it is lightweight and powerful at the same time. It will be useful later, when we begin to allocate client structures dynamically. Import it, and strip out all the stuff which we are not going to use.
* | use strset.h instead of tagTracker.hMax Kellermann2008-09-091-2/+0
| | | | | | | | | | | | | | With a large music database, the linear string collection in tagTracker.c becomes very slow. We implemented that in a quick'n'dirty fashion when we removed tree.c, and now we rewrite it using the fast hashed string set.
* | added string set libraryMax Kellermann2008-09-091-0/+2
| | | | | | | | | | | | | | | | "struct strset" is a hashed string set: you can add strings to this library, and it stores them as a set of unique strings. You can get the size of the set, and you can enumerate through all values. This will be used to replace the linear tagTracker library.
* | tag: added a pool for tag itemsMax Kellermann2008-09-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new source tag_pool.c manages a pool of reference counted tag_item objects. This is used to merge tag items of the same type and value, saving lots of memory. Formerly, only the value itself was pooled, wasting memory for all the pointers and tag_item structs. The following results were measured with massif. Started MPD on amd64, typed "mpc", no song being played. My music database contains 35k tagged songs. The results are what massif reports as "peak". 0.13.2: total 14,131,392; useful 11,408,972; extra 2,722,420 eric: total 18,370,696; useful 15,648,182; extra 2,722,514 mk f34f694: total 15,833,952; useful 13,111,470; extra 2,722,482 mk now: total 12,837,632; useful 10,626,383; extra 2,211,249 This patch set saves 20% memory, and does a good job in reducing heap fragmentation.
* | removed tree.cMax Kellermann2008-09-021-2/+0
| | | | | | | | | | | | | | | | | | This patch makes MPD consume much more memory because string pooling is disabled, but it prepares the next bunch of patches. Replace the code in tagTracker.c with naive algorithms without the tree code. For now, this should do; later we should find better algorithms, especially for getNumberOfTagItems(), which has become wasteful with temporary memory.
* | tag: moved code to tag_id3.cMax Kellermann2008-09-021-0/+2
|/ | | | | The ID3 code uses only the public tag API, but is otherwise unrelated. Move it to a separate source file.
* Reimplement dynamic metadata handlingEric Wong2008-08-261-0/+2
| | | | | | | | | | | | This has been tested for both playback of streams and outputting to streams, and seems to work fine with minimal locking. This reuses the sequence number infrastructure in OutputBuffer for synchronizing metadata payloads; so (IMNSHO) should be much more understandable than various flags being set here and there.. It could still use some cleanup and much testing, but synchronization issues should be minimal.
* fix output buffer deadlock when daemonizingEric Wong2008-08-191-2/+1
| | | | | | | | | | | We spawned the output buffer thread before daemonizing in initPlayerData(), which is ultra bad because daemonizes forks and threads are not preserved on exit. Since playerData has been stripped bare by this core-rewrite anyways, move this code into the outputBuffer_* group and drop playerData.[ch] completely I completely forgot to test this :<
* core rewrite (decode,player,outputBuffer,playlist)Eric Wong2008-08-161-4/+7
| | | | | | | | | | | | | This is a huge refactoring of the core mpd process. The queueing/buffering mechanism is heavily reworked. The player.c code has been merged into outputBuffer (the actual ring buffering logic is handled by ringbuf.c); and decode.c actually handles decoding stuff. The end result is several hundreds of lines shorter, even though we still have a lot of DEBUG statements left in there for tracing and a lot of assertions, too.
* introduce struct condition as a more correct version of NotifyEric Wong2008-06-301-0/+2
| | | | | Start using it in the HTTP code git-svn-id: https://svn.musicpd.org/mpd/trunk@7395 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* http: split out auth code since it's mostly uninteresting for nowEric Wong2008-06-301-0/+1
| | | | | | The auth code also has some ugly usages of string generation which I will eventually replace with something nicer... git-svn-id: https://svn.musicpd.org/mpd/trunk@7387 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add a generic ring buffer implementationEric Wong2008-06-301-0/+2
| | | | | | | | | | | | | | | | This piece of code is from the JACK Audio Connection Kit (trimmed down a bit for better readability). The vector functions now reuse the common iovec struct used by writev/readv instead of reinventing an identical but differently-named struct. From the comments: > ISO/POSIX C version of Paul Davis's lock free ringbuffer C++ code. > This is safe for the case of one read thread and one write thread. License is LGPL 2.1 or later git-svn-id: https://svn.musicpd.org/mpd/trunk@7386 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix the problem of songs not advancing without client activityEric Wong2008-04-121-0/+2
| | | | | | | | | | | | | The select() in the main event loop blocks now (saving us many unnecessary wakeups). This interacted badly with the threads that were trying to wakeup the main task via pthread_cond_signal() since the main task was not blocked on a condition variable, but on select(). So now if we detect a need to wakeup the player, we write to a pipe which select() is watching instead of blindly calling pthread_cond_signal(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Drop metadata updates from HTTP for now (input HTTP, and shout)Eric Wong2008-04-121-2/+0
| | | | | | | | It is way more complicated than it should be; and locking it for thread-safety is too difficult. [merged r7183 from branches/ew] git-svn-id: https://svn.musicpd.org/mpd/trunk@7241 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* include os_compat.h in tarball distributionsEric Wong2008-03-301-0/+1
| | | | | Thanks to Jérome Perrin git-svn-id: https://svn.musicpd.org/mpd/trunk@7224 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* notify the decoder instead of polling 100hzMax Kellermann2008-03-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the decoder process is faster than the player process, all decodedd buffers are full at some point in time. The decoder has to wait for buffers to become free (finished playing). It used to do this by polling the buffer status 100 times a second. This generates a lot of unnecessary CPU wakeups. This patch adds a way for the player process to notify the decoder process that it may continue its work. We could use pthread_cond for that, unfortunately inter-process mutexes/conds are not supported by some kernels (Linux), so we cannot use this light-weight method until mpd moves to using threads instead of processes. The other method would be semaphores, which historically are global resources with a unique name; this historic API is cumbersome, and I wanted to avoid it. I came up with a quite naive solution for now: I create an anonymous pipe with pipe(), and the decoder process reads on that pipe. Until the player process sends data on it as a signal, the decoder process blocks. This can be optimized in a number of ways: - if the decoder process is still working (instead of waiting for buffers), we could save the write() system call, since there is nobody waiting for the notification. [ew: I tried this using a counter in shared memory, didn't help] - the pipe buffer will be full at some point, when the decoder thread is too slow. For this reason, the writer side of the pipe is non-blocking, and mpd can ignore the resulting EWOULDBLOCK. - since we have shared memory, we could check whether somebody is actually waiting without a context switch, and we could just not write the notification byte. [ew: tried same method/result as first point above] - if there is already a notification in the pipe, we could also not write another one. [ew: tried same method/result as first/third points above] - the decoder will only consume 64 bytes at a time. If the pipe buffer is full, this will result in a lot of read() invocations. This does not hurt badly, but on a heavily loaded system, this might add a little bit more load. The preceding optimizations however are able eliminate the this. - finally, we should use another method for inter process notifications - maybe kill() or just make mpd use threads, finally. In spite of all these possibilities to optimize this code further, this pipe notification trick is faster than the 100 Hz poll. On my machine, it reduced the number of wakeups to less than 30%. git-svn-id: https://svn.musicpd.org/mpd/trunk@7215 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleanup checking for tests in src/ when building in separate dirEric Wong2008-01-261-1/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7147 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* ioops: make this zero-impact when compiling w/o zeroconf as wellEric Wong2008-01-031-0/+1
| | | | | | | This reduces the text size of the binary slightly when zeroconf support is not built, and keeps the interface code cleaner as well. git-svn-id: https://svn.musicpd.org/mpd/trunk@7133 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Merge branches/ew r7104Eric Wong2007-12-281-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | thread-safety work in preparation for rewrite to use pthreads Expect no regressions against trunk (r7078), possibly minor performance improvements in update (due to fewer heap allocations), but increased stack usage. Applied the following patches: * maxpath_str for reentrancy (temporary fix, reverted) * path: start working on thread-safe variants of these methods * Re-entrancy work on path/character-set conversions * directory.c: exploreDirectory() use reentrant functions here * directory/update: more use of reentrant functions + cleanups * string_toupper: a strdup-less version of strDupToUpper * get_song_url: a static-variable-free version of getSongUrl() * Use reentrant/thread-safe get_song_url everywhere * replace rmp2amp with the reentrant version, rmp2amp_r * Get rid of the non-reentrant/non-thread-safe rpp2app, too. * buffer2array: assert strdup() returns a usable value in unit tests * replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants * fix storing playlists w/o absolute paths * parent_path(), a reentrant version of parentPath() * parentPath => parent_path for reentrancy and thread-safety * allow "make test" to automatically run embedded unit tests * remove convStrDup() and maxpath_str() * use MPD_PATH_MAX everywhere instead of MAXPATHLEN * path: get rid of appendSlash, pfx_path and just use pfx_dir * get_song_url: fix the ability to play songs in the top-level music_directory git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding WavPack support. Patch courtesy Kodest.J. Alexander Treuman2007-06-241-1/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6651 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding FIFO audio output. This is pretty much identical to the old one,J. Alexander Treuman2007-06-131-1/+2
| | | | | except that it now uses a timer for throttling. git-svn-id: https://svn.musicpd.org/mpd/trunk@6621 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Move the timing code from the null plugin to timer.c, so it can be easilyJ. Alexander Treuman2007-05-301-2/+4
| | | | | used in other plugins (fifo, shout, etc.). git-svn-id: https://svn.musicpd.org/mpd/trunk@6397 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding a null output plugin.J. Alexander Treuman2007-05-301-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6393 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding ioops.h to mpd_headers so that it gets included in the tarball.J. Alexander Treuman2007-05-281-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6323 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Committing pat's rewrite of the stored playlist code. This also adds twoJ. Alexander Treuman2007-05-161-2/+4
| | | | | new commands: playlistmove and playlistdelete. git-svn-id: https://svn.musicpd.org/mpd/trunk@6116 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Moving a bunch of the LocateTagItem code to locate.[ch] so that it canJ. Alexander Treuman2007-02-241-2/+4
| | | | | later be used for playlist searching. git-svn-id: https://svn.musicpd.org/mpd/trunk@5419 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Reverting all of my localization changes. It was a horribleJ. Alexander Treuman2007-02-181-2/+0
| | | | | | implementation, and fixing it is a big enough job that I don't know when I'll get around to it. Probably best just starting from scratch anyhow. git-svn-id: https://svn.musicpd.org/mpd/trunk@5373 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Added zeroconf service publishing using avahiJim Ramsay2007-01-111-2/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5238 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Moving localization stuff from path.c to localization.c so we can reuse itJ. Alexander Treuman2007-01-081-2/+4
| | | | | for log messages when outputting to console. git-svn-id: https://svn.musicpd.org/mpd/trunk@5225 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* jack patch from anarch (and some type fixes for mp4 and acc plugins)Warren Dukes2006-10-181-1/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4912 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* merge changes from mpd-tree:Warren Dukes2006-08-061-0/+2
| | | | | | -use tree for tagTracker -eliminate the master process git-svn-id: https://svn.musicpd.org/mpd/trunk@4571 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Standardize state_file handling routines.Eric Wong2006-07-301-0/+2
| | | | | This way it's easier to manage and extend. git-svn-id: https://svn.musicpd.org/mpd/trunk@4494 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* interface/connection malloc reductions from mpd-keEric Wong2006-07-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch massively reduces the amount of heap allocations at the interface/command layer. Most commands with minimal output should not allocate memory from the heap at all. Things like repeatedly polling status, currentsong, and volume changes should be faster as a result, and more importantly, not a source of memory fragmentation. These changes should be safe in that there's no way for a remote-client to corrupt memory or otherwise do bad stuff to MPD, but an extra set of eyes to review would be good. Of course there's never any warranty :) No longer do we use FILE * structures in the interface, which means we don't have to allocate any new memory for most connections. Now, before you go on about losing the buffering that FILE * +implies+, remember that myfprintf() never took advantage of any of the stdio buffering features. To reduce the diff and make bugs easier to spot in the diff, I've kept myfprintf in places where we write to files (and not network interfaces). Expect myfprintf to go away entirely soon (we'll use fprintf for writing regular files). git-svn-id: https://svn.musicpd.org/mpd/trunk@4483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Use AudioCompress for volume normalizationJ. Alexander Treuman2006-07-271-0/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4474 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Remove the fifo plugin. It's currently useless for the average user, and ↵J. Alexander Treuman2006-07-261-1/+0
| | | | | making it more presentable isn't something I'm willing to do before 0.12. It will likely be added back after 0.12, along with some very experimental stuff to make it more usable. git-svn-id: https://svn.musicpd.org/mpd/trunk@4472 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Put mp4ff back into the treeAvuton Olrich2006-07-261-1/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4461 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleanup some now unnecessary variables from the id3/mad removalEric Wong2006-07-221-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4431 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding on the fly volume normalization support. Code originally from ↵J. Alexander Treuman2006-07-221-0/+2
| | | | | mplayer, ported by syscrash, cleaned up by avuton, and further cleaned up by me (jat). git-svn-id: https://svn.musicpd.org/mpd/trunk@4424 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding fifo output pluginJ. Alexander Treuman2006-07-221-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4423 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Remove the internal mp4ff dependencyAvuton Olrich2006-07-191-4/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4401 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add sparse-check target to makefilesEric Wong2006-07-171-0/+11
| | | | | | | | | sparse is a semantic parser developed for the Linux kernel, but works for any project written (ANSI) C. You can get sparse via git here: git clone git://www.kernel.org/pub/scm/devel/sparse/sparse.git git-svn-id: https://svn.musicpd.org/mpd/trunk@4377 09075e82-0dd4-0310-85a5-a0d7c8717e4f