AvMetadata final class
Minn\Runtime\AvMetadata · public/minn/src/Minn/Runtime/AvMetadata.php · 252 lines
An audio or video file's metadata as WordPress's media readers keep it (wp_read_audio_metadata, wp_read_video_metadata; probe media-meta), from the engine's own analysis (Media\Av): an audio file's stream described whole, a video's size, format and codec with its audio beside, the playing time rounded and as a clock, when it was made, its ID3 tags and cover, each through the reader's filter.
Public
| static | audio(mixed $file): mixed# | An audio file's metadata (wp_read_audio_metadata); false when there is no such file. | |||
| static | video(mixed $file): mixed# | A video file's metadata (wp_read_video_metadata); false when there is no such file. | |||
| static | withTags(array $metadata, mixed $data): array# | Metadata with an analysis's ID3 tags added (wp_add_id3_tag_data): the first value under each name of the ID3v2 tag, or of the ID3v1 tag when there is no ID3v2 one, cleaned as post content; the length is left out, and a terms-of-use notice the tag cut short is mended.
@return array<string, mixed> | |||
| static | withCover(mixed $attachmentId, string $file, array $metadata, string $kind): array# | An audio or video attachment's metadata with its cover kept as an attachment of its own, as wp_generate_attachment_metadata keeps it: where the attachment type or the theme supports thumbnails, the cover (found again by its digest, or written beside the file as "name-ext-image") becomes the attachment's thumbnail; the cover's bytes leave the metadata either way.
@return array<string, mixed> | |||
| static | creationTimestamp(mixed $data): int|false# | When an analysed file was made (wp_get_media_creation_timestamp): a Windows Media file's creation date, a Matroska or WebM file's creation time (false when it is no date) or its date, or the time the first box of an MPEG-4 or QuickTime movie gives; false for any other. |
Internals 6
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | coverType(string $bytes): array# | A cover's extension and type, read from its bytes whatever the tag names (probe media-cover): a JPEG, PNG or GIF is what it is; anything else is kept as a .jpg of no type. @return array{0: string, 1: string} | ||||||
| private | cover(string $bytes, string $file): ?int# | The attachment a cover is kept as: one an earlier file made from the same bytes, or a new one. | ||||||
| private | common(array $metadata, array $data): array# | The size, type and playing time both readers record.
@return array<string, mixed> | ||||||
| private | finished(array $metadata, array $data): array# | What both readers add last: when the file was made, its tags and its cover (an ID3v2 picture with its size, any other without).
@return array<string, mixed> | ||||||
| private | withoutStreams(array $stream): array# | A stream's description without its per-stream list.
@return array<string, mixed> | ||||||
| private | cleaned(mixed $value): mixed# | A tag's value cleaned as post content, text inside a list included. |
Nothing matches.