Changeset 122:150a6d2fdfbc in roaraudio
- Timestamp:
- 07/13/08 15:30:14 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarvorbis.c
r121 r122 27 27 } 28 28 29 int update_stream (struct roar_connection * con, struct roar_stream * s, int * out, OggVorbis_File * vf, char * file ) {29 int update_stream (struct roar_connection * con, struct roar_stream * s, int * out, OggVorbis_File * vf, char * file, struct roar_audio_info * info) { 30 30 vorbis_info *vi = ov_info(vf, -1); 31 31 int bits = 16; … … 35 35 int j, h = 0; 36 36 struct roar_meta meta; 37 int need_new_stream = 0; 37 38 38 39 fprintf(stderr, "\n"); 39 40 40 if ( *out != -1 ) 41 if ( *out == -1 ) { 42 need_new_stream = 1; 43 } else if ( info->rate != vi->rate || info->channels != vi->channels ) { 44 need_new_stream = 1; 45 } 46 47 if ( need_new_stream ) { 48 if ( *out != -1 ) 41 49 close(*out); 42 50 43 fprintf(stderr, "Audio: %i channel, %liHz\n\n", vi->channels, vi->rate);51 fprintf(stderr, "Audio: %i channel, %liHz\n\n", vi->channels, vi->rate); 44 52 45 if ( (*out = roar_simple_new_stream_obj(con, s, vi->rate, vi->channels, bits, codec, ROAR_DIR_PLAY)) == -1 ) { 46 roar_disconnect(con); 47 return -1; 53 info->rate = vi->rate; 54 info->channels = vi->channels; 55 56 if ( (*out = roar_simple_new_stream_obj(con, s, vi->rate, vi->channels, bits, codec, ROAR_DIR_PLAY)) == -1 ) { 57 roar_disconnect(con); 58 return -1; 59 } 48 60 } 49 61 … … 91 103 int current_section; 92 104 int last_section = -1; 105 struct roar_audio_info info; 93 106 char pcmout[4096]; 94 107 … … 138 151 139 152 if ( last_section != current_section ) 140 if ( update_stream(&con, &s, &out, &vf, file ) == -1 )153 if ( update_stream(&con, &s, &out, &vf, file, &info) == -1 ) 141 154 return -1; 142 155
Note: See TracChangeset
for help on using the changeset viewer.