aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-07-06song: initialize mtime in song_alloc()Max Kellermann1-0/+1
2009-03-13all: Update copyright header.Avuton Olrich1-6/+7
This updates the copyright header to all be the same, which is pretty much an update of where to mail request for a copy of the GPL and the years of the MPD project. This also puts all committers under 'The Music Player Project' umbrella. These entries should go individually in the AUTHORS file, for consistancy.
2009-02-28tag: moved APE code to tag_ape.cMax Kellermann1-0/+1
2009-02-25ls: moved generic URI utilities to uri.cMax Kellermann1-1/+1
"ls" is a bad name for a library which parses URIs. We'll move the rest of the "ls" library later.
2009-02-15decoder_api: moved struct decoder_plugin to decoder_plugin.hMax Kellermann1-1/+3
The decoder_plugin struct is used by both the MPD core and the decoder plugin implementations. Move it to a shared header file, to minimize header dependencies.
2009-01-23song: include cleanupMax Kellermann1-2/+0
Removed unused includes.
2009-01-17song: skip archive check for non-musicdir filesMax Kellermann1-1/+1
If a song is not within the music directory ("file:///..."), it has no "parent directory". The archive code nonetheless dereferences the parent pointer, causing a segmentation fault. Check parent!=NULL.
2009-01-17moved fallback APE/ID3 tag loader to song.cMax Kellermann1-0/+36
Some plugins used the APE or ID3 tag loader as a fallback when their own methods of loading tags did not work. Move this code out of all decoder plugins, into song_file_update().
2009-01-04song: allocate the result of song_get_url()Max Kellermann1-6/+4
2009-01-04directory: added directory_is_root()Max Kellermann1-1/+1
directory_is_root() is cheaper than isRootDirectory(directory_get_path()).
2009-01-04ls: renamed functions, no CamelCaseMax Kellermann1-2/+2
2009-01-04ls: removed hasMusicSuffix() and get_archive_by_suffix()Max Kellermann1-16/+31
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-04song: removed duplicate '\n' checkMax Kellermann1-5/+2
Newline characters are already checked in skip_path() (update.c).
2009-01-03song: use GLib instead of utils.h/log.hMax Kellermann1-5/+5
2009-01-02mapper: allocate the result of map_directory_child_fs(), map_song_fs()Max Kellermann1-7/+9
Don't use fixed stack buffers.
2008-12-29removed os_compat.hMax Kellermann1-0/+5
Only include headers which are really needed. os_compat.h aimed to make MPD easily portable, but was never actually made portable.
2008-12-16song: adding support for songs in archivesViliam Mateicka1-1/+34
2008-11-01decoder: return const decoder_plugin structsMax Kellermann1-1/+1
The decoder_plugin structs must never change. Don't work with non-const pointers.
2008-10-31update: check return valuesMax Kellermann1-5/+8
Nearly all mapper functions can fail and will then return NULL. Add checks to all callers.
2008-10-15song: check file type in song_file_update()Max Kellermann1-1/+1
Don't load non-regular files.
2008-10-15playlist: added support for adding songs not in the music databaseMax Kellermann1-2/+2
Clients which have authenticated via unix socket may add local files to the MPD playlist, provided that they own the file.
2008-10-14mapper: new song-to-filesystem mapper libraryMax Kellermann1-3/+2
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-14song: pass const song pointer to song_get_url()Max Kellermann1-1/+1
song_get_url() doesn't modify the song object.
2008-10-13song: stat file in song_file_update(), don't use isMusic()Max Kellermann1-5/+8
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-13song: song_get_url: fix "/" prefix for songs in music_rootEric Wong1-1/+1
2008-10-08directory: eliminate CamelCaseMax Kellermann1-2/+2
CamelCase is ugly, rename the functions.
2008-10-08song: don't allow calling song_get_url(NULL)Max Kellermann1-3/+1
The runtime check suggests that the author has somehow thought song_get_url(NULL) might be valid. It should not be. Replace it with an assertion.
2008-10-08song: use song_file_update() in song_file_load()Max Kellermann1-10/+3
Eliminate duplicated code.
2008-10-08song: song_file_update() returns boolMax Kellermann1-3/+3
Instead of returning 0 or -1, return true on success and false on failure. This seems more natural, and when the C library was designed, there was no "bool" data type.
2008-10-08song: don't check song_is_file() in song_file_update()Max Kellermann1-17/+16
This function was never used on remote songs. Replace the runtime check with an assertion.
2008-10-08song: removed CamelCaseMax Kellermann1-10/+10
CamelCase is ugly... rename all functions.
2008-10-08song: replaced all song constructorsMax Kellermann1-21/+32
Provide separate constructors for creating a remote song, a local song, and one for loading data from a song file. This way, we can add more assertions.
2008-10-08don't include os_compat.hMax Kellermann1-2/+0
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-10-08song: converted typedef Song to struct songMax Kellermann1-7/+11
Again, a data type which can be forward-declared.
2008-10-08directory: converted typedef Directory to struct directoryMax Kellermann1-2/+2
The struct can be forward-declared by other headers, which relaxes the header dependencies.
2008-10-07directory: serialize song deletes from playlist during updateEric Wong1-6/+0
This makes the update code thread-safe and doesn't penalize the playlist code by complicating it with complicated and error-prone locks (and the associated overhead, not everybody has a thread-implementation as good as NPTL). The update task blocks during the delete; but the update task is a slow task anyways so we can block w/o people caring too much. This was also our only freeSong call site, so remove that function. Note that deleting entire directories is not fully thread-safe, yet; as their traversals are not yet locked.
2008-10-07Assert if we don't have song or song->url setEric Wong1-2/+8
song objects cannot exist without a path or URL
2008-10-06song: stop storing song_typeEric Wong1-8/+5
We already know if a song is a URL or not based on whether it has parentDir defined or not. Hopefully one day in the future we can drop HTTP support from MPD entirely when an HTTP filesystem comes along and we can access streams via open(2).
2008-10-06song: don't make the struct packedMax Kellermann1-1/+1
The "packed" attribute may have negative side effects on performance. Remove the "packed" attribute, and increase the size of "song.url" to a multiple of the machine word size.
2008-10-06song: use flex arrays to store song->urlEric Wong1-7/+15
Reduce the number of allocations we make, so there's less pressure on the allocator and less overhead to keep track of the allocations in.
2008-10-06song: get rid of newNullSong()Eric Wong1-13/+2
It didn't save us any lines of code nor did it do anything useful since we would overwrite everything anyways.
2008-10-06song: call freeJustSong if newSong failsEric Wong1-1/+1
There's no reason to scan the playlist for a song we just allocated.
2008-09-29decoder: renamed plugin methodsMax Kellermann1-2/+2
Why have a "_func" prefix on all method names? Also don't typedef the methods, there is no advantage in that.
2008-09-29song: converted "type" to enumMax Kellermann1-1/+1
Having an enum type is much nicer than an anonymous integer plus CPP macros. Note that the old code didn't save any space by declaring the variable 8 bit, due to padding.
2008-09-26song: removed type SongListMax Kellermann1-36/+0
SongList has been superseded by struct songvec.
2008-09-23Replace SongList with struct songvecEric Wong1-0/+1
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).
2008-09-07song: moved code to song_print.c, song_save.cMax Kellermann1-172/+1
Move everything which dumps song information (via tag_print.c) to a separate source file. song_print.c gets code which writes song data to the client; song_save.c is responsible for serializing songs from the tag cache.
2008-09-07tag: moved code to tag_print.cMax Kellermann1-0/+1
Move everything which dumps a tag to a file descriptor to tag_print.c. This relaxes dependencies and splits the code into smaller parts.
2008-09-06tag: fix segfault on updateEric Wong1-0/+1
clearMpdTag could be called on a tag that was still in a tag_begin_add transaction before tag_end_add is called. This was causing free() to attempt to operate on bulk.items; which is un-free()-able. Now instead we unmark the bulk.busy to avoid committing the tags to the heap only to be immediately freed. Additionally, we need to remember to call tag_end_add() when a song is updated before we NULL song->tag to avoid tripping an assertion the next time tag_begin_add() is called.
2008-08-29tag: try not to reallocate tag.items in every add() callMax Kellermann1-4/+16
If many tag_items are added at once while the tag cache is being loaded, manage these items in a static fixed list, instead of reallocating the list with every newly created item. This reduces heap fragmentation. Massif results again: mk before: total 12,837,632; useful 10,626,383; extra 2,211,249 mk now: total 12,736,720; useful 10,626,383; extra 2,110,337 The "useful" value is the same since this patch only changes the way we allocate the same amount of memory, but heap fragmentation was reduced by 5%.