Changeset 994:43a7c78b4bf9 in roaraudio for roard/codecfilter_fishsound.c
- Timestamp:
- 12/18/08 23:40:21 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/codecfilter_fishsound.c
r993 r994 40 40 } data; 41 41 42 ROAR_WARN("cf_fishsound_decoded_float(fsound=%p, pcm=%p, frames=%li, user_data=%p) = ?", fsound, pcm, frames, user_data); 43 44 ROAR_WARN("cf_fishsound_decoded_float(*): self->opened=%i", self->opened); 45 42 46 if (!self->opened) { 43 47 fish_sound_command(fsound, FISH_SOUND_GET_INFO, &(self->fsinfo), … … 45 49 } 46 50 47 if ( roar_buffer_new(&buf, frames*stream->info.bits*stream->info.channels ) == -1 )51 if ( roar_buffer_new(&buf, frames*stream->info.bits*stream->info.channels/8) == -1 ) 48 52 return -1; 49 53 … … 148 152 struct roar_stream * s = ROAR_STREAM(self->stream); 149 153 long inlen; 154 int need_data = 0; 155 struct roar_buffer_stats stats; 156 size_t stlen; 157 158 ROAR_WARN("cf_fishsound_read(inst=%p, buf=%p, len=%i) = ?", inst, buf, len); 150 159 151 160 /* … … 166 175 */ 167 176 168 if ( (inlen = stream_vio_s_read(self->stream, buf, len)) == -1 ) 169 return -1; 170 171 oggz_read_input(self->oggz, (unsigned char *)buf, inlen); 177 if ( self->buffer == NULL ) { 178 need_data = 1; 179 } else { 180 if ( roar_buffer_ring_stats(self->buffer, &stats) == -1 ) 181 return -1; 182 183 if ( stats.bytes < len ) 184 need_data = 1; 185 } 186 187 ROAR_WARN("cf_fishsound_read(*): need_data=%i, self->opened=%i", need_data, self->opened); 188 189 while (need_data) { 190 if ( (inlen = stream_vio_s_read(self->stream, buf, len)) == -1 ) 191 return -1; 192 193 oggz_read_input(self->oggz, (unsigned char *)buf, inlen); 194 195 if ( roar_buffer_ring_stats(self->buffer, &stats) == -1 ) 196 return -1; 197 198 if ( stats.bytes < len ) { 199 need_data = 1; 200 } else { 201 need_data = 0; 202 } 203 } 204 205 ROAR_WARN("cf_fishsound_read(*): need_data=%i, self->opened=%i", need_data, self->opened); 172 206 173 207 if ( !self->opened ) { … … 178 212 self->opened = 1; 179 213 errno = EAGAIN; 180 return -1; 181 } 182 183 return -1; 214 ROAR_WARN("cf_fishsound_read(inst=%p, buf=%p, len=%i) = -1 // errno=EAGAIN", inst, buf, len); 215 return -1; 216 } 217 218 // ok, now we should have all the data we want... 219 220 stlen = len; 221 if ( roar_buffer_shift_out(&(self->buffer), buf, &stlen) == -1 ) { 222 ROAR_WARN("cf_fishsound_read(inst=%p, buf=%p, len=%i) = -1 // roar_buffer_shift_out() failed", inst, buf, len); 223 return -1; 224 } 225 226 ROAR_WARN("cf_fishsound_read(inst=%p, buf=%p, len=%i) = %i", inst, buf, len, (int)stlen); 227 return stlen; 184 228 } 185 229
Note: See TracChangeset
for help on using the changeset viewer.