27 #if defined HAVE_CONFIG_H
41 uint32 readSeconds(
ID3_Reader& reader,
size_t len)
56 else if (!isdigit(ch))
62 cur = cur * 10 + (ch -
'0');
72 ID3D_NOTICE(
"readTextFrame: size = " << size );
83 ID3D_NOTICE(
"readTextFrame: text = " << text );
87 text = toString(readSeconds(reader, size) * 1000);
88 ID3D_NOTICE(
"readTextFrame: songlen = " << text );
96 frame->GetField(
ID3FN_TEXT)->Set(text.c_str());
100 frame->GetField(
ID3FN_URL)->Set(text.c_str());
119 if (end < rdr.
getBeg() + 48)
121 ID3D_NOTICE(
"mm::parse: bailing, not enough bytes to parse, pos = " << end );
131 ID3D_NOTICE(
"mm::parse: bailing, couldn't find footer" );
136 if (version.size() != 4 ||
137 !isdigit(version[0]) || version[1] !=
'.' ||
138 !isdigit(version[2]) ||
139 !isdigit(version[3]))
141 ID3D_WARNING(
"mm::parse: bailing, nonstandard version = " << version );
150 ID3D_NOTICE(
"mm::parse: bailing, not enough bytes to parse offsets, pos = " << end );
161 for (
size_t i = 0; i < 5; ++i)
166 size_t metadataSize = 0;
167 if (version <=
"3.00")
179 size_t possibleSizes[] = { 8132, 8004, 7936 };
181 for (
size_t i = 0; i <
sizeof(possibleSizes)/
sizeof(
size_t); ++i)
187 size_t offset = possibleSizes[i] + 256;
188 if (dataWindow.
getCur() < offset)
199 metadataSize = possibleSizes[i];
204 if (0 == metadataSize)
208 ID3D_WARNING(
"mm::parse: bailing, couldn't find meta data signature, end = " << end );
214 size_t sectionSizes[5];
215 size_t tagSize = metadataSize;
218 sectionSizes[4] = metadataSize;
220 size_t lastOffset = 0;
221 for (
int i = 0; i < 5; i++)
223 size_t thisOffset = offsets[i];
227 size_t sectionSize = thisOffset - lastOffset;
228 sectionSizes[i-1] = sectionSize;
229 tagSize += sectionSize;
231 lastOffset = thisOffset;
235 if (dataWindow.
getEnd() < tagSize)
239 ID3D_WARNING(
"mm::parse: bailing, tag size is too big, tag size = " << tagSize <<
", end = " << end );
247 offsets[0] = dataWindow.
getBeg();
248 for (
size_t i = 0; i < 4; ++i)
250 offsets[i+1] = offsets[i] + sectionSizes[i];
254 if (dataWindow.
getBeg() >= 256)
271 dataWindow.
setCur(offsets[0]);
275 dataWindow.
setCur(offsets[1]);
295 String mimetype(
"image/");
301 frame->GetField(
ID3FN_DATA)->Set(reinterpret_cast<const uchar*>(imgData.data()), imgData.size());
309 dataWindow.
setCur(offsets[4]);
333 String trkStr = toString(trkNum);
337 frame->GetField(
ID3FN_TEXT)->Set(trkStr.c_str());
Official artist/performer webpage.
ID3_C_EXPORT uint32 readLENumber(ID3_Reader &, size_t)
virtual pos_type getBeg()
Return the beginning position in the reader.
bool parse(ID3_TagImpl &, ID3_Reader &)
pos_type setBeg(pos_type)
pos_type getBeg()
Return the beginning position in the reader.
void setExitPos(ID3_Reader::pos_type pos)
Title/songname/content description.
virtual pos_type getCur()=0
Return the current position in the reader.
virtual pos_type setCur(pos_type pos)=0
Set the value of the current position for reading.
pos_type setCur(pos_type cur)
Set the value of the current position for reading.
pos_type getEnd()
Return the ending position in the reader.
ID3_FrameID
Enumeration of the different types of frames recognized by id3lib.
Lead performer(s)/Soloist(s)
Track number/Position in set.
bool AttachFrame(ID3_Frame *)
pos_type setEnd(pos_type)
The representative class of an id3v2 frame.
ID3_C_EXPORT String readTrailingSpaces(ID3_Reader &, size_t)
Set a window on the buffer.
pos_type getCur()
Return the current position in the reader.
ID3_C_EXPORT String readText(ID3_Reader &, size_t)
virtual size_type skipChars(size_type len)
Skip up to len chars in the stream and advance the internal position accordingly. ...
Unsynchronized lyric/text transcription.
ID3_C_EXPORT BString readAllBinary(ID3_Reader &)