Commit Graph

117 Commits

Author SHA1 Message Date
Max Kellermann
c6cbcc2c25 copyright year 2011 2011-01-29 10:13:54 +01:00
Avuton Olrich
9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann
a038bca745 song: added support for selecting a time range
Added attributes start_ms, end_ms.  This allows us to address a
portion of a song file (important for CUE support).  There is no
support yet for storing these attributes in the state file.
2009-12-27 14:46:04 +01:00
Max Kellermann
6622d69fda song: added function song_get_duration() 2009-12-26 13:56:35 +01:00
Max Kellermann
5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +01:00
Max Kellermann
f7ce4f6239 song: renamed attribute "url" to "uri" 2009-10-13 18:01:06 +02:00
Max Kellermann
7ec503c4ec song: moved code to song_update.c
Moved all the code which depends on the decoder plugins to a separate
source.  That allows leaner test programs.
2009-10-12 22:30:50 +02:00
Max Kellermann
09aadffe9b song: initialize mtime in song_alloc() 2009-07-06 11:32:31 +02:00
Avuton Olrich
0aee49bdf8 all: Update copyright header.
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-03-13 11:51:55 -07:00
Max Kellermann
4a2b315ab6 tag: moved APE code to tag_ape.c 2009-02-28 16:44:41 +01:00
Max Kellermann
6823217697 ls: moved generic URI utilities to uri.c
"ls" is a bad name for a library which parses URIs.  We'll move the
rest of the "ls" library later.
2009-02-25 16:44:06 +01:00
Max Kellermann
a28287073b decoder_api: moved struct decoder_plugin to decoder_plugin.h
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-02-15 17:48:37 +01:00
Max Kellermann
21bb0aab90 song: include cleanup
Removed unused includes.
2009-01-23 16:45:35 +01:00
Max Kellermann
2bbf378dd8 song: skip archive check for non-musicdir files
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-17 19:56:36 +01:00
Max Kellermann
5395f5f6b3 moved fallback APE/ID3 tag loader to song.c
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-17 13:23:42 +01:00
Max Kellermann
fed719197c song: allocate the result of song_get_url() 2009-01-04 19:09:34 +01:00
Max Kellermann
ea8ae68e6f directory: added directory_is_root()
directory_is_root() is cheaper than
isRootDirectory(directory_get_path()).
2009-01-04 19:08:52 +01:00
Max Kellermann
45597cc571 ls: renamed functions, no CamelCase 2009-01-04 17:46:42 +01:00
Max Kellermann
ff72fff68d ls: removed hasMusicSuffix() and get_archive_by_suffix()
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-04 17:26:22 +01:00
Max Kellermann
8a562c9c71 song: removed duplicate '\n' check
Newline characters are already checked in skip_path() (update.c).
2009-01-04 17:26:15 +01:00
Max Kellermann
3978b7b1ea song: use GLib instead of utils.h/log.h 2009-01-03 14:51:30 +01:00
Max Kellermann
daf7c3db5a mapper: allocate the result of map_directory_child_fs(), map_song_fs()
Don't use fixed stack buffers.
2009-01-02 10:48:55 +01:00
Max Kellermann
95b3430f52 removed os_compat.h
Only include headers which are really needed.  os_compat.h aimed to
make MPD easily portable, but was never actually made portable.
2008-12-29 17:28:32 +01:00
Viliam Mateicka
455b39fa26 song: adding support for songs in archives 2008-12-16 21:42:42 +01:00
Max Kellermann
5036368f54 decoder: return const decoder_plugin structs
The decoder_plugin structs must never change.  Don't work with
non-const pointers.
2008-11-01 14:51:41 +01:00
Max Kellermann
a5f8d4386c update: check return values
Nearly all mapper functions can fail and will then return NULL.  Add
checks to all callers.
2008-10-31 16:47:21 +01: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
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
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
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
Eric Wong
c641aabe33 song: song_get_url: fix "/" prefix for songs in music_root 2008-10-13 09:39:02 +02:00
Max Kellermann
68977af6e0 directory: eliminate CamelCase
CamelCase is ugly, rename the functions.
2008-10-08 11:07:58 +02:00
Max Kellermann
e1a4474ad4 song: don't allow calling song_get_url(NULL)
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-08 11:06:37 +02:00
Max Kellermann
4ab6b59aaf song: use song_file_update() in song_file_load()
Eliminate duplicated code.
2008-10-08 11:06:27 +02:00
Max Kellermann
02e8c000d1 song: song_file_update() returns bool
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-08 11:06:26 +02:00
Max Kellermann
1f9b614850 song: don't check song_is_file() in song_file_update()
This function was never used on remote songs.  Replace the runtime
check with an assertion.
2008-10-08 11:05:38 +02:00
Max Kellermann
5e7b18f874 song: removed CamelCase
CamelCase is ugly...  rename all functions.
2008-10-08 11:05:34 +02:00
Max Kellermann
5e4be9e495 song: replaced all song constructors
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-08 11:05:25 +02:00
Max Kellermann
71351160b1 don't include os_compat.h
When there are standardized headers, use these instead of the bloated
os_compat.h.
2008-10-08 10:49:29 +02:00
Max Kellermann
d562ba5fbb song: converted typedef Song to struct song
Again, a data type which can be forward-declared.
2008-10-08 10:49:11 +02:00
Max Kellermann
25f67da58c directory: converted typedef Directory to struct directory
The struct can be forward-declared by other headers, which relaxes the
header dependencies.
2008-10-08 10:49:05 +02:00
Eric Wong
7d8c9cc7e3 directory: serialize song deletes from playlist during update
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-07 22:11:16 +02:00
Eric Wong
0d34815f6c Assert if we don't have song or song->url set
song objects cannot exist without a path or URL
2008-10-07 21:20:34 +02:00
Eric Wong
f1c53fe0ed song: stop storing song_type
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-06 18:52:13 +02:00
Max Kellermann
22e40b61cc song: don't make the struct packed
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-06 18:48:45 +02:00
Eric Wong
267b2cd6e6 song: use flex arrays to store song->url
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-06 18:46:52 +02:00
Eric Wong
43761441c9 song: get rid of newNullSong()
It didn't save us any lines of code nor did it do anything
useful since we would overwrite everything anyways.
2008-10-06 18:43:10 +02:00
Eric Wong
dc245f389c song: call freeJustSong if newSong fails
There's no reason to scan the playlist for a song we
just allocated.
2008-10-06 18:41:41 +02:00
Max Kellermann
21d3d300fd decoder: renamed plugin methods
Why have a "_func" prefix on all method names?  Also don't typedef the
methods, there is no advantage in that.
2008-09-29 15:54:27 +02:00