1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/data-mp3.h Sat Dec 29 14:47:40 2007 +0100
1.3 @@ -0,0 +1,134 @@
1.4 +/*
1.5 + * MP3/MPlayer plugin to VDR (C++)
1.6 + *
1.7 + * (C) 2001-2006 Stefan Huelswitt <s.huelswitt@gmx.de>
1.8 + *
1.9 + * This code is free software; you can redistribute it and/or
1.10 + * modify it under the terms of the GNU General Public License
1.11 + * as published by the Free Software Foundation; either version 2
1.12 + * of the License, or (at your option) any later version.
1.13 + *
1.14 + * This code is distributed in the hope that it will be useful,
1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.17 + * GNU General Public License for more details.
1.18 + *
1.19 + * You should have received a copy of the GNU General Public License
1.20 + * along with this program; if not, write to the Free Software
1.21 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1.22 + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
1.23 + */
1.24 +
1.25 +#ifndef ___DATA_MP3_H
1.26 +#define ___DATA_MP3_H
1.27 +
1.28 +#include <vdr/thread.h>
1.29 +#include <vdr/tools.h>
1.30 +#include "data.h"
1.31 +
1.32 +// ----------------------------------------------------------------
1.33 +
1.34 +class cDecoder;
1.35 +class cSongInfo;
1.36 +class cImageConvert;
1.37 +
1.38 +extern const char *imagecache, *imageconv;
1.39 +extern const char *img_suff[], *excl_pl[], *excl_br[];
1.40 +
1.41 +// ----------------------------------------------------------------
1.42 +
1.43 +class cSong : public cListObject {
1.44 +public:
1.45 + int user;
1.46 +private:
1.47 + cFileObj *obj;
1.48 + bool fromDOS, decoderFailed;
1.49 + cDecoder *decoder;
1.50 + cMutex decLock;
1.51 + //
1.52 + const char *image;
1.53 + cImageConvert *conv;
1.54 + int queueStat;
1.55 + //
1.56 + void Init(void);
1.57 + char *Convert2Unix(const char *name) const;
1.58 + bool FindImage(void);
1.59 + const char *CheckImage(const char *base) const;
1.60 +public:
1.61 + cSong(cFileObj *Obj);
1.62 + cSong(cFileSource *Source, const char *Subdir, const char *Name);
1.63 + cSong(cSong *Song);
1.64 + ~cSong();
1.65 +#if APIVERSNUM >= 10315
1.66 + virtual int Compare(const cListObject &ListObject) const;
1.67 +#else
1.68 + virtual bool operator<(const cListObject &ListObject);
1.69 +#endif
1.70 + bool Parse(char *s, const char *reldir) const;
1.71 + bool Save(FILE *f, const char *reldir) const;
1.72 + void Convert(void);
1.73 + cSongInfo *Info(bool get=true);
1.74 + cDecoder *Decoder(void);
1.75 + bool Image(unsigned char * &mem, int &len);
1.76 + inline const char *Name(void) const { return obj->Name(); }
1.77 + inline const char *FullPath(void) const { return obj->FullPath(); }
1.78 + };
1.79 +
1.80 +// ----------------------------------------------------------------
1.81 +
1.82 +class cPlayList : public cList<cSong>, public cListObject {
1.83 +private:
1.84 + bool isWinAmp;
1.85 + char *extbuffer;
1.86 + //
1.87 + void Init(void);
1.88 + void Set(void);
1.89 + const char *AddExt(const char *Name, const char *Ext);
1.90 +protected:
1.91 + cFileObj *obj;
1.92 + char *basename;
1.93 +public:
1.94 + cPlayList(cFileObj *Obj);
1.95 + cPlayList(cFileSource *Source, const char *Subdir, const char *Name);
1.96 + cPlayList(cPlayList *List);
1.97 + ~cPlayList();
1.98 + virtual bool Load(void);
1.99 + virtual bool Save(void);
1.100 +#if APIVERSNUM >= 10315
1.101 + virtual int Compare(const cListObject &ListObject) const;
1.102 +#else
1.103 + virtual bool operator<(const cListObject &ListObject);
1.104 +#endif
1.105 + //
1.106 + bool Rename(const char *newName);
1.107 + bool Delete(void);
1.108 + bool Create(const char *newName);
1.109 + bool Exists(void);
1.110 + bool TestName(const char *newName);
1.111 + //
1.112 + inline const char *Name(void) const { return obj->Name(); }
1.113 + inline const char *BaseName(void) const { return basename; }
1.114 + inline bool IsWinAmp(void) const { return isWinAmp; }
1.115 + };
1.116 +
1.117 +// ----------------------------------------------------------------
1.118 +
1.119 +class cInstantPlayList : public cScanDir, public cPlayList {
1.120 +protected:
1.121 + virtual void DoItem(cFileSource *src, const char *subdir, const char *name);
1.122 +public:
1.123 + cInstantPlayList(cFileObj *Obj);
1.124 + virtual bool Load(void);
1.125 + virtual bool Save(void) { return false; }
1.126 + };
1.127 +
1.128 +// ----------------------------------------------------------------
1.129 +
1.130 +class cPlayLists : public cScanDir, public cList<cPlayList> {
1.131 +protected:
1.132 + virtual void DoItem(cFileSource *src, const char *subdir, const char *name);
1.133 +public:
1.134 + bool Load(cFileSource *Source);
1.135 + };
1.136 +
1.137 +#endif //___DATA_MP3_H