- /* seek within this stream if possible, else use plain old read and discard */
- stream_sys_t *p_sys = s->p_sys;
- access_t *p_access = p_sys->p_access;
- vlc_bool_t b_aseek;
- access2_Control( p_access, ACCESS_CAN_SEEK, &b_aseek );
- if( b_aseek )
- return AStreamSeekStream( s, p_sys->i_pos + i_read ) ? 0 : i_read;
- }
-
-#ifdef STREAM_DEBUG
- msg_Dbg( s, "AStreamReadStream: %d pos="I64Fd" tk=%d start="I64Fd
- " offset=%d end="I64Fd,
- i_read, p_sys->i_pos, p_sys->stream.i_tk,
- tk->i_start, p_sys->stream.i_offset, tk->i_end );
-#endif
-
- while( i_data < i_read )
- {
- int i_off = (tk->i_start + p_sys->stream.i_offset) %
- STREAM_CACHE_TRACK_SIZE;
- int i_current =
- __MIN( tk->i_end - tk->i_start - p_sys->stream.i_offset,
- STREAM_CACHE_TRACK_SIZE - i_off );
- int i_copy = __MIN( i_current, i_read - i_data );
-
- if( i_copy <= 0 ) break; /* EOF */