|
id3dev 26.01
An ID3 metadata library
|
Declarations of ID3v1 tag parsing and memory management functions. More...
#include <stdio.h>#include <stdlib.h>#include <string.h>#include "id3v1/id3v1Types.h"#include "id3v1/id3v1Parser.h"#include "id3dependencies/ByteStream/include/byteStream.h"#include "id3dependencies/ByteStream/include/byteInt.h"
Go to the source code of this file.
Functions | |
| bool | id3v1HasTag (const uint8_t *buffer) |
| Checks if a buffer contains a valid ID3v1 tag identifier. | |
| Id3v1Tag * | id3v1CreateTag (uint8_t *title, uint8_t *artist, uint8_t *albumTitle, int year, int track, uint8_t *comment, Genre genre) |
| Creates and allocates a new Id3v1Tag structure. | |
| void | id3v1ClearTag (Id3v1Tag *tag) |
| Resets all tag fields to their default empty state. | |
| void | id3v1DestroyTag (Id3v1Tag **toDelete) |
| Frees an Id3v1Tag and nullifies the pointer. | |
| Id3v1Tag * | id3v1TagFromBuffer (uint8_t *buffer) |
| Parses an ID3V1_MAX_SIZE buffer into an Id3v1Tag structure. | |
Declarations of ID3v1 tag parsing and memory management functions.
Implementation of ID3v1 tag parsing and memory management functions.
Definition in file id3v1Parser.c.
| void id3v1ClearTag | ( | Id3v1Tag * | tag | ) |
Resets all tag fields to their default empty state.
Zeros out all string fields and sets numeric fields to 0. Genre is set to OTHER_GENRE as the default unknown value.
| tag | - The tag to clear. |
Definition at line 82 of file id3v1Parser.c.
| Id3v1Tag * id3v1CreateTag | ( | uint8_t * | title, |
| uint8_t * | artist, | ||
| uint8_t * | albumTitle, | ||
| int | year, | ||
| int | track, | ||
| uint8_t * | comment, | ||
| Genre | genre ) |
Creates and allocates a new Id3v1Tag structure.
Allocates memory, initializes all fields to zero, then copies provided values. String fields are truncated to ID3V1_FIELD_SIZE if needed. Caller must free with id3v1DestroyTag.
| title | - Song title. |
| artist | - Artist name. |
| albumTitle | - Album title. |
| year | - Release year |
| track | - Track number |
| comment | - Comment text. |
| genre | - Genre enum value |
Definition at line 41 of file id3v1Parser.c.
| void id3v1DestroyTag | ( | Id3v1Tag ** | toDelete | ) |
Frees an Id3v1Tag and nullifies the pointer.
Deallocates the tag memory and sets the pointer to NULL to prevent dangling pointer issues.
| toDelete | - Pointer to the tag pointer to free. Safe to call with NULL. |
Definition at line 102 of file id3v1Parser.c.
| bool id3v1HasTag | ( | const uint8_t * | buffer | ) |
Checks if a buffer contains a valid ID3v1 tag identifier.
Compares the first ID3V1_TAG_ID_SIZE bytes of the buffer against the "TAG" identifier.
| buffer | - The buffer to check. Must contain at least ID3V1_TAG_ID_SIZE bytes. |
Definition at line 25 of file id3v1Parser.c.
| Id3v1Tag * id3v1TagFromBuffer | ( | uint8_t * | buffer | ) |
Parses an ID3V1_MAX_SIZE buffer into an Id3v1Tag structure.
Performs sequential field extraction with extensive error checking. Returns partial tags with default values if parsing fails partway through. Detects ID3v1.1 track numbers via null byte at position 28.
| buffer | - Buffer containing ID3V1_MAX_SIZE (128) bytes to parse. |
Definition at line 119 of file id3v1Parser.c.