aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.h
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-10-11 23:39:50 -0700
committerEric Wong <normalperson@yhbt.net>2008-10-11 23:39:50 -0700
commit0df62a2c3cb7af88347d40a17cc336b5d1740f62 (patch)
tree25040833144c3e24f6b4702d9b745cd068b5371a /src/song.h
parent3456e2de5bf90207d8149a842bb12c3f9bdd218f (diff)
parent6e2b0ca9edaed200f250ef487701ad161aa4a168 (diff)
downloadmpd-0df62a2c3cb7af88347d40a17cc336b5d1740f62.tar.gz
mpd-0df62a2c3cb7af88347d40a17cc336b5d1740f62.tar.xz
mpd-0df62a2c3cb7af88347d40a17cc336b5d1740f62.zip
Merge branch 'mk/directory'
* mk/directory: (59 commits) directory: don't use identical struct and variable names update: replaced update_return with global "modified" flag update: make the variable "progress" static update: don't print debug message when song was not modified update: fix memory leak in directory_update_init() update: make the job id unsigned update: job ID must be positive update: check progress!=IDLE in reap_update_task() update: fixed stack corruption due to pthread_join() call updated: always call removeDeletedFromDirectory() update: eliminated addSubDirectoryToDirectory() update: make the "song" variable more local update: do the recursive directory check only once update: copy stat to new directory update: avoid duplicate stat() calls update: rewrote updatePath() using updateInDirectory() update: don't export updateDirectory() update: pass const pointer to addSubDirectoryToDirectory() update: never pass root path to updatePath() update: merged addDirectoryPathToDB() into addParentPathToDB() ... Conflicts: src/song.c
Diffstat (limited to 'src/song.h')
-rw-r--r--src/song.h45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/song.h b/src/song.h
index 9aa9efa94..338bcf6c1 100644
--- a/src/song.h
+++ b/src/song.h
@@ -22,8 +22,6 @@
#include "../config.h"
#include "os_compat.h"
#include "tag.h"
-#include "list.h"
-#include "gcc.h"
#define SONG_KEY "key: "
#define SONG_MTIME "mtime: "
@@ -33,42 +31,53 @@
#define SONG_FILE "file: "
#define SONG_TIME "Time: "
-typedef struct _Song {
+struct mpd_song {
struct mpd_tag *tag;
- struct _Directory *parentDir;
+ struct directory *parent;
time_t mtime;
- char url[1];
-} mpd_packed Song;
+ char url[sizeof(size_t)];
+};
-Song *newSong(const char *url, struct _Directory *parentDir);
+void song_free(struct mpd_song *);
-void freeJustSong(Song *);
+/** allocate a new song with a remote URL */
+struct mpd_song * song_remote_new(const char *url);
-ssize_t song_print_info(Song * song, int fd);
+/** allocate a new song with a local file name */
+struct mpd_song * song_file_new(const char *path, struct directory *parent);
+
+/**
+ * allocate a new song structure with a local file name and attempt to
+ * load its metadata. If all decoder plugin fail to read its meta
+ * data, NULL is returned.
+ */
+struct mpd_song * song_file_load(const char *path, struct directory *parent);
+
+ssize_t song_print_info(struct mpd_song * song, int fd);
/* like song_print_info, but casts data into an fd first */
-int song_print_info_x(Song * song, void *data);
+int song_print_info_x(struct mpd_song * song, void *data);
-void readSongInfoIntoList(FILE * fp, struct _Directory *parent);
+void readSongInfoIntoList(FILE * fp, struct directory *parent);
-int updateSongInfo(Song * song);
+int song_file_update(struct mpd_song * song);
-ssize_t song_print_url(Song * song, int fd);
+ssize_t song_print_url(struct mpd_song * song, int fd);
/* like song_print_url_x, but casts data into an fd first */
-int song_print_url_x(Song * song, void *data);
+int song_print_url_x(struct mpd_song * song, void *data);
/*
- * get_song_url - Returns a path of a song in UTF8-encoded form
+ * song_get_url - Returns a path of a song in UTF8-encoded form
* path_max_tmp is the argument that the URL is written to, this
* buffer is assumed to be MPD_PATH_MAX or greater (including
* terminating '\0').
*/
-char *get_song_url(char *path_max_tmp, Song * song);
+char *song_get_url(struct mpd_song * song, char *path_max_tmp);
-static inline int song_is_file(const Song *song)
+static inline int song_is_file(const struct mpd_song *song)
{
- return !!song->parentDir;
+ return !!song->parent;
}
#endif