| 391 | } |
| 392 | |
| 393 | bool |
| 394 | MPDOpusDecoder::Seek(uint64_t where_frame) |
| 395 | { |
| 396 | assert(IsSeekable()); |
| 397 | assert(input_stream.IsSeekable()); |
| 398 | assert(input_stream.KnownSize()); |
| 399 | |
| 400 | const ogg_int64_t where_granulepos(where_frame); |
| 401 | |
| 402 | /* we don't know the exact granulepos after seeking, so let's |
| 403 | set it to -1 - it will be set after the next packet which |
| 404 | declares its granulepos */ |
| 405 | granulepos = -1; |
| 406 | |
| 407 | try { |
| 408 | SeekGranulePos(where_granulepos); |
| 409 | |
| 410 | /* since all frame numbers are offset by the file's |
| 411 | pre-skip value, we need to apply it here as well; |
| 412 | we could just seek to "where_frame+pre_skip" as |
| 413 | well, but I think by decoding those samples and |
| 414 | discard them, we're safer */ |
| 415 | skip = pre_skip; |
| 416 | return true; |
| 417 | } catch (...) { |
| 418 | return false; |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | void |
| 423 | mpd_opus_stream_decode(DecoderClient &client, |
no test coverage detected