Struct ogg_pager::Page[][src]

pub struct Page {
    pub abgp: u64,
    pub serial: u32,
    pub seq_num: u32,
    pub start: u64,
    pub end: u64,
    // some fields omitted
}
Expand description

An OGG page

Fields

abgp: u64

The page’s absolute granule position

serial: u32

The page’s stream serial number

seq_num: u32

The page’s sequence number

start: u64

The position in the stream the page started at

end: u64

The position in the stream the page ended

Implementations

Create a new Page

This will have the following defaults:

  • checksum = 0
  • start = 0
  • end = content.len()
Errors

See segment_table

Example
use ogg_pager::CONTAINS_FIRST_PAGE_OF_BITSTREAM;

// Creating the identification header
let ident_header_packet = vec![...];
let stream_serial_number = 2784419176;

let page = Page::new(
    CONTAINS_FIRST_PAGE_OF_BITSTREAM,
    0,
    stream_serial_number,
    ident_header_packet,
);

Convert the Page to Vec for writing

NOTE: This will write the checksum as is. It is likely Page::gen_crc will have to be used prior.

Attempts to get a Page from a reader

Use skip_content to only read the header, and skip over the content.

Errors

Generates the CRC checksum of the page

Extends the Page’s content, returning another Page if too much data was provided

This will do nothing if content is greater than the max page size. In this case, paginate should be used.

Returns the page’s content

Consumes the page and returns it’s content

Returns the page’s header type flag

Returns the page’s checksum

Returns the page’s segment table

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.