Code

options: Include all build options in version output.
[ncmpc.git] / src / song.h
1 /* libmpdclient
2    (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com)
3    (c) 2008 Max Kellermann <max@duempel.org>
4    This project's homepage is: http://www.musicpd.org
6    Redistribution and use in source and binary forms, with or without
7    modification, are permitted provided that the following conditions
8    are met:
10    - Redistributions of source code must retain the above copyright
11    notice, this list of conditions and the following disclaimer.
13    - Redistributions in binary form must reproduce the above copyright
14    notice, this list of conditions and the following disclaimer in the
15    documentation and/or other materials provided with the distribution.
17    - Neither the name of the Music Player Daemon nor the names of its
18    contributors may be used to endorse or promote products derived from
19    this software without specific prior written permission.
21    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
25    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
34 #ifndef SONG_H
35 #define SONG_H
37 #define MPD_SONG_NO_TIME        -1
38 #define MPD_SONG_NO_NUM         -1
39 #define MPD_SONG_NO_ID          -1
41 /* mpd_Song
42  * for storing song info returned by mpd
43  */
44 typedef struct mpd_song {
45         /* filename of song */
46         char * file;
47         /* artist, maybe NULL if there is no tag */
48         char * artist;
49         /* title, maybe NULL if there is no tag */
50         char * title;
51         /* album, maybe NULL if there is no tag */
52         char * album;
53         /* track, maybe NULL if there is no tag */
54         char * track;
55         /* name, maybe NULL if there is no tag; it's the name of the current
56          * song, f.e. the icyName of the stream */
57         char * name;
58         /* date */
59         char *date;
61         /* added by qball */
62         /* Genre */
63         char *genre;
64         /* Composer */
65         char *composer;
66         /* Disc */
67         char *disc;
68         /* Comment */
69         char *comment;
71         /* length of song in seconds, check that it is not MPD_SONG_NO_TIME  */
72         int time;
73         /* if plchanges/playlistinfo/playlistid used, is the position of the
74          * song in the playlist */
75         int pos;
76         /* song id for a song in the playlist */
77         int id;
78 } mpd_Song;
80 /* mpd_newSong
81  * use to allocate memory for a new mpd_Song
82  * file, artist, etc all initialized to NULL
83  * if your going to assign values to file, artist, etc
84  * be sure to malloc or strdup the memory
85  * use mpd_freeSong to free the memory for the mpd_Song, it will also
86  * free memory for file, artist, etc, so don't do it yourself
87  */
88 struct mpd_song *mpd_newSong(void);
90 /* mpd_freeSong
91  * use to free memory allocated by mpd_newSong
92  * also it will free memory pointed to by file, artist, etc, so be careful
93  */
94 void mpd_freeSong(struct mpd_song *song);
96 /* mpd_songDup
97  * works like strDup, but for a mpd_Song
98  */
99 struct mpd_song *mpd_songDup(const struct mpd_song *song);
101 #endif