Adding accessors for the various tag type for FLAC tags (similar to those

in MPEG::File).

CCMAIL:Jorn Baayen <jbaayen@gnome.org>


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@302658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Scott Wheeler 2004-04-10 17:55:23 +00:00
parent 09c4de9114
commit 771a5cd65e
2 changed files with 83 additions and 3 deletions

View File

@ -24,6 +24,8 @@
#include <tdebug.h>
#include <id3v2header.h>
#include <id3v2tag.h>
#include <id3v1tag.h>
#include "flacfile.h"
#include "flactag.h"
@ -214,6 +216,38 @@ void FLAC::File::save()
}
ID3v2::Tag *FLAC::File::ID3v2Tag(bool create)
{
if(!create || d->ID3v2Tag)
return d->ID3v2Tag;
// no ID3v2 tag exists and we've been asked to create one
d->ID3v2Tag = new ID3v2::Tag;
return d->ID3v2Tag;
}
ID3v1::Tag *FLAC::File::ID3v1Tag(bool create)
{
if(!create || d->ID3v1Tag)
return d->ID3v1Tag;
// no ID3v1 tag exists and we've been asked to create one
d->ID3v1Tag = new ID3v1::Tag;
return d->ID3v1Tag;
}
Ogg::XiphComment *FLAC::File::xiphComment(bool create)
{
if(!create || d->comment)
return d->comment;
// no XiphComment exists and we've been asked to create one
d->comment = new Ogg::XiphComment;
return d->comment;
}
void FLAC::File::setID3v2FrameFactory(const ID3v2::FrameFactory *factory)
{
d->ID3v2FrameFactory = factory;

View File

@ -29,7 +29,10 @@
namespace TagLib {
class Tag;
namespace ID3v2 { class FrameFactory; }
namespace ID3v2 { class FrameFactory; class Tag; }
namespace ID3v1 { class Tag; }
namespace Ogg { class XiphComment; }
//! An implementation of FLAC metadata
@ -83,8 +86,12 @@ namespace TagLib {
virtual ~File();
/*!
* Returns the Tag for this file. This will be a union of XiphComment
* with ID3v1 and ID3v2 tags.
* Returns the Tag for this file. This will be a union of XiphComment,
* ID3v1 and ID3v2 tags.
*
* \see ID3v2Tag()
* \see ID3v1Tag()
* \see XiphComment()
*/
virtual TagLib::Tag *tag() const;
@ -101,6 +108,45 @@ namespace TagLib {
*/
virtual void save();
/*!
* Returns a pointer to the ID3v2 tag of the file.
*
* If \a create is false (the default) this will return a null pointer
* if there is no valid ID3v2 tag. If \a create is true it will create
* an ID3v2 tag if one does not exist.
*
* \note The Tag <b>is still</b> owned by the FLAC::File and should not be
* deleted by the user. It will be deleted when the file (object) is
* destroyed.
*/
ID3v2::Tag *ID3v2Tag(bool create = false);
/*!
* Returns a pointer to the ID3v1 tag of the file.
*
* If \a create is false (the default) this will return a null pointer
* if there is no valid ID3v1 tag. If \a create is true it will create
* an ID3v1 tag if one does not exist.
*
* \note The Tag <b>is still</b> owned by the FLAC::File and should not be
* deleted by the user. It will be deleted when the file (object) is
* destroyed.
*/
ID3v1::Tag *ID3v1Tag(bool create = false);
/*!
* Returns a pointer to the XiphComment for the file.
*
* If \a create is false (the default) this will return a null pointer
* if there is no valid XiphComment. If \a create is true it will create
* a XiphComment if one does not exist.
*
* \note The Tag <b>is still</b> owned by the FLAC::File and should not be
* deleted by the user. It will be deleted when the file (object) is
* destroyed.
*/
Ogg::XiphComment *xiphComment(bool create = false);
/*!
* Set the ID3v2::FrameFactory to something other than the default. This
* can be used to specify the way that ID3v2 frames will be interpreted