decoder-core.h
author nathan
Sun, 12 Dec 2010 11:31:54 +0100
branchtrunk
changeset 38 79b272a68eb4
parent 25 887faebaba0a
permissions -rw-r--r--
fix compile without OGG library
nathan@0
     1
/*
nathan@0
     2
 * MP3/MPlayer plugin to VDR (C++)
nathan@0
     3
 *
nathan@25
     4
 * (C) 2001-2009 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 ___DECODER_CORE_H
nathan@0
    23
#define ___DECODER_CORE_H
nathan@0
    24
nathan@0
    25
#include "decoder.h"
nathan@0
    26
nathan@0
    27
#define DEC_ID(a,b,c,d) (((a)<<24)+((b)<<16)+((c)<<8)+(d))
nathan@0
    28
nathan@0
    29
// ----------------------------------------------------------------
nathan@0
    30
nathan@0
    31
enum eDecodeStatus { dsOK=0, dsPlay, dsSkip, dsEof, dsError, dsSoftError };
nathan@0
    32
nathan@0
    33
struct Decode {
nathan@0
    34
  eDecodeStatus status;
nathan@0
    35
  int index;
nathan@0
    36
  struct mad_pcm *pcm;
nathan@0
    37
  };
nathan@0
    38
nathan@0
    39
// ----------------------------------------------------------------
nathan@0
    40
nathan@25
    41
#define CACHE_VERSION 8
nathan@0
    42
nathan@0
    43
class cCacheData : public cSongInfo, public cFileInfo, public cListObject {
nathan@0
    44
friend class cInfoCache;
nathan@0
    45
private:
nathan@0
    46
  int hash, version;
nathan@0
    47
  time_t touch;
nathan@0
    48
  cMutex lock;
nathan@25
    49
  //
nathan@25
    50
  bool Check8bit(const char *str);
nathan@0
    51
protected:
nathan@0
    52
  bool Save(FILE *f);
nathan@0
    53
  bool Load(FILE *f);
nathan@0
    54
  bool Upgrade(void);
nathan@0
    55
  void Touch(void);
nathan@0
    56
  bool Purge(void);
nathan@25
    57
  void Create(cFileInfo *fi, cSongInfo *si, bool update);
nathan@0
    58
public:
nathan@0
    59
  cCacheData(void);
nathan@0
    60
  void Lock(void) { lock.Lock(); }
nathan@0
    61
  void Unlock(void) { lock.Unlock(); }
nathan@0
    62
  };
nathan@0
    63
nathan@0
    64
// ----------------------------------------------------------------
nathan@0
    65
nathan@0
    66
#endif //___DECODER_CORE_H