Minn\Media\Av
15 classes, 38 public methods and 78 internals. This page is the public surface; each class name opens the whole class.
Ac3 final class
public/minn/src/Minn/Media/Av/Ac3.php · 40 lines · Open the class →
An AC-3 (Dolby Digital) frame's header as the reference's media reader reads it (probe media-meta): the rate, bitrate and channels, the low frequency channel counted as ".1". The centre mix level is read for every odd coding mode, mono included, so a mono frame reads its next bits as the low frequency channel; the channel modes follow the coding mode.
| static | frame(string $bytes): ?array | A frame's rate, bitrate, channels (an integer, or "n.1" with the low frequency channel) and channel mode; null for bytes that are no frame. @return array{sampleRate: int, bitrate: int, channels: int|string, mode: string}|null |
Analyzer final class
public/minn/src/Minn/Media/Av/Analyzer.php · 114 lines · Open the class →
A media file's analysis, keyed as the reference's media reader keys the one it hands to the wp_read_audio_metadata and wp_read_video_metadata filters (probe media-meta): the file's size, format and type, its audio and video streams, its playing time and bitrate, and its tags. The format is found by the file's first bytes; a file named .mp3 with none is still typed as MPEG audio.
| static | analyze(string $path): ?array | The analysis of the file at a path; null when there is no such file. @return array<string, mixed>|null |
| static | playtimeString(int|float $seconds): string | A playing time as a clock: minutes and seconds, with hours past the first. |
| inside | analyzed(), stream(), mpeg() |
Asf final class
public/minn/src/Minn/Media/Av/Asf.php · 182 lines · Open the class →
Advanced Systems Format files (WMV, WMA, ASF) as the reference's media reader measures them (probe media-meta). The file properties give the playing time (less the preroll) and creation date; each stream's properties its size or wave format; the codec list the names; the stream bitrates the bitrate, the file's being their sum. A video file with no audio still describes an empty ASF audio stream.
| static | detects(string $head): bool | Whether a file's first bytes are an ASF header object. |
| static | read(Minn\Media\Av\Source $source): array | The file's analysis. @return array<string, mixed> |
| inside | bitrates(), codecs(), video(), audio() |
ExpGolomb final class
public/minn/src/Minn/Media/Av/ExpGolomb.php · 50 lines · Open the class →
A bit reader over a byte string for the exponential-Golomb codes of a video parameter set: single bits, unsigned and signed codes. Reading past the end reads zeros, and a code longer than 32 bits stops at 32.
| new | __construct(string $bytes) | |
| method | bit(): int | The next bit. |
| method | skip(int $count): void | Passes over a number of bits. |
| method | exhausted(): bool | Whether every bit has been read (what follows reads as zeros). |
| method | unsigned(): int | The next unsigned exponential-Golomb code. |
| method | signed(): int | The next signed exponential-Golomb code. |
Flac final class
public/minn/src/Minn/Media/Av/Flac.php · 115 lines · Open the class →
FLAC, on its own or as the first packet of an Ogg stream, as the reference's media reader measures it (probe media-meta): the stream information block gives the rate, channels, depth and samples, the comment block names the encoder, and a picture block is the cover.
| static | read(Minn\Media\Av\Source $source): array | A native FLAC file's analysis: the data after the metadata blocks, the playing time from the sample count and a bitrate over the whole file. @return array<string, mixed> |
| static | stream(array $info, int|float|null $bitrate, ?string $vendor): array | The stream a FLAC stream information block and vendor describe, with the bitrate when one is known. @param array{sampleRate: int, channels: int, bits: int, samples: int} $info@return array<string, mixed> |
| static | streamInfo(string $block): ?array | A stream information block's rate, channels, depth and sample count. @return array{sampleRate: int, channels: int, bits: int, samples: int}|null |
| inside | blocks(), picture() |
Flv final class
public/minn/src/Minn/Media/Av/Flv.php · 215 lines · Open the class →
Flash video (FLV) as the reference's media reader measures it (probe media-meta). The onMetaData script tag gives the playing time, frame rate, data rates and codecs; the first audio tag gives the rate, sample size and channels; the first video tag's Sorenson picture header the size, or for H.264 its sequence parameter set, read as the reference reads it. The video's data rate is kept as written (kilobits), the audio's made bits; a file with no audio and no video rate gives the video the file's own rate.
| static | read(Minn\Media\Av\Source $source): array | The file's analysis. @return array<string, mixed> |
| inside | audio(), video(), pictureSize(), avcSize(), number(), metaData() |
Genres final class
public/minn/src/Minn/Media/Av/Genres.php · 15 lines · Open the class →
The genre names an ID3 tag refers to by number: the ID3v1 list with the Winamp additions (0 to 191) and a later run from 240. An ID3v2 genre names an unknown number as an empty string, and 255 as "Unknown"; an ID3v1 tag names neither (probe media-meta).
| static | name(int $number): ?string | The name for a number, or null for a number with none. |
Id3 final class
public/minn/src/Minn/Media/Av/Id3.php · 356 lines · Open the class →
ID3 tags, as the reference's audio reader names what they say (probe media-meta): an ID3v2 tag (versions 2.2 to 2.4) at the start of a file and an ID3v1 tag in its last 128 bytes. Each frame the reader knows becomes a named list of values in the order the frames come; one it does not know (a play count, a private frame, a podcast flag) is left out. ID3v2 text is made UTF-8 whatever its encoding; ID3v1 text is kept as its bytes.
| static | v2(Minn\Media\Av\Source $source): ?array | The ID3v2 tag at the start of a file: where the bytes after it begin, its version, its named values and its pictures; null with no tag. @return array{end: int, version: int, comments: array<string, list<string>>, pictures: list<array<string, mixed>>}|null |
| static | v1(Minn\Media\Av\Source $source): ?array | The ID3v1 tag in a file's last 128 bytes: the title, artist, album, year and comment (kept when empty), the track of a version 1.1 tag and the named genre; null with no tag. @return array<string, list<string|int>>|null |
| inside | frames(), frameData(), values(), afterDescription(), terminator(), decoded(), utf16(), terminatorLength(), attachedPicture(), olderPicture(), pictureBytes(), genres(), numbered(), syncsafe(), names() |
IsoMedia final class
public/minn/src/Minn/Media/Av/IsoMedia.php · 364 lines · Open the class →
MPEG-4 and QuickTime files (MP4, M4A, M4V, MOV) as the reference's media reader measures them (probe media-meta). The movie header gives the playing time and the time it was made; each track's first sample entry gives its codec. Only AAC ("mp4a") is read as audio, and it alone makes a file audio/mp4 (or video/mp4 beside a video track); anything else is video/quicktime. A video entry with a vendor is read the QuickTime way (its compressor's name, lossless false); one without, the ISO way (a named codec, and "mp4" as the format for the codecs it knows). Only H.264 and MPEG-4 video have the bitrate the audio leaves.
| static | detects(string $head): bool | Whether a file's first bytes are an MPEG-4 or QuickTime box. |
| static | read(Minn\Media\Av\Source $source): array | The file's analysis: format, type, playing time and bitrate, the audio and video streams, the movie header for its creation time and the cover. @return array<string, mixed> |
| inside | movie(), boxHeader(), children(), find(), movieHeader(), track(), aac(), averageBitrate(), afterLength(), videoEntry(), cover(), ordered(), videoCodecs() |
Lame final class
public/minn/src/Minn/Media/Av/Lame.php · 135 lines · Open the class →
The LAME tag an encoder writes after the Xing or Info counts, and what the reference's audio reader makes of it (probe media-meta): the bitrate method names the bitrate mode, and the encoder options are guessed from the preset number, or failing that from the mode, then the minimum bitrate, gapless encoding, a lowpass other than the preset's own and a resampled rate follow.
| static | fields(string $tag): array | The tag's fields from its 36 bytes: the encoder, the bitrate method, lowpass, encoding flags, the minimum or average bitrate, the source's sample rate class and the preset number. An encoder that is not LAME leaves only its name. @return array<string, mixed> |
| static | mode(int $method): string | The bitrate mode a LAME tag's method names ("cbr", "abr", "vbr"; "unk", "res" or empty for the rest). |
| static | options(?array $info, int $sampleRate, int|float $bitrate, int $headerBitrate): string | The options a file was most likely encoded with, from its LAME tag (or "CBR" and the bitrate without an Xing frame, "VBR" with one from another encoder). @param array<string, mixed>|null $info the Xing or Info frame and its LAME tag |
| inside | presetName(), guess(), resampled() |
Matroska final class
public/minn/src/Minn/Media/Av/Matroska.php · 314 lines · Open the class →
Matroska and WebM files (MKV, MKA, WebM) as the reference's media reader measures them (probe media-meta). The segment information gives the playing time and the date; the first video and audio tracks give the streams, named by their codec where the reader knows it (and by the codec identifier where it does not). MP3 and MP2 audio is described from its first frame, FLAC from its stream information, AC-3 from its first frame; the bitrate is the file's over its playing time, the video keeping what a known audio bitrate leaves.
| static | detects(string $head): bool | Whether a file's first bytes are an EBML header. |
| static | read(Minn\Media\Av\Source $source): array | The file's analysis. @return array<string, mixed> |
| inside | walk(), element(), audio(), video(), firstBlock(), blockFor(), identifier(), size(), float(), signed() |
Mpeg final class
public/minn/src/Minn/Media/Av/Mpeg.php · 215 lines · Open the class →
MPEG audio (MP3, and layers 1 and 2) as the reference's audio reader measures it (probe media-meta). The first frame gives the version, layer, sample rate and channels. An Xing or Info frame (written by LAME and most encoders) gives the frame and byte counts: a variable bitrate is the bytes over the frames' duration, and the playing time is the audio's bytes less one average frame, at that bitrate. Without one the bitrate is the first frame's and the playing time is every byte at it.
| static | read(Minn\Media\Av\Source $source, int $start, int $end): ?array | The audio from $start (after any ID3v2 tag) to $end (before any ID3v1 tag): the stream's description, its bitrate and playing time, and where its frames lie; null when no frame is found. @return array{audio: array<string, mixed>, bitrate: int|float, playtime_seconds: int|float, avdataoffset: int, avdataend: int}|null |
| static | frameHeader(int $word): ?array | A frame header's fields; null for one that is not valid MPEG audio: no sync, a reserved version or layer, a free or bad bitrate, or a reserved sample rate. @return array{version: int, layer: int, bitrate: int, sampleRate: int, padding: int, mode: int, channels: int, samples: int, length: int}|null |
| static | scan(Minn\Media\Av\Source $source, int $start, int $end): ?array | The frames of a stream from an offset to an end, as the reference measures them inside another container (probe media-meta): data that does not begin with a frame has none; the stream starts where 51 frames follow one another (or fewer that run to the end), the first of them its first; when those frames share a rate it is the stream's, and otherwise every frame to the end counts toward the mean, past any bytes between them. Null when no frame is found. @return array{first: array<string, int>, bitrate: float, variable: bool}|null |
| inside | firstFrame(), run(), nextFrame(), infoFrame() |
Ogg final class
public/minn/src/Minn/Media/Av/Ogg.php · 144 lines · Open the class →
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.
| static | read(Minn\Media\Av\Source $source): array | The file's analysis. @return array<string, mixed> |
| inside | page(), lastPage(), vendor(), flacVendor(), vorbisOptions() |
Riff final class
public/minn/src/Minn/Media/Av/Riff.php · 351 lines · Open the class →
RIFF files, WAV audio and AVI video, as the reference's media reader measures them (probe media-meta). A WAV's format chunk describes its stream (the codec named by its format tag, lossless only for PCM) and its data chunk times it. An AVI's headers give the frames and their rate, each stream's format, and the movie list that holds the data; its video has the bitrate the audio's leaves. MP3 audio in an AVI (or in a WAV that states its rate) is described from its first frame.
| static | detects(string $head): bool | Whether a file's first bytes are a RIFF WAVE or AVI file. |
| static | read(Minn\Media\Av\Source $source): array | The file's analysis: format, type, timing and its streams. @return array<string, mixed> |
| static | videoCodec(string $code): string | The name an AVI video codec code has; empty for one it does not know. |
| inside | wave(), avi(), chunks(), stream(), waveFormat(), audio(), scannedAudio(), ac3Audio(), mpegAudio(), firstAudioFrame(), video(), formatName(), videoCodecs() |
Source final class
public/minn/src/Minn/Media/Av/Source.php · 71 lines · Open the class →
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.
| prop | readonly int $size | |
| prop | readonly string $path | |
| static | open(string $path): ?self | The file opened for reading, or null when it cannot be. |
| method | bytes(int $offset, int $length): string | Up to $length bytes from $offset (fewer at the end of the file). |
| method | bigEndian(int $offset, int $width): int | A big-endian unsigned integer of $width bytes (1 to 8) at $offset; 0 past the end. |
| method | littleEndian(int $offset, int $width): int | A little-endian unsigned integer of $width bytes (1 to 8) at $offset; 0 past the end. |
| static | bigEndianValue(string $bytes): int | The unsigned integer a run of bytes spells, most significant first. |
| static | littleEndianValue(string $bytes): int | The unsigned integer a run of bytes spells, least significant first. |
| method | close(): void | The file let go. |
Nothing matches.