Changeset 994:43a7c78b4bf9 in roaraudio for roard/codecfilter_fishsound.c


Ignore:
Timestamp:
12/18/08 23:40:21 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

seems that I got it finally rung experimental

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/codecfilter_fishsound.c

    r993 r994  
    4040 } data; 
    4141 
     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 
    4246 if (!self->opened) { 
    4347   fish_sound_command(fsound, FISH_SOUND_GET_INFO, &(self->fsinfo), 
     
    4549 } 
    4650 
    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 ) 
    4852  return -1; 
    4953 
     
    148152 struct roar_stream * s = ROAR_STREAM(self->stream); 
    149153 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); 
    150159 
    151160/* 
     
    166175*/ 
    167176 
    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); 
    172206 
    173207 if ( !self->opened ) { 
     
    178212  self->opened     = 1; 
    179213  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; 
    184228} 
    185229 
Note: See TracChangeset for help on using the changeset viewer.