Changeset 3043:ddabf4ccc93e in roaraudio for roarclients/roarvorbis.c
- Timestamp:
- 11/29/09 10:54:00 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarvorbis.c
r2568 r3043 47 47 printf(" --server SERVER - Set server hostname\n" 48 48 " --help - Show this help\n" 49 " --vclt-out FILE - Writes VCLT file\n" 49 50 ); 50 51 … … 65 66 } 66 67 67 int update_stream (struct roar_connection * con, struct roar_stream * s, int * out, OggVorbis_File * vf, char * file, struct roar_audio_info * info ) {68 int 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) { 68 69 vorbis_info *vi = ov_info(vf, -1); 69 70 int bits = 16; … … 146 147 fprintf(stderr, "Meta %-16s: %s\n", key, value); 147 148 149 if ( vclt != NULL ) { 150 roar_vio_printf(vclt, "%s=%s\n", key, value); 151 } 152 148 153 meta.type = roar_meta_inttype(key); 149 154 if ( meta.type != -1 ) … … 159 164 roar_stream_meta_set(con, s, ROAR_META_MODE_FINALIZE, &meta); 160 165 166 if ( vclt != NULL ) { 167 roar_vio_printf(vclt, "==\n"); 168 } 169 161 170 return 0; 162 171 } … … 165 174 166 175 int main (int argc, char * argv[]) { 176 struct roar_vio_calls vclt; 177 struct roar_vio_defaults def; 167 178 #ifndef ROAR_HAVE_LIBVORBISFILE 168 179 fprintf(stderr, "Error: no Vorbis support!\n"); … … 171 182 char * server = NULL; 172 183 char * file = NULL; 184 char * vcltfile = NULL; 173 185 char * k; 174 186 int i; … … 190 202 if ( strcmp(k, "--server") == 0 ) { 191 203 server = argv[++i]; 204 } else if ( strcmp(k, "--vclt-out") == 0 ) { 205 vcltfile = argv[++i]; 192 206 } else if ( strcmp(k, "--help") == 0 ) { 193 207 usage(); … … 235 249 } 236 250 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 237 260 // if ( update_stream(&con, &s, &out, &vf, file) == -1 ) 238 261 // return 1; … … 242 265 243 266 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 ) 245 268 return 1; 246 269 … … 267 290 roar_disconnect(&con); 268 291 292 if ( vcltfile != NULL ) { 293 roar_vio_close(&vclt); 294 } 295 269 296 return 0; 270 297 #endif
Note: See TracChangeset
for help on using the changeset viewer.