ID3_Frame* ID3_AddTrack(ID3_Tag *tag, uchar ucTrack, uchar ucTotal, bool bReplace) { ID3_Frame* pFrame = NULL; if (NULL != tag && ucTrack > 0) { if (bReplace) { ID3_RemoveTracks(tag); } if (bReplace || NULL == tag->Find(ID3FID_TRACKNUM)) { ID3_Frame *trackFrame = new ID3_Frame(ID3FID_TRACKNUM); if (trackFrame) { char *sTrack = NULL; if (0 == ucTotal) { sTrack = new char[4]; sprintf(sTrack, "%lu", (luint) ucTrack); } else { sTrack = new char[8]; sprintf(sTrack, "%lu/%lu", (luint) ucTrack, (luint) ucTotal); } trackFrame->Field(ID3FN_TEXT) = sTrack; tag->AttachFrame(trackFrame); delete [] sTrack; } } } return pFrame; }
ID3_Frame* ID3_AddTrack(ID3_Tag *tag, uchar trk, uchar ttl, bool replace) { ID3_Frame* frame = NULL; if (NULL != tag && trk > 0) { if (replace) { ID3_RemoveTracks(tag); } if (replace || NULL == tag->Find(ID3FID_TRACKNUM)) { frame = new ID3_Frame(ID3FID_TRACKNUM); if (frame) { char *sTrack = NULL; if (0 == ttl) { sTrack = new char[4]; sprintf(sTrack, "%lu", (luint) trk); } else { sTrack = new char[8]; sprintf(sTrack, "%lu/%lu", (luint) trk, (luint) ttl); } frame->GetField(ID3FN_TEXT)->Set(sTrack); tag->AttachFrame(frame); delete [] sTrack; } } } return frame; }