API / Minn\Media\Av / Ogg

Ogg final class

Minn\Media\Av\Ogg · public/minn/src/Minn/Media/Av/Ogg.php · 144 lines

Ogg files as the reference's media reader measures them (probe media-meta): Vorbis, Opus, or FLAC in its first packet. The audio is counted from the end of the comment header to the start of the last page, and the last page's granule position over the rate is the playing time (Opus's pre-skip included). A Vorbis stream's options are the quality its nominal bitrate stands for, when libVorbis made it in stereo at 44.1 or 48 kHz, and otherwise the nominal bitrate itself.

Used by 1

Constants and properties

privateSCAN = 1048576

Public

staticread(Minn\Media\Av\Source $source): array#

The file's analysis.

@return array<string, mixed>

Internals 5

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatepage(Minn\Media\Av\Source $source, int $at): ?array#

A page at an offset: where it starts and ends, its header length, granule position, its whole body and its first packet.

@return array{start: int, end: int, head: int, granule: int, body: string, packet: string}|null
privatelastPage(Minn\Media\Av\Source $source): ?array#

The last page of the file, found from its end.

@return array{start: int, end: int, head: int, granule: int, body: string, packet: string}|null
privatevendor(string $comment, int $skip): ?string#

The vendor string a comment header carries after its $skip-byte signature.

privateflacVendor(Minn\Media\Av\Source $source, int $at): ?string#

The vendor of an Ogg FLAC stream's comment block, in the page after its first.

privatevorbisOptions(int $nominal, int $channels, int $rate, string $vendor): ?string#

A Vorbis stream's options: its quality, or its nominal bitrate, or none without one.