本文整理汇总了C++中taglib::ByteVector::toUInt方法的典型用法代码示例。如果您正苦于以下问题:C++ ByteVector::toUInt方法的具体用法?C++ ByteVector::toUInt怎么用?C++ ByteVector::toUInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类taglib::ByteVector
的用法示例。
在下文中一共展示了ByteVector::toUInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse
void DSFHeader::parse(const TagLib::ByteVector &data)
{
if (data.size() < DSD_HEADER_SIZE + FMT_HEADER_SIZE) {
std::cerr <<"DSFHeader::parse(): header size incorrect" << std::endl;
return;
}
const char *hdr = data.data();
size_t offset = 0;
//
// ******** DSD chunk header ********
// DSD header chunk should start with "DSD ".
//
if (hdr[0] != 'D' || hdr[1] != 'S' || hdr[2] != 'D' || hdr[3] != ' ')
{
std::cerr <<"DSD::Header::parse(): DSD header's first 4 bytes != 'DSD '" << std::endl;
return;
}
offset += 4;
// The next 8 bytes contain the size of DSD header
// (numerical data is stored in little endian)
if (data.toLongLong(offset, false) != DSD_HEADER_SIZE)
{
std::cerr <<"DSD::Header::parse(): DSD header size is incorrect" << std::endl;
return;
}
offset += LONG_INT_SIZE;
// The next 8 bytes contains the file size
d->fileSize = bytesToUInt64(&hdr[0], offset);
offset += LONG_INT_SIZE;
// The next 8 bytes contains the offset to id3v2 tag (0 if not exists)
d->ID3v2Offset = bytesToUInt64(&hdr[0], offset);
offset += LONG_INT_SIZE;
//
// ********* FMT chunk ********
//
// FMT header chunk should start with "fmt ".
//
if (hdr[offset] != 'f' || hdr[offset + 1] != 'm' ||
hdr[offset + 2] != 't' || hdr[offset + 3] != ' ')
{
std::cerr <<"DSD::Header::parse(): FMT header's first 4 bytes != 'fmt '" << std::endl;
return;
}
offset += 4;
// The next 8 bytes contain the size of FMT header, which should be 52
if (data.toLongLong(offset, false) != FMT_HEADER_SIZE)
{
std::cerr <<"DSD::Header::parse(): FMT header size is incorrect" << std::endl;
return;
}
offset += LONG_INT_SIZE;
// Format version
// There's only version 1 for now...
unsigned int ver = data.toUInt(offset, false);
if (ver != 1) {
std::cerr <<"DSD::Header::parse(): format version != 1" << std::endl;
return;
}
d->version = static_cast<Version>(ver);
offset += INT_SIZE;
// Format ID
if (data.toUInt(offset, false) != 0) {
std::cerr <<"DSD::Header::parse(): format ID != 0" << std::endl;
return;
}
offset += INT_SIZE;
// Channel Type
unsigned int ct = data.toUInt(offset, false);
if (ct < 1 || ct > 7) {
std::cerr <<"DSD::Header::parse(): channel type out of range" << std::endl;
return;
}
d->channelType = static_cast<ChannelType>(ct);
offset += INT_SIZE;
// Channel Num
d->channelNum = data.toUInt(offset, false);
if (d->channelNum < MinType || d->channelNum > MaxType) {
std::cerr <<"DSD::Header::parse(): channel num out of range" << std::endl;
return;
}
offset += INT_SIZE;
// Sampling frequency
d->sampleRate = data.toUInt(offset, false);
if (d->sampleRate != 2822400 && d->sampleRate != 5644800) {
std::cerr <<"DSD::Header::parse(): invalid sampling frequency" << std::endl;
return;
}
offset += INT_SIZE;
//.........这里部分代码省略.........