Changeset 117:b3b15c6ff97d in roaraudio


Ignore:
Timestamp:
07/13/08 14:42:11 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

get channels and rate form the file, a bit better output of meta data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarvorbis.c

    r115 r117  
    2828 
    2929int main (int argc, char * argv[]) { 
    30  int    rate     = 44100; 
    3130 int    bits     = 16; 
    32  int    channels = 2; 
    3331 int    codec    = ROAR_CODEC_DEFAULT; 
    3432 char * server   = NULL; 
     
    6765 } 
    6866 
    69  if ( roar_stream_new(&s, rate, channels, bits, codec) == -1 ) { 
    70   roar_disconnect(&con); 
    71   return -1; 
    72  } 
    73  
    74  if ( roar_stream_connect(&con, &s, ROAR_DIR_PLAY) == -1 ) { 
    75   roar_disconnect(&con); 
    76   return -1; 
    77  } 
    78  
    7967 if ( (in = fopen(file, "rb")) == NULL ) { 
    8068  roar_disconnect(&con); 
     
    9987  struct roar_meta   meta; 
    10088 
     89  fprintf(stderr, "Audio: %i channel, %liHz\n\n", vi->channels, vi->rate); 
     90 
     91  if ( roar_stream_new(&s, vi->rate, vi->channels, bits, codec) == -1 ) { 
     92   roar_disconnect(&con); 
     93   return -1; 
     94  } 
     95 
     96  if ( roar_stream_connect(&con, &s, ROAR_DIR_PLAY) == -1 ) { 
     97   roar_disconnect(&con); 
     98   return -1; 
     99  } 
     100 
    101101  meta.value = value; 
    102102  meta.key[0] = 0; 
     
    106106  roar_stream_meta_set(&con, &s, ROAR_META_MODE_SET, &meta); 
    107107 
     108 
     109 
    108110  while(*ptr){ 
    109     fprintf(stderr,"%s\n",*ptr); 
    110  
    111111    for (j = 0; (*ptr)[j] != 0 && (*ptr)[j] != '='; j++) 
    112112     key[j] = (*ptr)[j]; 
     
    121121     roar_stream_meta_set(&con, &s, ROAR_META_MODE_SET, &meta); 
    122122 
     123    fprintf(stderr, "Meta %-16s: %s\n", key, value); 
    123124    ++ptr; 
    124125  } 
    125   fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate); 
    126   fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor); 
     126 
    127127 } 
    128128 
     
    132132 } 
    133133   
    134  while(!eof){ 
    135   long ret=ov_read(&vf,pcmout,sizeof(pcmout),0,2,1,&current_section); 
     134 while (!eof) { 
     135  long ret = ov_read(&vf, pcmout, sizeof(pcmout), 0, 2, 1, &current_section); 
    136136  if (ret == 0) { 
    137137   /* EOF */ 
Note: See TracChangeset for help on using the changeset viewer.