Skip to main content

start_decode

Function start_decode 

Source
pub fn start_decode<N, F>(
    first: SourceEntry,
    producer: Producer<f32>,
    seek_ms: u64,
    next_track: N,
    timeline: Arc<PlaybackTimeline>,
    viz_buffer: Option<Arc<VizBuffer>>,
    processing: Processing,
    on_finished: F,
) -> Result<DecodeHandle, DecodeError>
where N: Fn() -> Option<SourceEntry> + Send + 'static, F: FnOnce(&AtomicBool) + Send + 'static,
Expand description

Start decoding from a SourceEntry into the ring buffer.

first — the first track’s source entry. seek_ms — if > 0, seek to this position before decoding the first track. next_track — closure returning the next SourceEntry for gapless playback. Called on EOF. Returns None when the playlist is exhausted. on_finished — called on the decode thread at a natural end, with the stop flag. The player joins this thread once it sets that flag, so the closure must return promptly after it is set.