Changeset 3043:ddabf4ccc93e in roaraudio


Ignore:
Timestamp:
11/29/09 10:54:00 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

support for writing VCLT

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarvorbis.c

    r2568 r3043  
    4747 printf("  --server SERVER    - Set server hostname\n" 
    4848        "  --help             - Show this help\n" 
     49        "  --vclt-out FILE    - Writes VCLT file\n" 
    4950       ); 
    5051 
     
    6566} 
    6667 
    67 int update_stream (struct roar_connection * con, struct roar_stream * s, int * out, OggVorbis_File * vf, char * file, struct roar_audio_info * info) { 
     68int update_stream (struct roar_connection * con, struct roar_stream * s, int * out, OggVorbis_File * vf, char * file, struct roar_audio_info * info, struct roar_vio_calls * vclt) { 
    6869 vorbis_info *vi = ov_info(vf, -1); 
    6970 int    bits     = 16; 
     
    146147    fprintf(stderr, "Meta %-16s: %s\n", key, value); 
    147148 
     149    if ( vclt != NULL ) { 
     150     roar_vio_printf(vclt, "%s=%s\n", key, value); 
     151    } 
     152 
    148153    meta.type = roar_meta_inttype(key); 
    149154    if ( meta.type != -1 ) 
     
    159164 roar_stream_meta_set(con, s, ROAR_META_MODE_FINALIZE, &meta); 
    160165 
     166 if ( vclt != NULL ) { 
     167  roar_vio_printf(vclt, "==\n"); 
     168 } 
     169 
    161170 return 0; 
    162171} 
     
    165174 
    166175int main (int argc, char * argv[]) { 
     176 struct roar_vio_calls vclt; 
     177 struct roar_vio_defaults def; 
    167178#ifndef ROAR_HAVE_LIBVORBISFILE 
    168179 fprintf(stderr, "Error: no Vorbis support!\n"); 
     
    171182 char * server   = NULL; 
    172183 char * file     = NULL; 
     184 char * vcltfile = NULL; 
    173185 char * k; 
    174186 int    i; 
     
    190202  if ( strcmp(k, "--server") == 0 ) { 
    191203   server = argv[++i]; 
     204  } else if ( strcmp(k, "--vclt-out") == 0 ) { 
     205   vcltfile = argv[++i]; 
    192206  } else if ( strcmp(k, "--help") == 0 ) { 
    193207   usage(); 
     
    235249 } 
    236250 
     251 if ( vcltfile != NULL ) { 
     252  if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_WRONLY|O_CREAT|O_APPEND, 0644) == -1 ) 
     253   return 1; 
     254  if ( roar_vio_open_dstr(&vclt, vcltfile, &def, 1) == -1 ) { 
     255   fprintf(stderr, "Error: can not open file: %s: %s\n", k, strerror(errno)); 
     256   return 1; 
     257  } 
     258 } 
     259 
    237260// if ( update_stream(&con, &s, &out, &vf, file) == -1 ) 
    238261//  return 1; 
     
    242265 
    243266  if ( last_section != current_section ) 
    244    if ( update_stream(&con, &s, &out, &vf, file, &info) == -1 ) 
     267   if ( update_stream(&con, &s, &out, &vf, file, &info, vcltfile == NULL ? NULL : &vclt) == -1 ) 
    245268    return 1; 
    246269 
     
    267290 roar_disconnect(&con); 
    268291 
     292 if ( vcltfile != NULL ) { 
     293  roar_vio_close(&vclt); 
     294 } 
     295 
    269296 return 0; 
    270297#endif 
Note: See TracChangeset for help on using the changeset viewer.