libtaginfo  0.2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TagInfo::Info Class Reference

A simple, generic interface to common audio meta data fields and media properties. More...

#include <taginfo.h>

Inheritance diagram for TagInfo::Info:
TagInfo::ApeTagInfo TagInfo::AsfInfo TagInfo::Id3Info TagInfo::ModTagInfo TagInfo::Mp4Info TagInfo::XiphInfo TagInfo::ApeInfo TagInfo::MpcInfo TagInfo::WavPackInfo TagInfo::AiffInfo TagInfo::Mp3Info TagInfo::TrueAudioInfo TagInfo::WaveInfo TagInfo::ItInfo TagInfo::ModInfo TagInfo::S3mInfo TagInfo::XmInfo TagInfo::FlacInfo TagInfo::OggInfo TagInfo::SpeexInfo

Public Member Functions

String get_file_name (void)
 
bool is_valid ()
 
String get_album_artist (void) const
 Get the album artist tag of a media track. More...
 
void set_album_artist (const String new_artist)
 
String get_album (void) const
 Get the album tag of a media track. More...
 
void set_album (const String new_album)
 
String get_artist (void) const
 Get the artist tag of a media track. More...
 
void set_artist (const String new_artist)
 
int get_beats_per_minute () const
 Get the BPM of a media track. More...
 
void set_beats_per_minute (const int new_bpm)
 
String get_comments (void) const
 Get the comments tag of a media track. More...
 
void set_comments (const String new_comments)
 
String get_composer (void) const
 Get the composer tag of a media track. More...
 
void set_composer (const String new_composer)
 
String get_copyright (void) const
 Get the copyright tag of a media track. More...
 
void set_copyright (const String new_copyright)
 
String get_encoder (void) const
 Get the encoder tag of a media track. More...
 
void set_encoder (const String new_encoder)
 
String get_genre (void) const
 Get the genre of a media track. More...
 
void set_genre (const String new_genre)
 
bool get_has_image () const
 Get information on the availability of an image. More...
 
String get_homepage (void) const
 Get the homepage tag of a media track. More...
 
void set_homepage (const String new_homepage)
 
bool get_is_compilation () const
 Get wether the media file is part of a compilation/various artists album, or not.
 
void set_is_compilation (bool compilation)
 
String get_original_artist (void) const
 Get the original artist tag of a media track. More...
 
void set_original_artist (const String new_artist)
 
int get_playcount () const
 Get the playcount tag of a media track. More...
 
void set_playcount (int new_playcount)
 
int get_rating () const
 
void set_rating (const int new_rating)
 
String get_title (void) const
 Get the title of a media track. More...
 
void set_title (const String new_title)
 
int get_track_count () const
 
void set_track_count (const int new_track_count)
 
int get_track_number () const
 Get the track_number tag of a media track. More...
 
void set_track_number (const int new_track_number)
 
int get_volume_count () const
 Get volume count of a media track. (like CD 2 of 3) More...
 
void set_volume_count (const int count)
 
int get_volume_number () const
 Get volume number of a media track. (like CD 2 of 3) More...
 
void set_volume_number (const int number)
 
int get_year () const
 Get the year tag of a media track. More...
 
void set_year (const int new_year)
 
int get_length_seconds () const
 Get the length of the media file in seconds.
 
int get_bitrate () const
 Get the bitrate of the media file.
 
int get_channels () const
 Get the number of channels of the media file.
 
int get_samplerate () const
 Get the samplerate of the media file.
 
StringList get_track_labels_list () const
 Get a list of embedded track labels.
 
void set_track_labels_list (const StringList &new_track_labels_list)
 
StringList get_artist_labels_list () const
 Get a list of embedded artist labels.
 
void set_artist_labels_list (const StringList &new_artist_labels_list)
 
StringList get_album_labels_list () const
 Get a list of embedded album labels.
 
void set_album_labels_list (const StringList &new_album_labels_list)
 
virtual bool load (void)
 
virtual bool save (void)
 
virtual ImageList get_images () const
 
virtual void set_images (const ImageList images)
 
virtual String get_lyrics (void) const
 
virtual void set_lyrics (const String &lyrics)
 Set an embedded Lyrics String to be saved to Info object.
 

Static Public Member Functions

static Infocreate (const String &filename)
 
static Infocreate_with_file_type (const String &file, MediaFileType format)
 
static Infocreate_from_mime (const String &filename, const String &mime_type)
 

Protected Member Functions

 Info (const String &filename="")
 Constructor to be called from derrived classes.
 
void load_base_tags (TagLib::Tag *tag)
 
void save_base_tags (TagLib::Tag *tag)
 

Protected Attributes

TagLib::FileRef * taglib_fileref
 TagLib::FileRef of the media file
 
TagLib::File * taglib_file
 TagLib::File of the media file
 
TagLib::Tag * taglib_tag
 TagLib::Tag of the media file
 
String file_name
 The path of the media file.
 
String title
 Title of the Info object.
 
String genre
 Genre of the Info object.
 
String artist
 Artist of the Info object.
 
String album_artist
 Album artist of the Info object.
 
String album
 Album of the Info object.
 
String composer
 Composer of the Info object.
 
String comments
 Comments of the Info object.
 
String homepage
 Homepage of the Info object.
 
String encoder
 Encoder of the Info object.
 
String copyright
 Copyright of the Info object.
 
String original_artist
 Original artist of the Info object.
 
int track_number
 Track number of the Info object.
 
int track_count
 Track count of the Info object.
 
int year
 Year of the Info object.
 
bool is_compilation
 Whether the media file is part of a compilation.
 
int beats_per_minute
 Speed in beats per minute.
 
int volume_number
 Volume number of the Info object.
 
int volume_count
 Volume count of the Info object.
 
int length_seconds
 Lenght in seconds.
 
int bitrate
 Bitrate.
 
int samplerate
 Sample rate.
 
int channels
 Channel count.
 
int playcount
 Play count.
 
int rating
 Rating (1 - 5 stars, 0 not set)
 
StringList track_labels
 User defined track labels.
 
String track_labels_string
 User defined track labels as string with "|" as delimiter.
 
StringList artist_labels
 User defined artist labels.
 
String artist_labels_string
 User defined artist labels as string with "|" as delimiter.
 
StringList album_labels
 User defined album labels.
 
String album_labels_string
 User defined album labels as string with "|" as delimiter.
 
ulong changedflag
 The setters for the tags on the info object will set these ChangedFlags flags.
 
bool has_image
 Whether there is image data available.
 
bool valid
 Whether the info object is valid.
 

Detailed Description

A simple, generic interface to common audio meta data fields and media properties.

Info is an abstract base class for media tag reading/writing

Member Function Documentation

Info * Info::create ( const String &  filename)
static

Create a Info object from a media file.

This is a recommended way for accessing media tags through libtaginfo. create() will return a matching Info subclass

Returns
the according Info subclass
Parameters
filenameis the path to a media file.

This function will make use of the file extension to find out the media type

Info * Info::create_from_mime ( const String &  filename,
const String &  mime_type 
)
static

Create a Info from

Parameters
filename. If
mime_typeis given, libtaginfo will try to create an Info object for the desired mime_type. This is a recommended way for accessing media tags through libtaginfo. create_from_mime() will return a matching Info subclass
Returns
the according Info subclass
Parameters
filenameis the path to a media file.
mime_typeis the mime type of the media file (e.g. "audio/x-vorbis+ogg") as String.
Info * Info::create_with_file_type ( const String &  filename,
MediaFileType  format 
)
static

Create a Info from file. If format is given, libtaginfo will try to create an Info object for the desired format. This is a recommended way for accessing media tags through libtaginfo. create_with_file_type() will return a matching Info subclass

Returns
the according Info subclass
Parameters
filenameis the path to a media file.
formatis the MediaFileType.
String Info::get_album ( void  ) const

Get the album tag of a media track.

Returns
The album tag as String
String Info::get_album_artist ( void  ) const

Get the album artist tag of a media track.

Returns
The album artist tag as String
String Info::get_artist ( void  ) const

Get the artist tag of a media track.

Returns
The artist tag as String
int Info::get_beats_per_minute ( ) const

Get the BPM of a media track.

Returns
The BPM as int
String Info::get_comments ( void  ) const

Get the comments tag of a media track.

Returns
The comments tag as String
String Info::get_composer ( void  ) const

Get the composer tag of a media track.

Returns
The composer tag as String
String Info::get_copyright ( void  ) const

Get the copyright tag of a media track.

Returns
The copyright tag as String
String Info::get_encoder ( void  ) const

Get the encoder tag of a media track.

Returns
The encoder tag as String
String TagInfo::Info::get_file_name ( void  )
Returns
name of media file
String Info::get_genre ( void  ) const

Get the genre of a media track.

Returns
The genre as String
bool Info::get_has_image ( ) const

Get information on the availability of an image.

This information is just a quick lookup if something is there.

Returns
true if there is image data
String Info::get_homepage ( void  ) const

Get the homepage tag of a media track.

Returns
The homepage tag as String
ImageList Info::get_images ( ) const
virtual

Get an array of images from the Info object. The ownership of the images is on the caller side. You have to destroy all the images in the retured array

Returns
TagLib::List with images

Reimplemented in TagInfo::FlacInfo, TagInfo::XiphInfo, TagInfo::Id3Info, TagInfo::AsfInfo, TagInfo::ApeTagInfo, and TagInfo::Mp4Info.

String Info::get_lyrics ( void  ) const
virtual

Get an embedded Lyrics String from the Info object.

Returns
String with lyrics

Reimplemented in TagInfo::XiphInfo, TagInfo::Id3Info, TagInfo::AsfInfo, TagInfo::ApeTagInfo, and TagInfo::Mp4Info.

String Info::get_original_artist ( void  ) const

Get the original artist tag of a media track.

Returns
The original artist tag as String
int Info::get_playcount ( ) const

Get the playcount tag of a media track.

Returns
The playcount tag as int
int Info::get_rating ( ) const

Get the rating tag of a media track. rating 1 - 5 ; 0 -> not set

Returns
The rating tag as int
String Info::get_title ( void  ) const

Get the title of a media track.

Returns
The title as String
int Info::get_track_count ( ) const

Get the track_count tag of a media track. This is the amount of tracks of the album the media file was taken from.

Returns
The track_count tag as int
int Info::get_track_number ( ) const

Get the track_number tag of a media track.

Returns
The track_number tag as int
int Info::get_volume_count ( ) const

Get volume count of a media track. (like CD 2 of 3)

Returns
The volume count as int
int Info::get_volume_number ( ) const

Get volume number of a media track. (like CD 2 of 3)

Returns
The volume number as int
int Info::get_year ( ) const

Get the year tag of a media track.

Returns
The year tag as int
bool Info::is_valid ( )

Information if the media file could be recognized and appears to be valid

Returns
true if valid
bool Info::load ( void  )
virtual

Loads tags and properties from the Info object of a file. String returns are coming as TagLib::String.

Reimplemented in TagInfo::FlacInfo, TagInfo::XiphInfo, TagInfo::Id3Info, TagInfo::ModTagInfo, TagInfo::AsfInfo, TagInfo::ApeTagInfo, and TagInfo::Mp4Info.

void Info::load_base_tags ( TagLib::Tag *  tag)
protected

Load the abstact basic tags from TagLib::Tag This will only do something if

Parameters
tagis not NULL
bool Info::save ( void  )
virtual

Saves the tags of the Info object to the media file.

Reimplemented in TagInfo::XiphInfo, TagInfo::Id3Info, TagInfo::ModTagInfo, TagInfo::AsfInfo, TagInfo::ApeTagInfo, and TagInfo::Mp4Info.

void Info::save_base_tags ( TagLib::Tag *  tag)
protected

Save the abstact basic tags to TagLib::Tag This will only do something if

Parameters
tagis not NULL
void Info::set_album ( const String  new_album)

Set the album tag of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_albumas String
void Info::set_album_artist ( const String  new_album_artist)

Set the album artist tag of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_album_artistas String
void Info::set_album_labels_list ( const StringList &  new_album_labels_list)

Set a list of embedded album labels. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

void Info::set_artist ( const String  new_artist)

Set the artist tag of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_artistas String
void Info::set_artist_labels_list ( const StringList &  new_artist_labels_list)

Set a list of embedded artist labels. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

void Info::set_beats_per_minute ( const int  new_bpm)

Set BPM of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_bpmspeed in BPM as int
void Info::set_comments ( const String  new_comments)

Set the comments tag of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_commentsas String
void Info::set_composer ( const String  new_composer)

Set the composer tag of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_composeras String
void Info::set_copyright ( const String  new_copyright)

Set the copyright tag of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_copyrightas String
void Info::set_encoder ( const String  new_encoder)

Set the encoder tag of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_encoderas String
void Info::set_genre ( const String  new_genre)

Set the genre tag.This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

void Info::set_homepage ( const String  new_homepage)

Set the homepage tag of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_homepageas String
void Info::set_images ( const ImageList  images)
virtual

Set an array of Image to the Info object. The ownership of the images remains on the caller side.

Parameters
imagesis an ImageList. Will overwrite any other Image in the Info object

Reimplemented in TagInfo::FlacInfo, TagInfo::XiphInfo, TagInfo::Id3Info, TagInfo::AsfInfo, TagInfo::ApeTagInfo, and TagInfo::Mp4Info.

void Info::set_is_compilation ( bool  compilation)

Set wether the media file is part of a compilation/various artists album, or not. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

void Info::set_original_artist ( const String  new_artist)

Set the original artist tag of a media track. For some implementations this is the performer tag This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_artistas String
void Info::set_playcount ( int  new_playcount)

Set the playcount tag of a media track. Some implementations may not support this tag This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_playcountas int
void Info::set_rating ( const int  new_rating)

Set the rating tag of a media track. rating 1 - 5 ; 0 -> not set This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_ratingas integer
void Info::set_title ( const String  new_title)

Set the title tag. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_titleis a String.
void Info::set_track_count ( const int  new_track_count)

Set the track count of a media track. This is the amount of tracks of the album the media file was taken from. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_track_countas int
void Info::set_track_labels_list ( const StringList &  new_track_labels_list)

Set a list of embedded track labels. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

void Info::set_track_number ( const int  new_track_number)

Set the track number of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_track_numberas int
void Info::set_volume_count ( const int  count)

Set volume count of a media track. (like CD 2 of 3) This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
countas int
void Info::set_volume_number ( const int  number)

Set volume number of a media track. (like CD 2 of 3) This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
numberas int
void Info::set_year ( const int  new_year)

Set the year of a media track. This function will set the according ChangedFlags flag This will not be saved to file before save() is called on the Info object.

Parameters
new_yearas int

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