decoder-snd.c
branchtrunk
changeset 25 887faebaba0a
parent 16 9d034fc2c5ec
child 29 640ce9201139
     1.1 --- a/decoder-snd.c	Wed Feb 04 19:34:25 2009 +0800
     1.2 +++ b/decoder-snd.c	Thu Feb 12 20:47:23 2009 +0800
     1.3 @@ -1,7 +1,7 @@
     1.4  /*
     1.5   * MP3/MPlayer plugin to VDR (C++)
     1.6   *
     1.7 - * (C) 2001-2007 Stefan Huelswitt <s.huelswitt@gmx.de>
     1.8 + * (C) 2001-2009 Stefan Huelswitt <s.huelswitt@gmx.de>
     1.9   *
    1.10   * This code is free software; you can redistribute it and/or
    1.11   * modify it under the terms of the GNU General Public License
    1.12 @@ -58,6 +58,7 @@
    1.13  
    1.14  #define CDDB_PROTO 5                   // used protocol level
    1.15  #define CDDB_TOUT  30*1000             // connection timeout (ms)
    1.16 +#define CDDB_CHARSET "ISO8859-1"       // data charset
    1.17  
    1.18  const char *cddbpath="/var/lib/cddb";  // default local cddb path
    1.19  
    1.20 @@ -410,7 +411,7 @@
    1.21    //
    1.22    cCDDBSong *GetTrack(const char *name, unsigned int pos);
    1.23    cCDDBSong *FindTrack(int tr);
    1.24 -  void Strcat(char * &store, char *value);
    1.25 +  void Strcat(char * &store, const char *value);
    1.26    bool Split(const char *source, char div, char * &first, char * &second, bool only3=false);
    1.27    void Put(const char *from, char * &to);
    1.28    void Clean(void);
    1.29 @@ -472,6 +473,7 @@
    1.30    DiscID=id->discid;
    1.31    FILE *f=fopen(filename,"r");
    1.32    if(f) {
    1.33 +    cCharSetConv csc(CDDB_CHARSET);
    1.34      char buff[1024];
    1.35      while(fgets(buff,sizeof(buff),f)) {
    1.36        int i=strlen(buff);
    1.37 @@ -484,7 +486,7 @@
    1.38          if(p) {
    1.39             *p=0;
    1.40             char *name =compactspace(buff);
    1.41 -           char *value=compactspace(p+1);
    1.42 +           const char *value=csc.Convert(compactspace(p+1));
    1.43             if(*name && *value) {
    1.44               if(!strcasecmp(name,"DTITLE")) Strcat(DTitle,value);
    1.45               else if(!strcasecmp(name,"EXTD")) Strcat(ExtD,value);
    1.46 @@ -588,7 +590,7 @@
    1.47    return false;
    1.48  }
    1.49  
    1.50 -void cCDDBDisc::Strcat(char * &store, char *value)
    1.51 +void cCDDBDisc::Strcat(char * &store, const char *value)
    1.52  {
    1.53    if(store) {
    1.54      char *n=MALLOC(char,strlen(store)+strlen(value)+1);
    1.55 @@ -828,6 +830,7 @@
    1.56    cCacheData *dat=InfoCache.Search(file);
    1.57    if(dat) {
    1.58      Set(dat); dat->Unlock();
    1.59 +    ConvertToSys();
    1.60      if(!DecoderID) {
    1.61        DecoderID=DEC_SND;
    1.62        InfoCache.Cache(this,file);
    1.63 @@ -850,7 +853,8 @@
    1.64  
    1.65    InfoDone();
    1.66    InfoCache.Cache(this,file);
    1.67 -  return Abort(true);  
    1.68 +  ConvertToSys();
    1.69 +  return Abort(true);
    1.70  }
    1.71  
    1.72  bool cSndInfo::CDDBLookup(const char *filename)