MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / Seek

Method Seek

src/decoder/plugins/OpusDecoderPlugin.cxx:393–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393bool
394MPDOpusDecoder::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
422void
423mpd_opus_stream_decode(DecoderClient &client,

Callers 1

mpd_opus_stream_decodeFunction · 0.45

Calls 1

IsSeekableFunction · 0.85

Tested by

no test coverage detected