aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2008-10-31added prefix to header macrosMax Kellermann1-2/+2
"LOG_H" is a macro which is also used by ffmpeg/log.h. This is ffmpeg's fault, because short macros should be reserved for applications, but since it's always a good idea to choose prefixed macro names, even for applications, we are going to do that in MPD.
2008-10-15playlist: added support for adding songs not in the music databaseMax Kellermann1-1/+1
Clients which have authenticated via unix socket may add local files to the MPD playlist, provided that they own the file.
2008-10-15song: added song_in_database()Max Kellermann1-1/+7
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-14song: pass const song pointer to song_get_url()Max Kellermann1-1/+1
song_get_url() doesn't modify the song object.
2008-10-08song: song_file_update() returns boolMax Kellermann1-1/+1
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: removed CamelCaseMax Kellermann1-6/+6
CamelCase is ugly... rename all functions.
2008-10-08song: replaced all song constructorsMax Kellermann1-2/+12
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-08use the "bool" data type instead of "int"Max Kellermann1-2/+4
"bool" should be used in C99 programs for boolean values.
2008-10-08don't include os_compat.hMax Kellermann1-2/+2
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-10-08CPP include cleanupMax Kellermann1-3/+0
Include only headers which are really used.
2008-10-08song: converted typedef Song to struct songMax Kellermann1-8/+13
Again, a data type which can be forward-declared.
2008-10-08directory: converted typedef Directory to struct directoryMax Kellermann1-3/+3
The struct can be forward-declared by other headers, which relaxes the header dependencies.
2008-10-07song: really make the song struct non-packedMax Kellermann1-1/+1
Somehow I must have missed this in commit 22e40b61.
2008-10-07directory: serialize song deletes from playlist during updateEric Wong1-2/+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-06song: stop storing song_typeEric Wong1-9/+7
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-2/+6
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-2/+0
It didn't save us any lines of code nor did it do anything useful since we would overwrite everything anyways.
2008-09-29assume stdint.h and stddef.h are availableMax Kellermann1-1/+0
Since we use a C99 compiler now, we can assert that the C99 standard headers are available, no need for complicated compile time checks. Kill mpd_types.h.
2008-09-29song: converted "type" to enumMax Kellermann1-4/+7
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-29switch to C99 types, part IIMax Kellermann1-1/+1
Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
2008-09-26song: removed type SongListMax Kellermann1-10/+0
SongList has been superseded by struct songvec.
2008-09-07pass "struct client" to dbUtils.c, song.c, tag_print.cMax Kellermann1-0/+2
Don't pass the raw file descriptor around. This migration patch is rather large, because all of the sources have inter dependencies - we have to change all of them at the same time.
2008-09-07song: moved code to song_print.c, song_save.cMax Kellermann1-11/+2
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-06include cleanupMax Kellermann1-3/+2
As usual, include only headers which are really needed.
2008-08-29song: don't export newNullSong()Max Kellermann1-2/+0
The function newNullSong() is only used internally in song.c.
2008-08-29tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_itemMax Kellermann1-1/+1
Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
2008-04-12song: document get_song_url()Eric Wong1-0/+6
[merged r7184 from branches/ew] git-svn-id: https://svn.musicpd.org/mpd/trunk@7242 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-02-05fix -Wconst warningsMax Kellermann1-2/+2
[ew: cleaned up the dirty union hack a bit] Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7180 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-03Cleanup #includes of standard system headers and put them in one placeEric Wong1-4/+1
This will make refactoring features easier, especially now that pthreads support and larger refactorings are on the horizon. Hopefully, this will make porting to other platforms (even non-UNIX-like ones for masochists) easier, too. os_compat.h will house all the #includes for system headers considered to be the "core" of MPD. Headers for optional features will be left to individual source files. git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-12-28Merge branches/ew r7104Eric Wong1-1/+1
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
2007-04-05The massive copyright updateAvuton Olrich1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-10-27add support for: list fileWarren Dukes1-0/+3
This behaves the same as: list filename git-svn-id: https://svn.musicpd.org/mpd/trunk@4952 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-20Fix warnings for -Wmissing-prototypesAvuton Olrich1-2/+2
Add -Wmissing-prototypes if compiling with gcc Static where possible git-svn-id: https://svn.musicpd.org/mpd/trunk@4657 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30interface/connection malloc reductions from mpd-keEric Wong1-3/+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
2006-07-20Add mpd-indent.shAvuton Olrich1-11/+11
Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-15[CLEANUP] Remove unused codeAvuton Olrich1-2/+0
Cleanup whitespace->tabs git-svn-id: https://svn.musicpd.org/mpd/trunk@4347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Change shank's email addressJ. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13Huge header update, update the copyright and addAvuton Olrich1-1/+1
the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-11implement saved memory by not storing full pathWarren Dukes1-3/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@2601 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-11this is brokenWarren Dukes1-11/+12
git-svn-id: https://svn.musicpd.org/mpd/trunk@2597 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-03remove vim &*(@Warren Dukes1-1/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@2500 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-31icynames are now copied to title of streamsWarren Dukes1-0/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1258 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-19fix a nasty bug when deleting a stream from the playlistWarren Dukes1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1082 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-13redimentary addition of url's to playlistWarren Dukes1-0/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1000 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-05-13add type element to Song struct, and change utf8file to utf8urlWarren Dukes1-3/+10
git-svn-id: https://svn.musicpd.org/mpd/trunk@999 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-04-14add vim shiznit to end of all source filesWarren Dukes1-0/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@750 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-18bunch of autotool cleanupsWarren Dukes1-0/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@271 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-11move time back into MpdTagWarren Dukes1-1/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@250 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-03-10move time from tag info to song info.Warren Dukes1-0/+1
also, if we can't get the time, then don't add the song to the db! git-svn-id: https://svn.musicpd.org/mpd/trunk@236 09075e82-0dd4-0310-85a5-a0d7c8717e4f