libvisual  0.5.0
lv_songinfo.h
1 /* Libvisual - The audio visualisation framework.
2  *
3  * Copyright (C) 2012 Libvisual team
4  * 2004-2006 Dennis Smit
5  *
6  * Authors: Chong Kai Xiong <kaixiong@codeleft.sg>
7  * Dennis Smit <ds@nerds-incorporated.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License as
11  * published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */
23 
24 #ifndef _LV_SONGINFO_H
25 #define _LV_SONGINFO_H
26 
27 #include <libvisual/lv_types.h>
28 #include <libvisual/lv_time.h>
29 #include <libvisual/lv_video.h>
30 
41 typedef enum {
47 
48 
49 #ifdef __cplusplus
50 
51 #include <string>
52 
53 namespace LV {
54 
55  enum SongInfoType
56  {
57  SONG_INFO_TYPE_NULL = ::VISUAL_SONGINFO_TYPE_NULL,
58  SONG_INFO_TYPE_SIMPLE = ::VISUAL_SONGINFO_TYPE_SIMPLE,
59  SONG_INFO_TYPE_ADVANCED = ::VISUAL_SONGINFO_TYPE_ADVANCED
60  };
61 
68  class LV_API SongInfo
69  {
70  public:
71 
72  explicit SongInfo (SongInfoType type);
73 
74  ~SongInfo ();
75 
76  friend bool operator== (SongInfo const& lhs, SongInfo const& rhs);
77 
88  // FIXME: Type should only be set at creation time. Ideally we
89  // should be able prevent accidental access to invalid fields.
90  void set_type (SongInfoType type);
91 
92  SongInfoType get_type () const;
93 
100  void set_simple_name (std::string const& name);
101 
107  std::string get_simple_name () const;
108 
116  void set_length (int length);
117 
123  int get_length () const;
124 
132  void set_elapsed (int elapsed);
133 
134  int get_elapsed () const;
135 
143  void set_artist (std::string const& artist);
144 
145  std::string get_artist () const;
146 
154  void set_album (std::string const& album);
155 
156  std::string get_album () const;
157 
165  void set_song (std::string const& name);
166 
167  std::string get_song () const;
168 
178  void set_cover (VideoPtr const& cover);
179 
180  VideoPtr get_cover () const;
181 
186  void mark ();
187 
193  long get_age (); // FIXME: should be const
194 
195  private:
196 
197  SongInfoType m_type;
198  int m_length;
199  int m_elapsed;
200  std::string m_song_name;
201  std::string m_artist;
202  std::string m_album;
203  std::string m_song;
204  Timer m_timer;
205  VideoPtr m_cover;
206  };
207 
208 } // LV namespace
209 
210 #endif /* __cplusplus */
211 
212 #ifdef __cplusplus
213 typedef ::LV::SongInfo VisSongInfo;
214 #else
215 typedef struct _VisSongInfo VisSongInfo;
216 struct _VisSongInfo;
217 #endif
218 
219 LV_BEGIN_DECLS
220 
221 LV_API VisSongInfo *visual_songinfo_new (VisSongInfoType type);
222 LV_API VisSongInfo *visual_songinfo_clone (VisSongInfo *src);
223 LV_API void visual_songinfo_free (VisSongInfo *songinfo);
224 
225 LV_API void visual_songinfo_copy (VisSongInfo *dest, VisSongInfo const *src);
226 LV_API int visual_songinfo_compare (VisSongInfo const *s1, VisSongInfo const *s2);
227 
228 LV_API void visual_songinfo_set_type (VisSongInfo *songinfo, VisSongInfoType type);
229 LV_API VisSongInfoType visual_songinfo_get_type (VisSongInfo *songinfo);
230 
231 LV_API void visual_songinfo_set_length (VisSongInfo *songinfo, int length);
232 LV_API int visual_songinfo_get_length (VisSongInfo *songinfo);
233 
234 LV_API void visual_songinfo_set_elapsed (VisSongInfo *songinfo, int elapsed);
235 LV_API int visual_songinfo_get_elapsed (VisSongInfo *songinfo);
236 
237 LV_API void visual_songinfo_set_simple_name (VisSongInfo *songinfo, const char *name);
238 LV_API const char *visual_songinfo_get_simple_name (VisSongInfo *songinfo);
239 
240 LV_API void visual_songinfo_set_artist (VisSongInfo *songinfo, const char *artist);
241 LV_API const char *visual_songinfo_get_artist (VisSongInfo *songinfo);
242 
243 LV_API void visual_songinfo_set_album (VisSongInfo *songinfo, const char *album);
244 LV_API const char *visual_songinfo_get_album (VisSongInfo *songinfo);
245 
246 LV_API void visual_songinfo_set_song (VisSongInfo *songinfo, const char *song);
247 LV_API const char *visual_songinfo_get_song (VisSongInfo *songinfo);
248 
249 LV_API void visual_songinfo_set_cover (VisSongInfo *songinfo, VisVideo *cover);
250 LV_API VisVideo *visual_songinfo_get_cover (VisSongInfo *songinfo);
251 
252 LV_API void visual_songinfo_mark (VisSongInfo *songinfo);
253 
254 LV_API long visual_songinfo_get_age (VisSongInfo *songinfo);
255 
256 LV_END_DECLS
257 
262 #endif /* _LV_SONGINFO_H */