char *ID3_GetString(const ID3_Frame *frame, ID3_FieldID fldName) { char *text = NULL; // if (NULL != frame) ID3_Field* fld; if (NULL != frame && NULL != (fld = frame->GetField(fldName))) { // ID3_Field* fld = frame->GetField(fldName); ID3_TextEnc enc = fld->GetEncoding(); fld->SetEncoding(ID3TE_ISO8859_1); size_t nText = fld->Size(); text = new char[nText + 1]; fld->Get(text, nText + 1); fld->SetEncoding(enc); } return text; }
String id3::v2::getString(const ID3_Frame* frame, ID3_FieldID fldName) { if (!frame) { return ""; } ID3_Field* fp = frame->GetField(fldName); if (!fp) { return ""; } ID3_TextEnc enc = fp->GetEncoding(); fp->SetEncoding(ID3TE_ASCII); String text(fp->GetRawText(), fp->Size()); fp->SetEncoding(enc); return text; }
String id3::v2::getStringAtIndex(const ID3_Frame* frame, ID3_FieldID fldName, size_t nIndex) { if (!frame) { return ""; } String text; ID3_Field* fp = frame->GetField(fldName); if (fp && fp->GetNumTextItems() < nIndex) { ID3_TextEnc enc = fp->GetEncoding(); fp->SetEncoding(ID3TE_ASCII); text = fp->GetRawTextItem(nIndex); fp->SetEncoding(enc); } return text; }