| 326 | } |
| 327 | |
| 328 | BOOL LASreadPoint::seek(const U32 current, const U32 target) |
| 329 | { |
| 330 | if (!instream->isSeekable()) return FALSE; |
| 331 | U32 delta = 0; |
| 332 | if (dec) |
| 333 | { |
| 334 | if (point_start == 0) |
| 335 | { |
| 336 | init_dec(); |
| 337 | chunk_count = 0; |
| 338 | } |
| 339 | if (chunk_starts) |
| 340 | { |
| 341 | U32 target_chunk; |
| 342 | if (chunk_totals) |
| 343 | { |
| 344 | target_chunk = search_chunk_table(target, 0, number_chunks); |
| 345 | chunk_size = chunk_totals[target_chunk+1]-chunk_totals[target_chunk]; |
| 346 | delta = target - chunk_totals[target_chunk]; |
| 347 | } |
| 348 | else |
| 349 | { |
| 350 | target_chunk = target/chunk_size; |
| 351 | delta = target%chunk_size; |
| 352 | } |
| 353 | if (target_chunk >= tabled_chunks) |
| 354 | { |
| 355 | if (current_chunk < (tabled_chunks-1)) |
| 356 | { |
| 357 | dec->done(); |
| 358 | current_chunk = (tabled_chunks-1); |
| 359 | instream->seek(chunk_starts[current_chunk]); |
| 360 | init_dec(); |
| 361 | chunk_count = 0; |
| 362 | } |
| 363 | delta += (chunk_size*(target_chunk-current_chunk) - chunk_count); |
| 364 | } |
| 365 | else if (current_chunk != target_chunk || current > target) |
| 366 | { |
| 367 | dec->done(); |
| 368 | current_chunk = target_chunk; |
| 369 | instream->seek(chunk_starts[current_chunk]); |
| 370 | init_dec(); |
| 371 | chunk_count = 0; |
| 372 | } |
| 373 | else |
| 374 | { |
| 375 | delta = target - current; |
| 376 | } |
| 377 | } |
| 378 | else if (current > target) |
| 379 | { |
| 380 | dec->done(); |
| 381 | instream->seek(point_start); |
| 382 | init_dec(); |
| 383 | delta = target; |
| 384 | } |
| 385 | else if (current < target) |
no test coverage detected