Function ogg_magic::utils::trim_ogg_vorbis_file

source ·
pub async fn trim_ogg_vorbis_file<R: AsyncReadExt + Unpin>(
    reader: R,
    tolerate: bool,
    header_search_range: usize,
) -> Result<Vec<OggVorbisPageResult>>
Expand description

Asynchronously trims an Ogg Vorbis file by removing segments before the first header and data after the last segment.

This function reads the Ogg Vorbis file, searches for the first header (Identification, Comment, or Setup), and removes all segments before this header. The trimmed file is returned as a vector of OggVorbisPageResult.

§Arguments

  • reader - An asynchronous reader implementing AsyncReadExt and Unpin.
  • tolerate - A boolean indicating whether to tolerate minor errors during reading.
  • header_search_range - The range in bytes to search for the header.

§Returns

A result containing a vector of OggVorbisPageResult if successful, or an io::Error if an error occurs.