|
1 /* |
|
2 * MP3/MPlayer plugin to VDR (C++) |
|
3 * |
|
4 * (C) 2001-2006 Stefan Huelswitt <s.huelswitt@gmx.de> |
|
5 * |
|
6 * This code is free software; you can redistribute it and/or |
|
7 * modify it under the terms of the GNU General Public License |
|
8 * as published by the Free Software Foundation; either version 2 |
|
9 * of the License, or (at your option) any later version. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, |
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 * GNU General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU General Public License |
|
17 * along with this program; if not, write to the Free Software |
|
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
19 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html |
|
20 */ |
|
21 |
|
22 #ifndef ___DATA_MP3_H |
|
23 #define ___DATA_MP3_H |
|
24 |
|
25 #include <vdr/thread.h> |
|
26 #include <vdr/tools.h> |
|
27 #include "data.h" |
|
28 |
|
29 // ---------------------------------------------------------------- |
|
30 |
|
31 class cDecoder; |
|
32 class cSongInfo; |
|
33 class cImageConvert; |
|
34 |
|
35 extern const char *imagecache, *imageconv; |
|
36 extern const char *img_suff[], *excl_pl[], *excl_br[]; |
|
37 |
|
38 // ---------------------------------------------------------------- |
|
39 |
|
40 class cSong : public cListObject { |
|
41 public: |
|
42 int user; |
|
43 private: |
|
44 cFileObj *obj; |
|
45 bool fromDOS, decoderFailed; |
|
46 cDecoder *decoder; |
|
47 cMutex decLock; |
|
48 // |
|
49 const char *image; |
|
50 cImageConvert *conv; |
|
51 int queueStat; |
|
52 // |
|
53 void Init(void); |
|
54 char *Convert2Unix(const char *name) const; |
|
55 bool FindImage(void); |
|
56 const char *CheckImage(const char *base) const; |
|
57 public: |
|
58 cSong(cFileObj *Obj); |
|
59 cSong(cFileSource *Source, const char *Subdir, const char *Name); |
|
60 cSong(cSong *Song); |
|
61 ~cSong(); |
|
62 #if APIVERSNUM >= 10315 |
|
63 virtual int Compare(const cListObject &ListObject) const; |
|
64 #else |
|
65 virtual bool operator<(const cListObject &ListObject); |
|
66 #endif |
|
67 bool Parse(char *s, const char *reldir) const; |
|
68 bool Save(FILE *f, const char *reldir) const; |
|
69 void Convert(void); |
|
70 cSongInfo *Info(bool get=true); |
|
71 cDecoder *Decoder(void); |
|
72 bool Image(unsigned char * &mem, int &len); |
|
73 inline const char *Name(void) const { return obj->Name(); } |
|
74 inline const char *FullPath(void) const { return obj->FullPath(); } |
|
75 }; |
|
76 |
|
77 // ---------------------------------------------------------------- |
|
78 |
|
79 class cPlayList : public cList<cSong>, public cListObject { |
|
80 private: |
|
81 bool isWinAmp; |
|
82 char *extbuffer; |
|
83 // |
|
84 void Init(void); |
|
85 void Set(void); |
|
86 const char *AddExt(const char *Name, const char *Ext); |
|
87 protected: |
|
88 cFileObj *obj; |
|
89 char *basename; |
|
90 public: |
|
91 cPlayList(cFileObj *Obj); |
|
92 cPlayList(cFileSource *Source, const char *Subdir, const char *Name); |
|
93 cPlayList(cPlayList *List); |
|
94 ~cPlayList(); |
|
95 virtual bool Load(void); |
|
96 virtual bool Save(void); |
|
97 #if APIVERSNUM >= 10315 |
|
98 virtual int Compare(const cListObject &ListObject) const; |
|
99 #else |
|
100 virtual bool operator<(const cListObject &ListObject); |
|
101 #endif |
|
102 // |
|
103 bool Rename(const char *newName); |
|
104 bool Delete(void); |
|
105 bool Create(const char *newName); |
|
106 bool Exists(void); |
|
107 bool TestName(const char *newName); |
|
108 // |
|
109 inline const char *Name(void) const { return obj->Name(); } |
|
110 inline const char *BaseName(void) const { return basename; } |
|
111 inline bool IsWinAmp(void) const { return isWinAmp; } |
|
112 }; |
|
113 |
|
114 // ---------------------------------------------------------------- |
|
115 |
|
116 class cInstantPlayList : public cScanDir, public cPlayList { |
|
117 protected: |
|
118 virtual void DoItem(cFileSource *src, const char *subdir, const char *name); |
|
119 public: |
|
120 cInstantPlayList(cFileObj *Obj); |
|
121 virtual bool Load(void); |
|
122 virtual bool Save(void) { return false; } |
|
123 }; |
|
124 |
|
125 // ---------------------------------------------------------------- |
|
126 |
|
127 class cPlayLists : public cScanDir, public cList<cPlayList> { |
|
128 protected: |
|
129 virtual void DoItem(cFileSource *src, const char *subdir, const char *name); |
|
130 public: |
|
131 bool Load(cFileSource *Source); |
|
132 }; |
|
133 |
|
134 #endif //___DATA_MP3_H |