6#include <c++utilities/conversion/binaryconversion.h>
7#include <c++utilities/io/binaryreader.h>
8#include <c++utilities/io/binarywriter.h>
9#include <c++utilities/io/bitreader.h>
31 m_last =
static_cast<std::uint8_t
>(buffer[0] & 0x80);
32 m_type =
static_cast<std::uint8_t
>(buffer[0] & (0x80 - 1));
33 m_dataSize = BE::toUInt24(buffer.data() + 1);
43 *buff = (m_last ? (0x80 | m_type) : m_type);
44 BE::getBytes24(m_dataSize,
reinterpret_cast<char *
>(buff) + 1);
45 outputStream.write(
reinterpret_cast<char *
>(buff),
sizeof(buff));
60 auto reader = BitReader(buffer.data(), 0x22);
61 m_minBlockSize = reader.readBits<std::uint16_t>(16);
62 m_maxBlockSize = reader.readBits<std::uint16_t>(16);
63 m_minFrameSize = reader.readBits<std::uint32_t>(24);
64 m_maxFrameSize = reader.readBits<std::uint32_t>(24);
65 m_samplingFrequency = reader.readBits<std::uint32_t>(20);
66 m_channelCount = reader.readBits<std::uint8_t>(3) + 1;
67 m_bitsPerSample = reader.readBits<std::uint8_t>(5) + 1;
68 m_totalSampleCount = reader.readBits<std::uint64_t>(36);
69 std::memcpy(m_md5Sum, buffer.data() + 0x22u -
sizeof(m_md5Sum),
sizeof(m_md5Sum));
86 BinaryReader reader(&inputStream);
87 m_pictureType = reader.readUInt32BE();
88 std::uint32_t size = reader.readUInt32BE();
91 size = reader.readUInt32BE();
95 inputStream.seekg(4 * 4, ios_base::cur);
96 size = reader.readUInt32BE();
99 auto data = make_unique<char[]>(size);
100 inputStream.read(data.get(), size);
115 if (
requiredSize > numeric_limits<std::uint32_t>::max()) {
127 if (m_value.
mimeType().size() > numeric_limits<std::uint32_t>::max() || m_value.
description().size() > numeric_limits<std::uint32_t>::max()
128 || m_value.
dataSize() > numeric_limits<std::uint32_t>::max()) {
131 BinaryWriter writer(&outputStream);
133 writer.writeUInt32BE(
static_cast<std::uint32_t
>(m_value.
mimeType().size()));
134 writer.writeString(m_value.
mimeType());
135 writer.writeUInt32BE(
static_cast<std::uint32_t
>(m_value.
description().size()));
137 writer.writeUInt32BE(0);
138 writer.writeUInt32BE(0);
139 writer.writeUInt32BE(0);
140 writer.writeUInt32BE(0);
141 writer.writeUInt32BE(
static_cast<std::uint32_t
>(m_value.
dataSize()));
142 writer.write(
value().dataPointer(),
static_cast<streamoff
>(m_value.
dataSize()));
The exception that is thrown when the data to be parsed or to be made seems invalid and therefore can...
void setMimeType(std::string_view mimeType)
Sets the MIME type.
const std::string & mimeType() const
Returns the MIME type.
void assignData(const char *data, std::size_t length, TagDataType type=TagDataType::Binary, TagTextEncoding encoding=TagTextEncoding::Latin1)
void setDescription(std::string_view value, TagTextEncoding encoding=TagTextEncoding::Latin1)
Sets the description.
std::size_t dataSize() const
Returns the size of the assigned value in bytes.
void clearData()
Clears the assigned data.
const std::string & description() const
Returns the description.
#define CHECK_MAX_SIZE(sizeDenotation)
Throws TruncatedDataException() if the specified sizeDenotation exceeds maxSize; otherwise maxSize is...
Contains all classes and functions of the TagInfo library.