Changeset 120:85463285ddbe in roaraudio


Ignore:
Timestamp:
07/13/08 15:03:19 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

now using roar_simple_new_stream_obj(), not an execed stream so we can do meta updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarvorbis.c

    r118 r120  
    3535 int    i; 
    3636 FILE * in; 
    37  int    out; 
     37 int    out = -1; 
    3838 struct roar_connection con; 
    3939 struct roar_stream     s; 
     
    4141 int eof=0; 
    4242 int current_section; 
     43 int last_section = -1; 
    4344 char pcmout[4096]; 
    4445 
     
    8687  fprintf(stderr, "Audio: %i channel, %liHz\n\n", vi->channels, vi->rate); 
    8788 
    88   if ( roar_stream_new(&s, vi->rate, vi->channels, bits, codec) == -1 ) { 
    89    roar_disconnect(&con); 
    90    return -1; 
    91   } 
    92  
    93   if ( roar_stream_connect(&con, &s, ROAR_DIR_PLAY) == -1 ) { 
     89  if ( (out = roar_simple_new_stream_obj(&con, &s, vi->rate, vi->channels, bits, codec, ROAR_DIR_PLAY)) == -1 ) { 
    9490   roar_disconnect(&con); 
    9591   return -1; 
     
    105101  meta.value = value; 
    106102  meta.key[0] = 0; 
     103 
     104  roar_stream_meta_set(&con, &s, ROAR_META_MODE_CLEAR, &meta); 
    107105 
    108106  meta.type = ROAR_META_TYPE_FILENAME; 
     
    131129 } 
    132130 
    133  if ( roar_stream_exec(&con, &s) == -1 ) { 
    134   roar_disconnect(&con); 
    135   return -1; 
    136  } 
    137    
    138131 while (!eof) { 
    139132  long ret = ov_read(&vf, pcmout, sizeof(pcmout), 0, 2, 1, &current_section); 
     133 
     134  last_section = current_section; 
     135 
    140136  if (ret == 0) { 
    141137   /* EOF */ 
     
    147143     /* we don't bother dealing with sample rate changes, etc, but 
    148144        you'll have to */ 
    149     write(con.fh, pcmout, ret); 
     145    write(out, pcmout, ret); 
    150146  } 
    151147 } 
     
    154150 
    155151// fclose(in); 
    156  close(con.fh); 
     152 close(out); 
     153 roar_disconnect(&con); 
    157154 
    158155 return 0; 
Note: See TracChangeset for help on using the changeset viewer.