MythTV  master
Public Member Functions | Private Member Functions | List of all members
MetaIOMP4 Class Reference

Read and write metadata in MP4 container tags. More...

#include <metaiomp4.h>

Inheritance diagram for MetaIOMP4:
Inheritance graph
[legend]
Collaboration diagram for MetaIOMP4:
Collaboration graph
[legend]

Public Member Functions

 MetaIOMP4 (void)
 
virtual ~MetaIOMP4 (void)=default
 
bool write (const QString &filename, MusicMetadata *mdata) override
 Writes all metadata back to a file. More...
 
MusicMetadataread (const QString &filename) override
 Reads MusicMetadata from a file. More...
 
- Public Member Functions inherited from MetaIO
 MetaIO (void)
 Constructor. More...
 
virtual ~MetaIO (void)=default
 
virtual bool writeVolatileMetadata (const QString &filename, MusicMetadata *mdata)
 Writes rating and playcount back to a file. More...
 
virtual bool supportsEmbeddedImages (void)
 Does the tag support embedded cover art. More...
 
virtual AlbumArtList getAlbumArtList (const QString &filename)
 Reads the list of embedded images in the tag. More...
 
virtual bool writeAlbumArt (const QString &filename, const AlbumArtImage *albumart)
 
virtual bool removeAlbumArt (const QString &filename, const AlbumArtImage *albumart)
 
virtual bool changeImageType (const QString &filename, const AlbumArtImage *albumart, ImageType newType)
 
virtual QImage * getAlbumArt (const QString &filename, ImageType type)
 
void readFromFilename (const QString &filename, QString &artist, QString &album, QString &title, QString &genre, int &tracknum)
 Reads MusicMetadata based on the folder/filename. More...
 
MusicMetadatareadFromFilename (const QString &filename, bool blnLength=false)
 Reads MusicMetadata based on the folder/filename. More...
 
void readFromFilename (MusicMetadata *metadata)
 Reads MusicMetadata based on the folder/filename. More...
 
virtual bool TagExists (const QString &filename)
 

Private Member Functions

int getTrackLength (const QString &filename) override
 Find the length of the track (in seconds) More...
 
int getTrackLength (AVFormatContext *pContext)
 Find the length of the track (in seconds) More...
 
QString getFieldValue (AVFormatContext *context, const char *tagname)
 Retrieve the value of a named metadata field. More...
 
void metadataSanityCheck (QString *artist, QString *album, QString *title, QString *genre)
 Replace any empty strings in extracted metadata with sane defaults. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MetaIO
static MetaIOcreateTagger (const QString &filename)
 Finds an appropriate tagger for the given file. More...
 
static MusicMetadatareadMetadata (const QString &filename)
 Read the metadata from filename directly. More...
 
static MusicMetadatagetMetadata (const QString &filename)
 Get the metadata for filename. More...
 
- Static Public Attributes inherited from MetaIO
static const QString ValidFileExtensions
 
- Protected Member Functions inherited from MetaIO
void saveTimeStamps (void)
 
void restoreTimeStamps (void)
 
- Protected Attributes inherited from MetaIO
QString m_filename
 
QString m_filenameFormat
 
struct stat m_fileinfo
 

Detailed Description

Read and write metadata in MP4 container tags.

Definition at line 16 of file metaiomp4.h.

Constructor & Destructor Documentation

◆ MetaIOMP4()

MetaIOMP4::MetaIOMP4 ( void  )
inline

Definition at line 19 of file metaiomp4.h.

◆ ~MetaIOMP4()

virtual MetaIOMP4::~MetaIOMP4 ( void  )
virtualdefault

Member Function Documentation

◆ write()

bool MetaIOMP4::write ( const QString &  filename,
MusicMetadata mdata 
)
overridevirtual

Writes all metadata back to a file.

Parameters
filenameThe filename to write metadata to
mdataA pointer to a MusicMetadata object
Returns
Boolean to indicate success/failure.

Implements MetaIO.

Definition at line 19 of file metaiomp4.cpp.

◆ read()

MusicMetadata * MetaIOMP4::read ( const QString &  filename)
overridevirtual

Reads MusicMetadata from a file.

Parameters
filenameThe filename to read metadata from.
Returns
MusicMetadata pointer or nullptr on error

Implements MetaIO.

Definition at line 70 of file metaiomp4.cpp.

◆ getTrackLength() [1/2]

int MetaIOMP4::getTrackLength ( const QString &  filename)
overrideprivatevirtual

Find the length of the track (in seconds)

Parameters
filenameThe filename for which we want to find the length.
Returns
An integer (signed!) to represent the length in seconds.

Implements MetaIO.

Definition at line 169 of file metaiomp4.cpp.

Referenced by read().

◆ getTrackLength() [2/2]

int MetaIOMP4::getTrackLength ( AVFormatContext *  pContext)
private

Find the length of the track (in seconds)

Parameters
pContextThe AV Format Context.
Returns
An integer (signed!) to represent the length in seconds.

Definition at line 198 of file metaiomp4.cpp.

◆ getFieldValue()

QString MetaIOMP4::getFieldValue ( AVFormatContext *  context,
const char *  tagname 
)
private

Retrieve the value of a named metadata field.

Parameters
contextAVFormatContext of the file
tagnameThe name of the field
Returns
A string containing the requested value

Definition at line 151 of file metaiomp4.cpp.

Referenced by read().

◆ metadataSanityCheck()

void MetaIOMP4::metadataSanityCheck ( QString *  artist,
QString *  album,
QString *  title,
QString *  genre 
)
private

Replace any empty strings in extracted metadata with sane defaults.

Parameters
artistArtist
albumAlbum
titleTitle
genreGenre

Definition at line 216 of file metaiomp4.cpp.

Referenced by read().


The documentation for this class was generated from the following files: