Bånder

MediaMeta
in package

MediaMeta provides a unified interface for reading ID3 tags from audio files.

It supports both ID3v1 and ID3v2 formats and can extract image data from APIC tags.

Table of Contents

Constants

IMAGE_ARTIST  = 8
IMAGE_BAND  = 10
IMAGE_BAND_LOGO  = 19
IMAGE_COMPOSER  = 11
IMAGE_CONDUCTOR  = 9
IMAGE_COVER_BACK  = 4
IMAGE_COVER_FRONT  = 3
IMAGE_DURING_PERFORMANCE  = 15
IMAGE_DURING_RECORDING  = 14
IMAGE_FILE_ICON  = 1
IMAGE_FISH  = 17
IMAGE_ILLUSTRATION  = 18
IMAGE_LEAD_ARTIST  = 7
IMAGE_LEAFLET  = 5
IMAGE_LYRICIST  = 12
IMAGE_MEDIA  = 6
IMAGE_OTHER  = 0
IMAGE_OTHER_FILE_ICON  = 2
IMAGE_PUBLISHER_LOGO  = 20
IMAGE_RECORDING_LOCATION  = 13
IMAGE_SCREEN_CAPTURE  = 16
LOG_TAG  = 'MediaMeta '

Properties

$encoding  : int
$filePath  : string
$id3v1  : Id3v1|null
$id3v2  : Id3v2|null
$ffmpeg  : FFMpeg|null
$streamCollection  : StreamCollection|null

Methods

__construct()  : mixed
Create a new MediaMeta instance.
getAlbum()  : string|null
Get the album of the audio file.
getAlbumFrame()  : TALB|null
Get the album frame of the audio file.
getArtist()  : array<string|int, mixed>|string|null
Get the artist of the audio file.
getArtistFrame()  : TPE1|null
Get the artist frame of the audio file.
getArtistImage()  : Apic|null
Get the artist image from the audio file.
getArtists()  : array<string|int, string>
Get the artists of the audio file as an array.
getBackCoverImage()  : Apic|null
Get the back cover image from the audio file.
getComment()  : string|null
Get the first comment of the audio file.
getCommentFrame()  : COMM|null
Get the first comment frame of the audio file.
getCommentFrameByDescription()  : COMM|null
Get a comment frame with the given description.
getComments()  : array<string|int, COMM>
Get the comments of the audio file.
getEncoding()  : int
Get the preferred text encoding for ID3v2 tags.
getFrontCoverImage()  : Apic|null
Get the front cover image from the audio file.
getFrontCoverImageData()  : string|null
Get the front cover image data from the audio file.
getGenre()  : string|null
Get the genre of the audio file.
getGenreFrame()  : TCON|null
Get the genre frame of the audio file.
getID3v1()  : Id3v1
Get the ID3v1 tag reader.
getID3v2()  : Id3v2
Get the ID3v2 tag reader.
getImage()  : Apic|null
Get the first APIC frame (image) from the audio file.
getImageByType()  : Apic|null
Get the first APIC frame (image) of a specific type from the audio file.
getImageData()  : string|null
Get the image data from the first APIC frame.
getImageDataByType()  : string|null
Get the image data from a specific type of APIC frame.
getImageDescription()  : string|null
Get the image description of the first APIC frame.
getImageDescriptionByType()  : string|null
Get the image description of a specific type of APIC frame.
getImageMimeType()  : string|null
Get the MIME type of the first APIC frame.
getImageMimeTypeByType()  : string|null
Get the MIME type of a specific type of APIC frame.
getImages()  : array<string|int, Apic>
Get all APIC frames (images) from the audio file.
getImagesByType()  : array<string|int, Apic>
Get APIC frames (images) of a specific type from the audio file.
getImageType()  : int|null
Get the image type of the first APIC frame.
getMimeType()  : string
getTitle()  : string|null
Get the title of the audio file.
getTitleFrame()  : TIT2|null
Get the title frame of the audio file.
getTrackNumber()  : int|null
Get the track number
getYear()  : string|null
Get the year of the audio file.
getYearFrame()  : TYER|null
Get the year frame of the audio file.
isAudioFile()  : bool
probeLength()  : mixed
setEncoding()  : self
Set the preferred text encoding for ID3v2 tags.
getStreams()  : mixed

Constants

public mixed IMAGE_BAND_LOGO = 19

IMAGE_COMPOSER

public mixed IMAGE_COMPOSER = 11

IMAGE_CONDUCTOR

public mixed IMAGE_CONDUCTOR = 9

IMAGE_COVER_BACK

public mixed IMAGE_COVER_BACK = 4

IMAGE_COVER_FRONT

public mixed IMAGE_COVER_FRONT = 3

IMAGE_DURING_PERFORMANCE

public mixed IMAGE_DURING_PERFORMANCE = 15

IMAGE_DURING_RECORDING

public mixed IMAGE_DURING_RECORDING = 14

IMAGE_FILE_ICON

public mixed IMAGE_FILE_ICON = 1

IMAGE_ILLUSTRATION

public mixed IMAGE_ILLUSTRATION = 18

IMAGE_LEAD_ARTIST

public mixed IMAGE_LEAD_ARTIST = 7

IMAGE_LEAFLET

public mixed IMAGE_LEAFLET = 5

IMAGE_LYRICIST

public mixed IMAGE_LYRICIST = 12

IMAGE_OTHER_FILE_ICON

public mixed IMAGE_OTHER_FILE_ICON = 2
public mixed IMAGE_PUBLISHER_LOGO = 20

IMAGE_RECORDING_LOCATION

public mixed IMAGE_RECORDING_LOCATION = 13

IMAGE_SCREEN_CAPTURE

public mixed IMAGE_SCREEN_CAPTURE = 16

LOG_TAG

private mixed LOG_TAG = 'MediaMeta '

Properties

$encoding

protected int $encoding = \App\Modules\Metadata\MediaMeta\Encoding::UTF8

The preferred text encoding for ID3v2 tags

$filePath

protected string $filePath

The path to the audio file

$streamCollection

private StreamCollection|null $streamCollection = null

Methods

__construct()

Create a new MediaMeta instance.

public __construct(string $filePath[, int $encoding = Encoding::UTF8 ]) : mixed
Parameters
$filePath : string

The path to the audio file

$encoding : int = Encoding::UTF8

The preferred text encoding for ID3v2 tags (default: UTF-8)

getAlbum()

Get the album of the audio file.

public getAlbum() : string|null
Return values
string|null

The album, or null if not available

getAlbumFrame()

Get the album frame of the audio file.

public getAlbumFrame() : TALB|null
Return values
TALB|null

The album frame, or null if not available

getArtist()

Get the artist of the audio file.

public getArtist() : array<string|int, mixed>|string|null
Return values
array<string|int, mixed>|string|null

The artist(s), or null if not available

getArtistFrame()

Get the artist frame of the audio file.

public getArtistFrame() : TPE1|null
Return values
TPE1|null

The artist frame, or null if not available

getArtistImage()

Get the artist image from the audio file.

public getArtistImage() : Apic|null
Return values
Apic|null

The artist image, or null if not available

getArtists()

Get the artists of the audio file as an array.

public getArtists() : array<string|int, string>
Return values
array<string|int, string>

The artists, or an empty array if not available

getBackCoverImage()

Get the back cover image from the audio file.

public getBackCoverImage() : Apic|null
Return values
Apic|null

The back cover image, or null if not available

getComment()

Get the first comment of the audio file.

public getComment() : string|null
Return values
string|null

The comment text, or null if not available

getCommentFrame()

Get the first comment frame of the audio file.

public getCommentFrame() : COMM|null
Return values
COMM|null

The comment frame, or null if not available

getCommentFrameByDescription()

Get a comment frame with the given description.

public getCommentFrameByDescription(string $description) : COMM|null
Parameters
$description : string

The description

Return values
COMM|null

The comment frame, or null if not available

getComments()

Get the comments of the audio file.

public getComments() : array<string|int, COMM>
Return values
array<string|int, COMM>

The comment frames, or an empty array if not available

getEncoding()

Get the preferred text encoding for ID3v2 tags.

public getEncoding() : int
Return values
int

The encoding constant from Encoding

getFrontCoverImage()

Get the front cover image from the audio file.

public getFrontCoverImage() : Apic|null
Return values
Apic|null

The front cover image, or null if not available

getFrontCoverImageData()

Get the front cover image data from the audio file.

public getFrontCoverImageData() : string|null
Return values
string|null

The front cover image data, or null if not available

getGenre()

Get the genre of the audio file.

public getGenre() : string|null
Return values
string|null

The genre, or null if not available

getGenreFrame()

Get the genre frame of the audio file.

public getGenreFrame() : TCON|null
Return values
TCON|null

The genre frame, or null if not available

getID3v1()

Get the ID3v1 tag reader.

public getID3v1() : Id3v1
Tags
throws
Exception
Return values
Id3v1

The ID3v1 tag reader, or null if the file doesn't have ID3v1 tags

getID3v2()

Get the ID3v2 tag reader.

public getID3v2() : Id3v2
Tags
throws
Exception
Return values
Id3v2

The ID3v2 tag reader, or null if the file doesn't have ID3v2 tags

getImage()

Get the first APIC frame (image) from the audio file.

public getImage() : Apic|null
Return values
Apic|null

The first APIC frame, or null if not available

getImageByType()

Get the first APIC frame (image) of a specific type from the audio file.

public getImageByType(int $imageType) : Apic|null
Parameters
$imageType : int

The image type (use the IMAGE_* constants)

Return values
Apic|null

The first APIC frame of the specified type, or null if not available

getImageData()

Get the image data from the first APIC frame.

public getImageData() : string|null
Return values
string|null

The image data, or null if not available

getImageDataByType()

Get the image data from a specific type of APIC frame.

public getImageDataByType(int $imageType) : string|null
Parameters
$imageType : int

The image type (use the IMAGE_* constants)

Return values
string|null

The image data, or null if not available

getImageDescription()

Get the image description of the first APIC frame.

public getImageDescription() : string|null
Return values
string|null

The image description, or null if not available

getImageDescriptionByType()

Get the image description of a specific type of APIC frame.

public getImageDescriptionByType(int $imageType) : string|null
Parameters
$imageType : int

The image type (use the IMAGE_* constants)

Return values
string|null

The image description, or null if not available

getImageMimeType()

Get the MIME type of the first APIC frame.

public getImageMimeType() : string|null
Return values
string|null

The MIME type, or null if not available

getImageMimeTypeByType()

Get the MIME type of a specific type of APIC frame.

public getImageMimeTypeByType(int $imageType) : string|null
Parameters
$imageType : int

The image type (use the IMAGE_* constants)

Return values
string|null

The MIME type, or null if not available

getImages()

Get all APIC frames (images) from the audio file.

public getImages() : array<string|int, Apic>
Return values
array<string|int, Apic>

An array of APIC frames, or an empty array if none are available

getImagesByType()

Get APIC frames (images) of a specific type from the audio file.

public getImagesByType(int $imageType) : array<string|int, Apic>
Parameters
$imageType : int

The image type (use the IMAGE_* constants)

Return values
array<string|int, Apic>

An array of APIC frames of the specified type, or an empty array if none are available

getImageType()

Get the image type of the first APIC frame.

public getImageType() : int|null
Return values
int|null

The image type, or null if not available

getMimeType()

public getMimeType() : string
Return values
string

getTitle()

Get the title of the audio file.

public getTitle() : string|null
Return values
string|null

The title, or null if not available

getTitleFrame()

Get the title frame of the audio file.

public getTitleFrame() : TIT2|null
Return values
TIT2|null

The title frame, or null if not available

getTrackNumber()

Get the track number

public getTrackNumber() : int|null
Return values
int|null

getYear()

Get the year of the audio file.

public getYear() : string|null
Return values
string|null

The year, or null if not available

getYearFrame()

Get the year frame of the audio file.

public getYearFrame() : TYER|null
Return values
TYER|null

The year frame, or null if not available

isAudioFile()

public isAudioFile() : bool
Return values
bool

setEncoding()

Set the preferred text encoding for ID3v2 tags.

public setEncoding(int $encoding) : self
Parameters
$encoding : int

The encoding constant from Encoding

Return values
self

        
On this page

Search results