Changeset 716:a5426a9dd6c4 in roaraudio


Ignore:
Timestamp:
08/30/08 16:20:06 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

hope I fixed the bug reported by stephan48

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/codecfilter_vorbis.c

    r668 r716  
    252252 vorbis_info *vi = ov_info(&(self->vf), -1); 
    253253 char **ptr = ov_comment(&(self->vf), -1)->user_comments; 
    254  char key[80] = {0}, value[80] = {0}; 
     254 char key[ROAR_META_MAX_NAMELEN] = {0}, value[LIBROAR_BUFFER_MSGDATA] = {0}; 
    255255 struct roar_stream * s = ROAR_STREAM(self->stream); 
    256256 int type; 
    257257 int j, h = 0; 
    258258 float rpg_track = 0, rpg_album = 0; 
     259 int meta_ok; 
    259260 
    260261 s->info.channels = vi->channels; 
     
    266267 
    267268 while(*ptr){ 
    268    for (j = 0; (*ptr)[j] != 0 && (*ptr)[j] != '='; j++) 
     269  meta_ok = 1; 
     270 
     271   for (j = 0; (*ptr)[j] != 0 && (*ptr)[j] != '='; j++) { 
     272    if ( j == ROAR_META_MAX_NAMELEN ) { 
     273     ROAR_ERR("cf_vorbis_update_stream(*): invalid meta data on stream %i: meta data key too long", s->id); 
     274     meta_ok = 0; 
     275     j = 0; 
     276     break; 
     277    } 
    269278    key[j] = (*ptr)[j]; 
    270     key[j] = 0; 
    271  
    272    for (j++, h = 0; (*ptr)[j] != 0 && (*ptr)[j] != '='; j++) 
    273     value[h++] = (*ptr)[j]; 
     279   } 
     280   key[j] = 0; 
     281 
     282   if ( meta_ok ) { 
     283    for (j++, h = 0; (*ptr)[j] != 0 && (*ptr)[j] != '='; j++) { 
     284     if ( h == LIBROAR_BUFFER_MSGDATA ) { 
     285      ROAR_ERR("update_stream(*): invalid meta data on stream %i: meta data value for key '%s' too long", s->id, key); 
     286      meta_ok = 1; 
     287      h = 0; 
     288      break; 
     289     } 
     290     value[h++] = (*ptr)[j]; 
     291    } 
    274292    value[h]   = 0; 
    275  
    276    type = roar_meta_inttype(key); 
    277    if ( type != -1 ) 
    278     stream_meta_set(s->id, type, "", value); 
    279  
    280    ROAR_DBG("cf_vorbis_update_stream(*): Meta %-16s: %s", key, value); 
    281  
    282    if ( strcmp(key, "REPLAYGAIN_TRACK_PEAK") == 0 ) { 
    283     rpg_track = 1/atof(value); 
     293   } 
     294 
     295   if ( meta_ok ) { 
     296    type = roar_meta_inttype(key); 
     297    if ( type != -1 ) 
     298     stream_meta_set(s->id, type, "", value); 
     299 
     300    ROAR_DBG("cf_vorbis_update_stream(*): Meta %-16s: %s", key, value); 
     301 
     302    if ( strcmp(key, "REPLAYGAIN_TRACK_PEAK") == 0 ) { 
     303     rpg_track = 1/atof(value); 
    284304/* 
    285    } else if ( strcmp(key, "REPLAYGAIN_TRACK_GAIN") == 0 ) { 
    286     rpg_track = powf(10, atof(value)/20); 
     305    } else if ( strcmp(key, "REPLAYGAIN_TRACK_GAIN") == 0 ) { 
     306     rpg_track = powf(10, atof(value)/20); 
    287307*/ 
    288    } else if ( strcmp(key, "REPLAYGAIN_ALBUM_PEAK") == 0 ) { 
    289     rpg_album = 1/atof(value); 
     308    } else if ( strcmp(key, "REPLAYGAIN_ALBUM_PEAK") == 0 ) { 
     309     rpg_album = 1/atof(value); 
    290310/*  
    291    } else if ( strcmp(key, "REPLAYGAIN_ALBUM_GAIN") == 0 ) { 
    292     rpg_album = powf(10, atof(value)/20); 
     311    } else if ( strcmp(key, "REPLAYGAIN_ALBUM_GAIN") == 0 ) { 
     312     rpg_album = powf(10, atof(value)/20); 
    293313*/ 
    294    } 
    295  
    296    ++ptr; 
     314    } 
     315   } 
     316 
     317   ptr++; 
    297318 } 
    298319 
Note: See TracChangeset for help on using the changeset viewer.