Changeset 207:07ebcec64ab8 in roaraudio


Ignore:
Timestamp:
07/21/08 01:47:38 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

basic meta data support

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/codecfilter_vorbis.c

    r206 r207  
    6767   break; 
    6868  } else { 
     69   if ( self->last_section != self->current_section ) 
     70    if ( cf_vorbis_update_stream(self) == -1 ) 
     71     return 0; 
     72 
     73   self->last_section = self->current_section; 
    6974   todo -= r; 
    7075   done += r; 
     
    8287} 
    8388 
     89int cf_vorbis_update_stream (struct codecfilter_vorbis_inst * self) { 
     90 vorbis_info *vi = ov_info(&(self->vf), -1); 
     91 char **ptr = ov_comment(&(self->vf), -1)->user_comments; 
     92 char key[80] = {0}, value[80] = {0}; 
     93 struct roar_stream * s = (struct roar_stream *) self->stream; 
     94 int type; 
     95 int j, h = 0; 
     96 
     97 s->info.channels = vi->channels; 
     98 s->info.rate     = vi->rate; 
     99 s->info.bits     = 16; 
     100 s->info.codec    = ROAR_CODEC_DEFAULT; 
     101 
     102 stream_meta_clear(s->id); 
     103 
     104 while(*ptr){ 
     105   for (j = 0; (*ptr)[j] != 0 && (*ptr)[j] != '='; j++) 
     106    key[j] = (*ptr)[j]; 
     107    key[j] = 0; 
     108 
     109   for (j++, h = 0; (*ptr)[j] != 0 && (*ptr)[j] != '='; j++) 
     110    value[h++] = (*ptr)[j]; 
     111    value[h]   = 0; 
     112 
     113   type = roar_meta_inttype(key); 
     114   if ( type != -1 ) 
     115    stream_meta_set(s->id, type, "", value); 
     116 
     117   ROAR_DBG("cf_vorbis_update_stream(*): Meta %-16s: %s", key, value); 
     118   ++ptr; 
     119 } 
     120 
     121 return 0; 
     122} 
     123 
    84124//ll 
  • roard/include/codecfilter_vorbis.h

    r205 r207  
    2525int cf_vorbis_read(CODECFILTER_USERDATA_T   inst, char * buf, int len); 
    2626 
     27int cf_vorbis_update_stream (struct codecfilter_vorbis_inst * self); 
     28 
    2729#endif 
    2830 
Note: See TracChangeset for help on using the changeset viewer.