id3dev 26.01 An ID3 metadata library

Loading...
Searching...
No Matches
id3v2TagIdentity.c File Reference

Function implementations of ID3v2 tag header and tag structure creation, manipulation, serialization, and JSON conversion. More...

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include "id3v2/id3v2TagIdentity.h"`
`#include "id3dependencies/ByteStream/include/byteStream.h"`
`#include "id3dependencies/ByteStream/include/byteInt.h"`
Include dependency graph for id3v2TagIdentity.c:

Go to the source code of this file.

## Functions
Id3v2TagHeader * | id3v2CreateTagHeader (uint8_t majorVersion, uint8_t minorVersion, uint8_t flags, Id3v2ExtendedTagHeader *extendedHeader)
| Creates and allocates an ID3v2 tag header structure.
void | id3v2DestroyTagHeader (Id3v2TagHeader **toDelete)
| Frees an ID3v2 tag header and nullifies the pointer.
bool | id3v2WriteUnsynchronisationIndicator (Id3v2TagHeader *header, bool bit)
| Sets or clears the unsynchronisation flag in the tag header.
bool | id3v2WriteCompressionIndicator (Id3v2TagHeader *header, bool bit)
| Sets or clears the compression flag in ID3v2.2 tag headers.
bool | id3v2WriteExtendedHeaderIndicator (Id3v2TagHeader *header, bool bit)
| Sets or clears the extended header flag in ID3v2.3/ID3v2.4 tag headers.
bool | id3v2WriteExperimentalIndicator (Id3v2TagHeader *header, bool bit)
| Sets or clears the experimental indicator flag in ID3v2.3/ID3v2.4 tag headers.
bool | id3v2WriteFooterIndicator (Id3v2TagHeader *header, bool bit)
| Sets or clears the footer presence flag in ID3v2.4 tag headers.
int | id3v2ReadUnsynchronisationIndicator (Id3v2TagHeader *header)
| Reads the unsynchronisation flag from a tag header.
int | id3v2ReadCompressionIndicator (Id3v2TagHeader *header)
| Reads the compression flag from an ID3v2.2 tag header.
int | id3v2ReadExtendedHeaderIndicator (Id3v2TagHeader *header)
| Reads the extended header flag from an ID3v2.3/ID3v2.4 tag header.
int | id3v2ReadExperimentalIndicator (Id3v2TagHeader *header)
| Reads the experimental indicator flag from an ID3v2.3/ID3v2.4 tag header.
int | id3v2ReadFooterIndicator (Id3v2TagHeader *header)
| Reads the footer presence flag from an ID3v2.4 tag header.
Id3v2ExtendedTagHeader * | id3v2CreateExtendedTagHeader (uint32_t padding, uint32_t crc, bool update, bool tagRestrictions, uint8_t restrictions)
| Creates and allocates an ID3v2 extended tag header structure.
void | id3v2DestroyExtendedTagHeader (Id3v2ExtendedTagHeader **toDelete)
| Frees an ID3v2 extended tag header and nullifies the pointer.
bool | id3v2WriteTagSizeRestriction (Id3v2TagHeader *header, uint8_t bits)
| Sets the tag size restriction in an ID3v2.4 extended header.
bool | id3v2WriteTextEncodingRestriction (Id3v2TagHeader *header, bool bit)
| Sets the text encoding restriction in an ID3v2.4 extended header.
bool | id3v2WriteTextFieldsSizeRestriction (Id3v2TagHeader *header, uint8_t bits)
| Sets the text encoding restriction in an ID3v2.4 extended header.
bool | id3v2WriteImageEncodingRestriction (Id3v2TagHeader *header, bool bit)
| Sets the image encoding restriction in an ID3v2.4 extended header.
bool | id3v2WriteImageSizeRestriction (Id3v2TagHeader *header, uint8_t bits)
| Sets the image size restriction in an ID3v2.4 extended header.
int | id3v2ReadTagSizeRestriction (Id3v2TagHeader *header)
| Reads the tag size restriction from an ID3v2.4 extended header.
int | id3v2ReadTextEncodingRestriction (Id3v2TagHeader *header)
| Reads the text encoding restriction from an ID3v2.4 extended header.
int | id3v2ReadTextFieldsSizeRestriction (Id3v2TagHeader *header)
| Reads the text fields size restriction from an ID3v2.4 extended header.
int | id3v2ReadImageEncodingRestriction (Id3v2TagHeader *header)
| Reads the image encoding restriction from an ID3v2.4 extended header.
int | id3v2ReadImageSizeRestriction (Id3v2TagHeader *header)
| Reads the image size restriction from an ID3v2.4 extended header.
bool | id3v2ClearTagRestrictions (Id3v2TagHeader *header)
| Clears all tag restrictions from an ID3v2.4 extended header.
Id3v2Tag * | id3v2CreateTag (Id3v2TagHeader *header, List *frames)
| Creates and allocates an ID3v2 tag structure.
void | id3v2DestroyTag (Id3v2Tag **toDelete)
| Frees an ID3v2 tag and all associated resources, nullifying the pointer.
uint8_t * | id3v2ExtendedTagHeaderSerialize (Id3v2ExtendedTagHeader *ext, uint8_t version, size_t *outl)
| Serializes an ID3v2 extended tag header into a byte stream.
char * | id3v2ExtendedTagHeaderToJSON (const Id3v2ExtendedTagHeader *ext, uint8_t version)
| Converts an ID3v2 extended tag header structure to JSON string representation.
uint8_t * | id3v2TagHeaderSerialize (Id3v2TagHeader *header, uint32_t uintSize, size_t *outl)
| Serializes an ID3v2 tag header into a byte stream.
char * | id3v2TagHeaderToJSON (const Id3v2TagHeader *header)
| Converts an ID3v2 tag header structure to JSON string representation.

## Detailed Description

Function implementations of ID3v2 tag header and tag structure creation, manipulation, serialization, and JSON conversion.

Author
  Ewan Jones

Version
  26.01

Date
  2024-04-11 - 2026-01-13

Copyright
  Copyright (c) 2024 - 2026

Definition in file id3v2TagIdentity.c.

## Function Documentation

## ◆ id3v2ClearTagRestrictions()

bool id3v2ClearTagRestrictions | ( | Id3v2TagHeader * | header | ) |

Clears all tag restrictions from an ID3v2.4 extended header.

Resets the tagRestrictions flag to false and zeroes the restrictions byte, removing all tag size, text encoding, text field size, image encoding, and image size restrictions. Requires a valid extended header to be present. Only applicable to ID3v2.4 tags as earlier versions do not support restrictions.

Parameters

  header | - The tag header to modify.

Returns
  bool - true on success, false on failure.

Definition at line 606 of file id3v2TagIdentity.c.

## ◆ id3v2CreateExtendedTagHeader()

Id3v2ExtendedTagHeader * id3v2CreateExtendedTagHeader | ( | uint32_t | padding,
|  | uint32_t | crc,
|  | bool | update,
|  | bool | tagRestrictions,
|  | uint8_t | restrictions )

Creates and allocates an ID3v2 extended tag header structure.

Allocates memory and initializes extended header members with provided padding, CRC, update flag, and restrictions. Extended headers contain optional metadata used in ID3v2.3 and ID3v2.4 tags. Caller must free with id3v2DestroyExtendedTagHeader.

Parameters

  padding | - Padding size in bytes (ID3v2.3) or unused (ID3v2.4).
  crc | - CRC-32 checksum value for data integrity verification (0 if not used).
  update | - Update flag indicating tag is an update of previous tag (ID3v2.4 only).
  tagRestrictions | - Whether tag restrictions are present (ID3v2.4 only).
  restrictions | - Restrictions byte defining tag size, text encoding, and image limitations.

Returns
  Id3v2ExtendedTagHeader* - Heap-allocated extended header structure.

Definition at line 280 of file id3v2TagIdentity.c.

## ◆ id3v2CreateTag()

Id3v2Tag * id3v2CreateTag | ( | Id3v2TagHeader * | header,
|  | List * | frames )

Creates and allocates an ID3v2 tag structure.

Allocates memory and initializes a complete ID3v2 tag with the provided header and frame list while taking ownership. The tag structure combines the tag header with the list of data frames. Caller must free with id3v2DestroyTag.

Parameters

  header | - Pointer to an initialized tag header structure.
  frames | - Pointer to a list containing ID3v2 frame structures.

Returns
  Id3v2Tag* - Heap-allocated tag structure.

Definition at line 630 of file id3v2TagIdentity.c.

## ◆ id3v2CreateTagHeader()

Id3v2TagHeader * id3v2CreateTagHeader | ( | uint8_t | majorVersion,
|  | uint8_t | minorVersion,
|  | uint8_t | flags,
|  | Id3v2ExtendedTagHeader * | extendedHeader )

Creates and allocates an ID3v2 tag header structure.

Allocates memory and initializes header fields with provided version, flags, and optional extended header. Caller must free with id3v2DestroyTagHeader.

Parameters

  majorVersion | - Major version number (2, 3, or 4)
  minorVersion | - Minor version/revision number
  flags | - Tag header flags byte (abcd0000)
  extendedHeader | - Pointer to extended header structure.

Returns
  Id3v2TagHeader* - Heap-allocated tag header structure.

Definition at line 29 of file id3v2TagIdentity.c.

## ◆ id3v2DestroyExtendedTagHeader()

void id3v2DestroyExtendedTagHeader | ( | Id3v2ExtendedTagHeader ** | toDelete | ) |

Frees an ID3v2 extended tag header and nullifies the pointer.

Deallocates extended header memory and sets pointer to NULL to prevent dangling pointer issues.

Parameters

  toDelete | - Pointer to the extended tag header pointer to free.

Definition at line 301 of file id3v2TagIdentity.c.

## ◆ id3v2DestroyTag()

void id3v2DestroyTag | ( | Id3v2Tag ** | toDelete | ) |

Frees an ID3v2 tag and all associated resources, nullifying the pointer.

Recursively destroys the tag header (including extended header if present), frees the frames list and all frame contents, deallocates the tag structure memory, and sets the pointer to NULL to prevent dangling pointer issues.

Parameters

  toDelete | - Pointer to the tag pointer to free.

Definition at line 646 of file id3v2TagIdentity.c.

## ◆ id3v2DestroyTagHeader()

void id3v2DestroyTagHeader | ( | Id3v2TagHeader ** | toDelete | ) |

Frees an ID3v2 tag header and nullifies the pointer.

Recursively destroys extended header if present, deallocates header memory, and sets pointer to NULL to prevent dangling pointer issues.

Parameters

  toDelete | - Pointer to the tag header pointer to free.

Definition at line 47 of file id3v2TagIdentity.c.

## ◆ id3v2ExtendedTagHeaderSerialize()

uint8_t * id3v2ExtendedTagHeaderSerialize | ( | Id3v2ExtendedTagHeader * | ext,
|  | uint8_t | version,
|  | size_t * | outl )

Serializes an ID3v2 extended tag header into a byte stream.

Converts an extended header structure into its binary representation according to the ID3v2 specification. Returns a dynamically allocated byte array that must be freed by the caller. Handles version-specific formats:

- ID3v2.3: Writes 10+ bytes containing size (4), flags (1+2 reserved), padding size (4), and optional CRC-32 (4).
- ID3v2.4: Writes 6+ bytes containing extended size (4), flag bytes count (1), flags (update/CRC/restrictions in 1 byte), optional syncsafe CRC-32 (5), and optional restrictions byte (1).

ID3v2.2 does not support extended headers and returns NULL.

Parameters

  ext | - Pointer to the extended header structure to serialize.
  version | - ID3v2 version (ID3V2_TAG_VERSION_2, ID3V2_TAG_VERSION_3, or ID3V2_TAG_VERSION_4) determining serialization format.
  outl | - Output parameter receiving the size of the returned byte array.

Returns
  uint8_t* - Dynamically allocated byte array containing serialized header, or NULL on failure. Caller must free returned memory.

Definition at line 676 of file id3v2TagIdentity.c.

## ◆ id3v2ExtendedTagHeaderToJSON()

char * id3v2ExtendedTagHeaderToJSON | ( | const Id3v2ExtendedTagHeader * | ext,
|  | uint8_t | version )

Converts an ID3v2 extended tag header structure to JSON string representation.

Creates a dynamically allocated JSON string containing the extended header's fields according to the specified ID3v2 version. Returns an empty JSON object "{}" if the header is NULL or the version is unsupported. The caller must free the returned string.

- ID3v2.3: Returns JSON with padding and crc fields. Example: {"padding":100,"crc":12345678}
- ID3v2.4: Returns JSON with padding, crc, update flag, tagRestrictions flag, and restrictions byte value. Example: {"padding":0,"crc":0,"update":false,"tagRestrictions":true,"restrictions":64}
- ID3v2.2 and unsupported versions: Returns empty JSON object "{}".

Parameters

  ext | - Pointer to the extended header structure to convert (may be NULL).
  version | - ID3v2 version (ID3V2_TAG_VERSION_2, ID3V2_TAG_VERSION_3, or ID3V2_TAG_VERSION_4) determining which fields to include.

Returns
  char* - Dynamically allocated JSON string. Caller must free the returned memory.

Definition at line 804 of file id3v2TagIdentity.c.

## ◆ id3v2ReadCompressionIndicator()

int id3v2ReadCompressionIndicator | ( | Id3v2TagHeader * | header | ) |

Reads the compression flag from an ID3v2.2 tag header.

Extracts bit 6 of the header flags byte. Only valid for ID3v2.2 tags.

Parameters

  header | - The tag header to read from.

Returns
  int - 0 or 1 if successful, -1 on failure.

Definition at line 190 of file id3v2TagIdentity.c.

## ◆ id3v2ReadExperimentalIndicator()

int id3v2ReadExperimentalIndicator | ( | Id3v2TagHeader * | header | ) |

Reads the experimental indicator flag from an ID3v2.3/ID3v2.4 tag header.

Extracts bit 5 of the header flags byte. The experimental indicator marks a tag as being in an experimental or testing state. Only valid for ID3v2.3 and ID3v2.4 tags as this flag is not available in ID3v2.2.

Parameters

  header | - The tag header to read from.

Returns
  int - 0 or 1 if successful, -1 on failure.

Definition at line 233 of file id3v2TagIdentity.c.

## ◆ id3v2ReadExtendedHeaderIndicator()

int id3v2ReadExtendedHeaderIndicator | ( | Id3v2TagHeader * | header | ) |

Reads the extended header flag from an ID3v2.3/ID3v2.4 tag header.

Extracts bit 6 of the header flags byte. Only valid for ID3v2.3 and ID3v2.4 tags as ID3v2.2 does not support extended headers.

Parameters

  header | - The tag header to read from.

Returns
  int - 0 or 1 if successful, -1 on failure.

Definition at line 209 of file id3v2TagIdentity.c.

## ◆ id3v2ReadFooterIndicator()

int id3v2ReadFooterIndicator | ( | Id3v2TagHeader * | header | ) |

Reads the footer presence flag from an ID3v2.4 tag header.

Extracts bit 4 of the header flags byte. Only valid for ID3v2.4 tags as earlier versions do not support footers.

Parameters

  header | - The tag header to read from.

Returns
  int - 0 or 1 if successful, -1 on failure.

Definition at line 256 of file id3v2TagIdentity.c.

## ◆ id3v2ReadImageEncodingRestriction()

int id3v2ReadImageEncodingRestriction | ( | Id3v2TagHeader * | header | ) |

Reads the image encoding restriction from an ID3v2.4 extended header.

Extracts bit 2 from the restrictions byte. When set (1), embedded images are restricted to PNG [PNG] or JPEG [JFIF] format only. Requires a valid extended header with restrictions enabled.

Parameters

  header | - The tag header to read from.

Returns
  int - 0 or 1 on success, -1 on failure.

Definition at line 558 of file id3v2TagIdentity.c.

## ◆ id3v2ReadImageSizeRestriction()

int id3v2ReadImageSizeRestriction | ( | Id3v2TagHeader * | header | ) |

Reads the image size restriction from an ID3v2.4 extended header.

Extracts bits 0-1 from the restrictions byte and combines them into a 2-bit value (0x00-0x03) indicating the maximum image dimension restriction level. Requires a valid extended header with restrictions enabled.

Parameters

  header | - The tag header to read from.

Returns
  int - Restriction level (0-3) on success, -1 on failure.

Definition at line 578 of file id3v2TagIdentity.c.

## ◆ id3v2ReadTagSizeRestriction()

int id3v2ReadTagSizeRestriction | ( | Id3v2TagHeader * | header | ) |

Reads the tag size restriction from an ID3v2.4 extended header.

Extracts bits 6-7 from the restrictions byte and combines them into a 2-bit value (0x00-0x03) indicating the maximum tag size restriction level. Requires a valid extended header with restrictions enabled.

Parameters

  header | - The tag header to read from.

Returns
  int - Restriction level (0-3) on success, -1 on failure.

Definition at line 483 of file id3v2TagIdentity.c.

## ◆ id3v2ReadTextEncodingRestriction()

int id3v2ReadTextEncodingRestriction | ( | Id3v2TagHeader * | header | ) |

Reads the text encoding restriction from an ID3v2.4 extended header.

Extracts bit 5 from the restrictions byte. When set (1), text encodings are restricted to ISO-8859-1 or UTF-8 only. Requires a valid extended header with restrictions enabled.

Parameters

  header | - The tag header to read from.

Returns
  int - 0 or 1 on success, -1 on failure.

Definition at line 510 of file id3v2TagIdentity.c.

## ◆ id3v2ReadTextFieldsSizeRestriction()

int id3v2ReadTextFieldsSizeRestriction | ( | Id3v2TagHeader * | header | ) |

Reads the text fields size restriction from an ID3v2.4 extended header.

Extracts bits 3-4 from the restrictions byte and combines them into a 2-bit value (0x00-0x03) indicating the maximum text field size restriction level. Requires a valid extended header with restrictions enabled.

Parameters

  header | - The tag header to read from.

Returns
  int - Restriction level (0-3) on success, -1 on failure.

Definition at line 530 of file id3v2TagIdentity.c.

## ◆ id3v2ReadUnsynchronisationIndicator()

int id3v2ReadUnsynchronisationIndicator | ( | Id3v2TagHeader * | header | ) |

Reads the unsynchronisation flag from a tag header.

Extracts bit 7 of the header flags byte. Valid for all ID3v2 versions (2.2, 2.3, 2.4).

Parameters

  header | - The tag header to read from.

Returns
  int - 0 or 1 if successful, -1 on failure.

Definition at line 176 of file id3v2TagIdentity.c.

## ◆ id3v2TagHeaderSerialize()

uint8_t * id3v2TagHeaderSerialize | ( | Id3v2TagHeader * | header,
|  | uint32_t | uintSize,
|  | size_t * | outl )

Serializes an ID3v2 tag header into a byte stream.

Converts a tag header structure into its binary representation per the ID3v2 specification. Returns a dynamically allocated byte array containing:

"ID3" identifier (3) + major version (1) + minor version (1) + flags (1) + syncsafe tag size (4) + optional extended header (variable).

Version-specific flags written: v2.2 (unsync, compression), v2.3 (unsync, extended header, experimental), v2.4 (unsync, extended header, experimental, footer). Returns NULL for versions > 2.4 or NULL input.

Parameters

  header | - Pointer to the tag header structure to serialize.
  uintSize | - Tag size in bytes (excluding 10-byte header), encoded as syncsafe integer.
  outl | - Output parameter receiving total size of returned byte array.

Returns
  uint8_t* - Dynamically allocated byte array containing serialized header, or NULL on failure. Caller must free.

Definition at line 883 of file id3v2TagIdentity.c.

## ◆ id3v2TagHeaderToJSON()

char * id3v2TagHeaderToJSON | ( | const Id3v2TagHeader * | header | ) |

Converts an ID3v2 tag header structure to JSON string representation.

Creates a dynamically allocated JSON string containing the tag header's version, flags, and extended header fields according to the ID3v2 version. Returns an empty JSON object "{}" if the header is NULL or the version is unsupported. The caller must free the returned string.

- ID3v2.2: Returns JSON with major/minor version and flags byte. Example: {"major":2,"minor":0,"flags":0}
- ID3v2.3: Returns JSON with version, flags, and embedded extended header JSON. Example: {"major":3,"minor":0,"flags":64,"extended":{"padding":100,"crc":12345678}}
- ID3v2.4: Returns JSON with version, flags, and embedded extended header JSON. Example: {"major":4,"minor":0,"flags":64,"extended":{"padding":0,"crc":0,"update":false,"tagRestrictions":true,"restrictions":64}}
- Unsupported versions: Returns empty JSON object "{}".

Parameters

  header | - Pointer to the tag header structure to convert (may be NULL).

Returns
  char* - Dynamically allocated JSON string. Caller must free the returned memory.

Definition at line 980 of file id3v2TagIdentity.c.

## ◆ id3v2WriteCompressionIndicator()

bool id3v2WriteCompressionIndicator | ( | Id3v2TagHeader * | header,
|  | bool | bit )

Sets or clears the compression flag in ID3v2.2 tag headers.

Modifies bit 6 of the header flags byte. Only applicable to ID3v2.2 tags; returns failure for other versions as compression moved to frame-level in v2.3+.

Parameters

  header | - The tag header to modify.
  bit | - true to set compression flag, false to clear it.

Returns
  bool - true on success, false on failure.

Definition at line 81 of file id3v2TagIdentity.c.

## ◆ id3v2WriteExperimentalIndicator()

bool id3v2WriteExperimentalIndicator | ( | Id3v2TagHeader * | header,
|  | bool | bit )

Sets or clears the experimental indicator flag in ID3v2.3/ID3v2.4 tag headers.

Modifies bit 5 of the header flags byte. Marks tag as experimental/testing. Only applicable to ID3v2.3 and ID3v2.4 tags; returns failure for other versions.

Parameters

  header | - The tag header to modify.
  bit | - true to set experimental flag, false to clear it.

Returns
  bool - true on success, false on failure.

Definition at line 128 of file id3v2TagIdentity.c.

## ◆ id3v2WriteExtendedHeaderIndicator()

bool id3v2WriteExtendedHeaderIndicator | ( | Id3v2TagHeader * | header,
|  | bool | bit )

Sets or clears the extended header flag in ID3v2.3/ID3v2.4 tag headers.

Modifies bit 6 of the header flags byte. Only applicable to ID3v2.3 and ID3v2.4 tags; returns failure for other versions as ID3v2.2 does not support extended headers.

Parameters

  header | - The tag header to modify.
  bit | - true to set extended header flag, false to clear it.

Returns
  bool - true on success, false on failure

Definition at line 102 of file id3v2TagIdentity.c.

## ◆ id3v2WriteFooterIndicator()

bool id3v2WriteFooterIndicator | ( | Id3v2TagHeader * | header,
|  | bool | bit )

Sets or clears the footer presence flag in ID3v2.4 tag headers.

Modifies bit 4 of the header flags byte. Footer is a 10-byte structure at tag end mirroring the header with reversed "3DI" identifier. Only applicable to ID3v2.4 tags.

Parameters

  header | - The tag header to modify.
  bit | - true to set footer flag, false to clear it.

Returns
  bool - true on success, false on failure.

Definition at line 154 of file id3v2TagIdentity.c.

## ◆ id3v2WriteImageEncodingRestriction()

bool id3v2WriteImageEncodingRestriction | ( | Id3v2TagHeader * | header,
|  | bool | bit )

Sets the image encoding restriction in an ID3v2.4 extended header.

Modifies bit 2 of the restrictions byte to limit allowed image formats. When set, restricts embedded images to PNG [PNG] or JPEG [JFIF] format only. Only applicable to ID3v2.4 tags. Automatically creates an extended header if not present and enables the tagRestrictions flag.

Parameters

  header | - The tag header to modify.
  bit | - true to enable image encoding restriction, false to disable.

Returns
  bool - true on success, false on failure.

Definition at line 419 of file id3v2TagIdentity.c.

## ◆ id3v2WriteImageSizeRestriction()

bool id3v2WriteImageSizeRestriction | ( | Id3v2TagHeader * | header,
|  | uint8_t | bits )

Sets the image size restriction in an ID3v2.4 extended header.

Modifies bits 0-1 of the restrictions byte to set maximum image dimension limitations. The 2-bit value defines four restriction levels (0x00-0x03) for embedded image sizes. Only applicable to ID3v2.4 tags. Automatically creates an extended header if not present and enables the tagRestrictions flag.

Parameters

  header | - The tag header to modify.
  bits | - Restriction level (0x00-0x03): defines maximum allowed image dimensions.

Returns
  bool - true on success, false on failure.

Definition at line 451 of file id3v2TagIdentity.c.

## ◆ id3v2WriteTagSizeRestriction()

bool id3v2WriteTagSizeRestriction | ( | Id3v2TagHeader * | header,
|  | uint8_t | bits )

Sets the tag size restriction in an ID3v2.4 extended header.

Modifies bits 6-7 of the restrictions byte to set maximum tag size limitations. The 2-bit value defines four restriction levels (0x00-0x03). Only applicable to ID3v2.4 tags. Automatically creates an extended header if not present and enables the tagRestrictions flag.

Parameters

  header | - The tag header to modify.
  bits | - Restriction level (0x00-0x03): defines maximum allowed tag size.

Returns
  bool - true on success, false on failure.

Definition at line 319 of file id3v2TagIdentity.c.

## ◆ id3v2WriteTextEncodingRestriction()

bool id3v2WriteTextEncodingRestriction | ( | Id3v2TagHeader * | header,
|  | bool | bit )

Sets the text encoding restriction in an ID3v2.4 extended header.

Modifies bit 5 of the restrictions byte to limit allowed text encodings. When set, restricts text encoding to ISO-8859-1 or UTF-8 only. Only applicable to ID3v2.4 tags. Automatically creates an extended header if not present and enables the tagRestrictions flag.

Parameters

  header | - The tag header to modify.
  bit | - true to enable text encoding restriction, false to disable.

Returns
  bool - true on success, false on failure.

Definition at line 353 of file id3v2TagIdentity.c.

## ◆ id3v2WriteTextFieldsSizeRestriction()

bool id3v2WriteTextFieldsSizeRestriction | ( | Id3v2TagHeader * | header,
|  | uint8_t | bits )

Sets the text encoding restriction in an ID3v2.4 extended header.

Modifies bit 5 of the restrictions byte to limit allowed text encodings. When set, restricts text encoding to ISO-8859-1 or UTF-8 only. Only applicable to ID3v2.4 tags. Automatically creates an extended header if not present and enables the tagRestrictions flag.

Parameters

  header | - The tag header to modify.
  bit | - true to enable text encoding restriction, false to disable.

Returns
  bool - true on success, false on failure.

Definition at line 385 of file id3v2TagIdentity.c.

## ◆ id3v2WriteUnsynchronisationIndicator()

bool id3v2WriteUnsynchronisationIndicator | ( | Id3v2TagHeader * | header,
|  | bool | bit )

Sets or clears the unsynchronisation flag in the tag header.

Modifies bit 7 of the header flags byte. Unsynchronisation prevents false sync patterns in tag data.

Parameters

  header | - The tag header to modify.
  bit | - true to set unsynchronisation flag, false to clear it.

Returns
  bool - true on success, false on failure.

Definition at line 63 of file id3v2TagIdentity.c.