InputStream *New_InputStream2( tsiMemObject *mem, InputStream *in, tt_uint32 offset, tt_uint32 length, int *errCode ) { InputStream *t; if ( errCode == NULL || (*errCode = setjmp( mem->env)) == 0 ) { /* try */ t = (InputStream*) tsi_AllocMem( mem, sizeof( InputStream ) ); t->mem = mem; t->privateBase = in->privateBase; #ifdef ENABLE_NON_RAM_STREAM t->ReadToRamFunc = in->ReadToRamFunc; t->nonRamID = in->nonRamID; t->cacheCount = 0; t->cachePosition = 0; #endif t->pos = offset; t->posZero = offset; t->maxPos = offset + length; t->bitBufferIn = 0; t->bitCountIn = 0; t->constructorType = 2; #ifdef USE_PRE_CACHING PreLoadT2KInputStream( t, length ); #endif } else { /* catch */ t = NULL; tsi_EmergencyShutDown( mem ); } return t; /*****/ }
int PrimeT2KInputStream(InputStream *t ) { tt_int32 n = t->maxPos - t->pos; if ( n > 8 ) n = 8; if ( t->bytesLeftToPreLoad > n ) n = t->bytesLeftToPreLoad; PreLoadT2KInputStream( t, n ); return 0; /*****/ }
int PrimeT2KInputStream(InputStream *t ) { long n = (long)(t->maxPos - t->pos); if ( n > 8 ) n = 8; if ( t->bytesLeftToPreLoad > n ) n = t->bytesLeftToPreLoad; if (n > (long)(t->maxPos - t->pos) ) n = (long)(t->maxPos - t->pos); PreLoadT2KInputStream( t, n ); return 0; /*****/ }