Lame final class
Minn\Media\Av\Lame · public/minn/src/Minn/Media/Av/Lame.php · 135 lines
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.
Constants and properties
| private | MODES = array ( 0 => 'unk', 1 => 'cbr', 2 => 'abr', 3 => 'vbr', 4 => 'vbr', 5 => 'vbr', 6 => 'vbr', 8 => 'cbr', 9 => 'abr', 15 => 'res', ) | |
| private | UNNAMED = array ( 0 => 16, 1 => 24, 2 => 40, 3 => 56, 4 => 112, 5 => 128, 6 => 160, 7 => 192, 8 => 256, ) | Preset numbers from 8 to 319 that name no preset, so the mode's guess stands. |
| private | NAMED = array ( 320 => 'insane', 410 => '-V9', 420 => '-V8', 430 => 'radio', 440 => '-V6', 450 => 'portable', 460 => 'medium', 470 => '--r3mix', 480 => 'standard', 490 => '-V1', 500 => 'extreme', 1000 => '--r3mix', 1001 => '--alt-preset standard', 1002 => '--alt-preset extreme', 1003 => '--alt-preset insane', 1004 => '--alt-preset fast standard', 1005 => '--alt-preset fast extreme', 1006 => '--alt-preset medium', 1007 => '--alt-preset fast medium', 1010 => '--preset portable', 1015 => '--preset radio', ) | |
| private | LOWPASS = array ( 320 => array ( 0 => 20500, ), 450 => array ( ), 460 => array ( 0 => 18000, ), 470 => array ( 0 => 18000, 1 => 19500, ), 480 => array ( 0 => 19000, ), 500 => array ( 0 => 19500, ), 1000 => array ( 0 => 18000, 1 => 19500, ), 1001 => array ( 0 => 19000, ), 1002 => array ( 0 => 19500, ), 1003 => array ( 0 => 20500, ), 1004 => array ( 0 => 19000, ), 1005 => array ( 0 => 19500, ), 1006 => array ( 0 => 18000, ), 1007 => array ( 0 => 18000, ), 1010 => array ( ), ) | Each preset's own lowpass, which its options leave unsaid; a preset named here may add a different one. |
Public
| 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).
|
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | presetName(int $preset, int $method): ?string# | A preset number's name, or null when it names none and the mode's guess stands. |
| private | guess(int $method, ?int $quality, int|float $bitrate): string# | The options a mode suggests without a preset: the constant rate, "ABR", or the VBR level and quality. |
| private | resampled(int $class, int $sampleRate): bool# | Whether the stream's rate differs from the source's class (32 kHz or less, 44.1, 48, more than 48). |
Nothing matches.