27 #if defined HAVE_CONFIG_H
32 #include "id3/io_decorators.h"
42 io::ExitTrigger et(rdr);
47 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): num_fields = " << iFields );
57 ID3D_WARNING(
"ID3_FrameImpl::Parse(): out of data at postion " <<
72 ID3D_WARNING(
"ID3_FrameImpl::Parse(): field is null" );
78 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): field is not in scope" );
83 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): setting enc to " << enc );
87 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): parsing field, cur = " << beg );
88 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): parsing field, end = " <<
93 ID3D_WARNING(
"ID3_FrameImpl::Parse(): no data parsed, bad parse" );
100 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): found encoding = " << enc );
103 et.setExitPos(rdr.
getCur());
111 io::ExitTrigger et(reader);
112 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): reader.getBeg() = " << reader.
getBeg() );
113 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): reader.getCur() = " << reader.
getCur() );
114 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): reader.getEnd() = " << reader.
getEnd() );
117 if (!_hdr.Parse(reader) || reader.
getCur() == beg)
119 ID3D_WARNING(
"ID3_FrameImpl::Parse(): no header to parse" );
122 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): after hdr, getCur() = " << reader.
getCur() );
123 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): found frame! id = " << _hdr.GetTextID() );
126 const size_t dataSize = _hdr.GetDataSize();
127 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): dataSize = " << dataSize );
128 if (reader.
getEnd() < beg + dataSize)
130 ID3D_WARNING(
"ID3_FrameImpl::Parse(): not enough data to parse frame" );
133 io::WindowedReader wr(reader, dataSize);
134 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): window getBeg() = " << wr.getBeg() );
135 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): window getCur() = " << wr.getCur() );
136 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): window getEnd() = " << wr.getEnd() );
138 unsigned long origSize = 0;
139 if (_hdr.GetCompression())
141 origSize = io::readBENumber(reader,
sizeof(uint32));
142 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): frame is compressed, origSize = " << origSize );
145 if (_hdr.GetEncryption())
147 char ch = wr.readChar();
148 this->SetEncryptionID(ch);
149 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): frame is encrypted, encryption_id = " << (
int) ch );
152 if (_hdr.GetGrouping())
154 char ch = wr.readChar();
155 this->SetGroupingID(ch);
156 ID3D_NOTICE(
"ID3_FrameImpl::Parse(): frame is encrypted, grouping_id = " << (
int) ch );
160 this->_ClearFields();
163 bool success =
false;
165 if (!_hdr.GetCompression())
167 success = parseFields(wr, *
this);
171 io::CompressedReader csr(wr, origSize);
172 success = parseFields(csr, *
this);
174 et.setExitPos(wr.getCur());
The representative class of an ID3v2 field.
virtual uint32 Get() const =0
Returns the value of the integer field.
virtual ID3_FieldID GetID() const =0
virtual bool Parse(ID3_Reader &)=0
virtual bool SetEncoding(ID3_TextEnc enc)=0
virtual bool InScope(ID3_V2Spec spec) const =0
ID3_V2Spec GetSpec() const
Fields::iterator iterator
virtual pos_type getCur()=0
Return the current position in the reader.
virtual pos_type getEnd()
Return the ending position in the reader.
virtual pos_type getBeg()
Return the beginning position in the reader.
@ ID3FN_TEXTENC
Text encoding (unicode or ASCII)
ID3_TextEnc
Enumeration of the types of text encodings: ascii or unicode.