nathan@0: /* nathan@0: * MP3/MPlayer plugin to VDR (C++) nathan@0: * nathan@0: * (C) 2001-2006 Stefan Huelswitt nathan@0: * nathan@0: * This code is free software; you can redistribute it and/or nathan@0: * modify it under the terms of the GNU General Public License nathan@0: * as published by the Free Software Foundation; either version 2 nathan@0: * of the License, or (at your option) any later version. nathan@0: * nathan@0: * This code is distributed in the hope that it will be useful, nathan@0: * but WITHOUT ANY WARRANTY; without even the implied warranty of nathan@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nathan@0: * GNU General Public License for more details. nathan@0: * nathan@0: * You should have received a copy of the GNU General Public License nathan@0: * along with this program; if not, write to the Free Software nathan@0: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. nathan@0: * Or, point your browser to http://www.gnu.org/copyleft/gpl.html nathan@0: */ nathan@0: nathan@0: #ifndef ___DATA_MP3_H nathan@0: #define ___DATA_MP3_H nathan@0: nathan@0: #include nathan@0: #include nathan@0: #include "data.h" nathan@0: nathan@0: // ---------------------------------------------------------------- nathan@0: nathan@0: class cDecoder; nathan@0: class cSongInfo; nathan@0: class cImageConvert; nathan@0: nathan@0: extern const char *imagecache, *imageconv; nathan@0: extern const char *img_suff[], *excl_pl[], *excl_br[]; nathan@0: nathan@0: // ---------------------------------------------------------------- nathan@0: nathan@0: class cSong : public cListObject { nathan@0: public: nathan@0: int user; nathan@0: private: nathan@0: cFileObj *obj; nathan@0: bool fromDOS, decoderFailed; nathan@0: cDecoder *decoder; nathan@0: cMutex decLock; nathan@0: // nathan@0: const char *image; nathan@0: cImageConvert *conv; nathan@0: int queueStat; nathan@0: // nathan@0: void Init(void); nathan@0: char *Convert2Unix(const char *name) const; nathan@0: bool FindImage(void); nathan@0: const char *CheckImage(const char *base) const; nathan@0: public: nathan@0: cSong(cFileObj *Obj); nathan@0: cSong(cFileSource *Source, const char *Subdir, const char *Name); nathan@0: cSong(cSong *Song); nathan@0: ~cSong(); nathan@0: #if APIVERSNUM >= 10315 nathan@0: virtual int Compare(const cListObject &ListObject) const; nathan@0: #else nathan@0: virtual bool operator<(const cListObject &ListObject); nathan@0: #endif nathan@0: bool Parse(char *s, const char *reldir) const; nathan@0: bool Save(FILE *f, const char *reldir) const; nathan@0: void Convert(void); nathan@0: cSongInfo *Info(bool get=true); nathan@0: cDecoder *Decoder(void); nathan@0: bool Image(unsigned char * &mem, int &len); nathan@0: inline const char *Name(void) const { return obj->Name(); } nathan@0: inline const char *FullPath(void) const { return obj->FullPath(); } nathan@0: }; nathan@0: nathan@0: // ---------------------------------------------------------------- nathan@0: nathan@0: class cPlayList : public cList, public cListObject { nathan@0: private: nathan@0: bool isWinAmp; nathan@0: char *extbuffer; nathan@0: // nathan@0: void Init(void); nathan@0: void Set(void); nathan@0: const char *AddExt(const char *Name, const char *Ext); nathan@0: protected: nathan@0: cFileObj *obj; nathan@0: char *basename; nathan@0: public: nathan@0: cPlayList(cFileObj *Obj); nathan@0: cPlayList(cFileSource *Source, const char *Subdir, const char *Name); nathan@0: cPlayList(cPlayList *List); nathan@0: ~cPlayList(); nathan@0: virtual bool Load(void); nathan@0: virtual bool Save(void); nathan@0: #if APIVERSNUM >= 10315 nathan@0: virtual int Compare(const cListObject &ListObject) const; nathan@0: #else nathan@0: virtual bool operator<(const cListObject &ListObject); nathan@0: #endif nathan@0: // nathan@0: bool Rename(const char *newName); nathan@0: bool Delete(void); nathan@0: bool Create(const char *newName); nathan@0: bool Exists(void); nathan@0: bool TestName(const char *newName); nathan@0: // nathan@0: inline const char *Name(void) const { return obj->Name(); } nathan@0: inline const char *BaseName(void) const { return basename; } nathan@0: inline bool IsWinAmp(void) const { return isWinAmp; } nathan@0: }; nathan@0: nathan@0: // ---------------------------------------------------------------- nathan@0: nathan@0: class cInstantPlayList : public cScanDir, public cPlayList { nathan@0: protected: nathan@0: virtual void DoItem(cFileSource *src, const char *subdir, const char *name); nathan@0: public: nathan@0: cInstantPlayList(cFileObj *Obj); nathan@0: virtual bool Load(void); nathan@0: virtual bool Save(void) { return false; } nathan@0: }; nathan@0: nathan@0: // ---------------------------------------------------------------- nathan@0: nathan@0: class cPlayLists : public cScanDir, public cList { nathan@0: protected: nathan@0: virtual void DoItem(cFileSource *src, const char *subdir, const char *name); nathan@0: public: nathan@0: bool Load(cFileSource *Source); nathan@0: }; nathan@0: nathan@0: #endif //___DATA_MP3_H