data-mp3.h
author nathan
Sun, 12 Dec 2010 11:31:54 +0100
branchtrunk
changeset 38 79b272a68eb4
parent 22 93aaf15c145a
permissions -rw-r--r--
fix compile without OGG library
     1 /*
     2  * MP3/MPlayer plugin to VDR (C++)
     3  *
     4  * (C) 2001-2009 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, *def_usr_img;
    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   virtual int Compare(const cListObject &ListObject) const;
    63   bool Parse(char *s, const char *reldir) const;
    64   bool Save(FILE *f, const char *reldir) const;
    65   void Convert(void);
    66   cSongInfo *Info(bool get=true);
    67   cDecoder *Decoder(void);
    68   bool Image(unsigned char * &mem, int &len);
    69   inline const char *Name(void) const { return obj->Name(); }
    70   inline const char *FullPath(void) const { return obj->FullPath(); }
    71   };
    72 
    73 // ----------------------------------------------------------------
    74 
    75 class cPlayList : public cList<cSong>, public cListObject {
    76 private:
    77   bool isWinAmp;
    78   char *extbuffer;
    79   //
    80   void Init(void);
    81   void Set(void);
    82   const char *AddExt(const char *Name, const char *Ext);
    83 protected:
    84   cFileObj *obj;
    85   char *basename;
    86 public:
    87   cPlayList(cFileObj *Obj);
    88   cPlayList(cFileSource *Source, const char *Subdir, const char *Name);
    89   cPlayList(cPlayList *List);
    90   ~cPlayList();
    91   virtual bool Load(void);
    92   virtual bool Save(void);
    93   virtual int Compare(const cListObject &ListObject) const;
    94   //
    95   bool Rename(const char *newName);
    96   bool Delete(void);
    97   bool Create(const char *newName);
    98   bool Exists(void);
    99   bool TestName(const char *newName);
   100   //
   101   inline const char *Name(void) const { return obj->Name(); }
   102   inline const char *BaseName(void) const { return basename; }
   103   inline bool IsWinAmp(void) const { return isWinAmp; }
   104   };
   105 
   106 // ----------------------------------------------------------------
   107 
   108 class cInstantPlayList : public cScanDir, public cPlayList {
   109 protected:
   110   virtual void DoItem(cFileSource *src, const char *subdir, const char *name);
   111 public:
   112   cInstantPlayList(cFileObj *Obj);
   113   virtual bool Load(void);
   114   virtual bool Save(void) { return false; }
   115   };
   116 
   117 // ----------------------------------------------------------------
   118 
   119 class cPlayLists : public cScanDir, public cList<cPlayList> {
   120 protected:
   121   virtual void DoItem(cFileSource *src, const char *subdir, const char *name);
   122 public:
   123   bool Load(cFileSource *Source);
   124   };
   125 
   126 #endif //___DATA_MP3_H