company logo

MP3Header :: replaceFrames - Replace frames by mask

The function allows creating MP3 header data (frames) from titles using a mask describing the position of different items.

// Passing following string and mask

string: "1967 - Jimmy Hendrix - Purple Haze (from Are You Experienced)"

mask: "%TDRC% - %TPE1% - %TIT2% (from %TALB%)

// will return following frames:

TDRC=1967

TPE1=Jimmy Hendrix

TIT2=Purple Haze

TALB=Are You Experienced

Return value:  Success ( bool  )

The value is true when the function was executed successfully. Otherwise the value is set to false.

Implementation details

bool MP3Header  :: replaceFrames ( odaba::String &sFrameMask, odaba::String &sText )

The function replaces frames according to a mask for a string containing frame values. Frame identifier are passed in sFrameMask enclosed in %...% at position in the string, where appropriate frame values are expected in the string passed in sText. Frames are replaced or inserted at front of the header.

When the requested frames could not be found, the function returns false and true when being replaced successfully..

When the MP3 header is not valid (isValid()), the function throws an exception.

  • sFrameMask - MP3 frame mask

    An MP3 frame mask consists of a sequence of frame identifiers (each four characters enclosed in %...%) as place holder for frame values and fixed text considered as separator between frame values.

  • sText - Text string

    The text string contains text with any kind of character encoding.