API / Minn\Media\Av / Source

Source final class

Minn\Media\Av\Source · public/minn/src/Minn/Media/Av/Source.php · 71 lines

A media file read in parts, so a large video is never loaded whole: its size, a run of bytes at an offset, and the integers the containers write. The file's first block is kept, since every reader starts there.

Constants and properties

privateHEAD = 262144
privatestring $head
privatemixed $handle

Promoted from the constructor.

propreadonly int $size

Promoted from the constructor.

propreadonly string $path

Promoted from the constructor.

Public

new__construct($handle, int $size, string $path)#
$handleresource
staticopen(string $path): ?self#

The file opened for reading, or null when it cannot be.

methodbytes(int $offset, int $length): string#

Up to $length bytes from $offset (fewer at the end of the file).

methodbigEndian(int $offset, int $width): int#

A big-endian unsigned integer of $width bytes (1 to 8) at $offset; 0 past the end.

methodlittleEndian(int $offset, int $width): int#

A little-endian unsigned integer of $width bytes (1 to 8) at $offset; 0 past the end.

staticbigEndianValue(string $bytes): int#

The unsigned integer a run of bytes spells, most significant first.

staticlittleEndianValue(string $bytes): int#

The unsigned integer a run of bytes spells, least significant first.

methodclose(): void#

The file let go.