TagLib  1.13.1
TagLib::ID3v2::Frame::Header Class Reference

ID3v2 frame header implementation. More...

#include <id3v2frame.h>

Public Member Functions

TAGLIB_DEPRECATED Header (const ByteVector &data, bool synchSafeInts)
 
 Header (const ByteVector &data, unsigned int version=4)
 
virtual ~Header ()
 
TAGLIB_DEPRECATED void setData (const ByteVector &data, bool synchSafeInts)
 
void setData (const ByteVector &data, unsigned int version=4)
 
ByteVector frameID () const
 
void setFrameID (const ByteVector &id)
 
unsigned int frameSize () const
 
void setFrameSize (unsigned int size)
 
unsigned int version () const
 
void setVersion (unsigned int version)
 
bool tagAlterPreservation () const
 
void setTagAlterPreservation (bool discard)
 
bool fileAlterPreservation () const
 
bool readOnly () const
 
bool groupingIdentity () const
 
bool compression () const
 
bool encryption () const
 
bool unsynchronisation () const
 
bool dataLengthIndicator () const
 
ByteVector render () const
 
TAGLIB_DEPRECATED bool frameAlterPreservation () const
 

Static Public Member Functions

static unsigned int size ()
 
static unsigned int size (unsigned int version)
 

Detailed Description

ID3v2 frame header implementation.

The ID3v2 Frame Header (Structure, 4)

Every ID3v2::Frame has an associated header that gives some general properties of the frame and also makes it possible to identify the frame type.

As such when reading an ID3v2 tag ID3v2::FrameFactory first creates the frame headers and then creates the appropriate Frame subclass based on the type and attaches the header.

Constructor & Destructor Documentation

◆ Header() [1/2]

TAGLIB_DEPRECATED TagLib::ID3v2::Frame::Header::Header ( const ByteVector & data,
bool synchSafeInts )

Construct a Frame Header based on data. data must at least contain a 4 byte frame ID, and optionally can contain flag data and the frame size. i.e. Just the frame id – "TALB" – is a valid value.

Deprecated
Please use the constructor below that accepts a version number.

References TAGLIB_DEPRECATED.

Referenced by frameAlterPreservation().

◆ Header() [2/2]

TagLib::ID3v2::Frame::Header::Header ( const ByteVector & data,
unsigned int version = 4 )
explicit

Construct a Frame Header based on data. data must at least contain a 4 byte frame ID, and optionally can contain flag data and the frame size. i.e. Just the frame id – "TALB" – is a valid value.

version should be the ID3v2 version of the tag.

References version().

◆ ~Header()

virtual TagLib::ID3v2::Frame::Header::~Header ( )
virtual

Destroys this Header instance.

Member Function Documentation

◆ compression()

bool TagLib::ID3v2::Frame::Header::compression ( ) const

Returns true if compression is enabled for this frame.

Note
This flag is currently ignored internally in TagLib.

◆ dataLengthIndicator()

bool TagLib::ID3v2::Frame::Header::dataLengthIndicator ( ) const

Returns true if the flag for a data length indicator is set.

◆ encryption()

bool TagLib::ID3v2::Frame::Header::encryption ( ) const

Returns true if encryption is enabled for this frame.

Note
This flag is currently ignored internally in TagLib.

◆ fileAlterPreservation()

bool TagLib::ID3v2::Frame::Header::fileAlterPreservation ( ) const

Returns true if the flag for file alter preservation is set.

Note
This flag is currently ignored internally in TagLib.

◆ frameAlterPreservation()

TAGLIB_DEPRECATED bool TagLib::ID3v2::Frame::Header::frameAlterPreservation ( ) const

◆ frameID()

ByteVector TagLib::ID3v2::Frame::Header::frameID ( ) const

Returns the Frame ID (Structure, 4) (Frames, 4)

◆ frameSize()

unsigned int TagLib::ID3v2::Frame::Header::frameSize ( ) const

Returns the size of the frame data portion, as set when setData() was called or set explicitly via setFrameSize().

◆ groupingIdentity()

bool TagLib::ID3v2::Frame::Header::groupingIdentity ( ) const

Returns true if the flag for the grouping identity is set.

Note
This flag is currently ignored internally in TagLib.

◆ readOnly()

bool TagLib::ID3v2::Frame::Header::readOnly ( ) const

Returns true if the frame is meant to be read only.

Note
This flag is currently ignored internally in TagLib.

◆ render()

ByteVector TagLib::ID3v2::Frame::Header::render ( ) const

Render the Header back to binary format in a ByteVector.

◆ setData() [1/2]

TAGLIB_DEPRECATED void TagLib::ID3v2::Frame::Header::setData ( const ByteVector & data,
bool synchSafeInts )

Sets the data for the Header.

Deprecated
Please use the version below that accepts an ID3v2 version number.

References TAGLIB_DEPRECATED.

◆ setData() [2/2]

void TagLib::ID3v2::Frame::Header::setData ( const ByteVector & data,
unsigned int version = 4 )

Sets the data for the Header. version should indicate the ID3v2 version number of the tag that this frame is contained in.

References version().

◆ setFrameID()

void TagLib::ID3v2::Frame::Header::setFrameID ( const ByteVector & id)

Sets the frame's ID to id. Only the first four bytes of id will be used.

Warning
This method should in general be avoided. It exists simply to provide a mechanism for transforming frames from a deprecated frame type to a newer one – i.e. TYER to TDRC from ID3v2.3 to ID3v2.4.

◆ setFrameSize()

void TagLib::ID3v2::Frame::Header::setFrameSize ( unsigned int size)

Sets the size of the frame data portion.

References size().

◆ setTagAlterPreservation()

void TagLib::ID3v2::Frame::Header::setTagAlterPreservation ( bool discard)

Sets the flag for preservation of this frame if the tag is set. If this is set to true the frame will not be written when the tag is saved.

The semantics are a little backwards from what would seem natural (setting the preservation flag to throw away the frame), but this follows the ID3v2 standard.

See also
tagAlterPreservation()

◆ setVersion()

void TagLib::ID3v2::Frame::Header::setVersion ( unsigned int version)

Sets the ID3v2 version of the header, changing has impact on the correct parsing/rendering of frame data.

References version().

◆ size() [1/2]

static unsigned int TagLib::ID3v2::Frame::Header::size ( )
static

Returns the size of the frame header in bytes.

Deprecated
Please use the version of this method that accepts a version. This is only accurate for ID3v2.3 and ID3v2.4. This will be removed in the next binary incompatible release (2.0) and will be replaced with a non-static method that checks the frame version.

Referenced by setFrameSize().

◆ size() [2/2]

static unsigned int TagLib::ID3v2::Frame::Header::size ( unsigned int version)
static

Returns the size of the frame header in bytes for the ID3v2 version that's given.

Deprecated
Please see the explanation in the version above.

References version().

◆ tagAlterPreservation()

bool TagLib::ID3v2::Frame::Header::tagAlterPreservation ( ) const

Returns true if the flag for tag alter preservation is set.

The semantics are a little backwards from what would seem natural (setting the preservation flag to throw away the frame), but this follows the ID3v2 standard.

See also
setTagAlterPreservation()

◆ unsynchronisation()

bool TagLib::ID3v2::Frame::Header::unsynchronisation ( ) const

Returns true if unsynchronisation is enabled for this frame.

◆ version()

unsigned int TagLib::ID3v2::Frame::Header::version ( ) const

Returns the ID3v2 version of the header, as passed in from the construction of the header or set via setVersion().

Referenced by Header(), setData(), setVersion(), and size().


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