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