id3dev 26.01
An ID3 metadata library
Loading...
Searching...
No Matches
id3v2.h
Go to the documentation of this file.
1
11
12#ifndef ID3V2
13#define ID3V2
14
15#ifdef __cplusplus
16extern "C"{
17#endif
18
19#include "id3v2Types.h"
20#include "id3v2TagIdentity.h" // included due to dependency on freeing memory
21
22
23Id3v2Tag *id3v2TagFromFile(const char *filename);
24
25Id3v2Tag *id3v2CopyTag(const Id3v2Tag *toCopy);
26
27// util functions
28
29bool id3v2CompareTag(Id3v2Tag *tag1, Id3v2Tag *tag2);
30
32
33int id3v2RemoveFrameByID(const char *id, Id3v2Tag *tag);
34
35int id3v2InsertTextFrame(const char id[ID3V2_FRAME_ID_MAX_SIZE], const uint8_t encoding, const char *string,
36 Id3v2Tag *tag);
37
38int id3v2ReadTagVersion(const Id3v2Tag *tag);
39
40// compatability functions a.k.a getters
41
43
44char *id3v2ReadTitle(Id3v2Tag *tag);
45
46char *id3v2ReadArtist(Id3v2Tag *tag);
47
49
50char *id3v2ReadAlbum(Id3v2Tag *tag);
51
52char *id3v2ReadYear(Id3v2Tag *tag);
53
54char *id3v2ReadGenre(Id3v2Tag *tag);
55
56char *id3v2ReadTrack(Id3v2Tag *tag);
57
58char *id3v2ReadComposer(Id3v2Tag *tag);
59
60char *id3v2ReadDisc(Id3v2Tag *tag);
61
62char *id3v2ReadLyrics(Id3v2Tag *tag);
63
64char *id3v2ReadComment(Id3v2Tag *tag);
65
66uint8_t *id3v2ReadPicture(uint8_t type, const Id3v2Tag *tag, size_t *dataSize);
67
68// change values within an id3v2 structure
69
70int id3v2WriteTextFrameContent(const char id[ID3V2_FRAME_ID_MAX_SIZE], const char *string, Id3v2Tag *tag);
71
72int id3v2WriteTitle(const char *title, Id3v2Tag *tag);
73
74int id3v2WriteArtist(const char *artist, Id3v2Tag *tag);
75
76int id3v2WriteAlbumArtist(const char *albumArtist, Id3v2Tag *tag);
77
78int id3v2WriteAlbum(const char *album, Id3v2Tag *tag);
79
80int id3v2WriteYear(const char *year, Id3v2Tag *tag);
81
82int id3v2WriteGenre(const char *genre, Id3v2Tag *tag);
83
84int id3v2WriteTrack(const char *track, Id3v2Tag *tag);
85
86int id3v2WriteDisc(const char *disc, Id3v2Tag *tag);
87
88int id3v2WriteComposer(const char *composer, Id3v2Tag *tag);
89
90int id3v2WriteLyrics(const char *lyrics, Id3v2Tag *tag);
91
92int id3v2WriteComment(const char *comment, Id3v2Tag *tag);
93
94int id3v2WritePicture(uint8_t *image, size_t imageSize, const char *kind, uint8_t type, Id3v2Tag *tag);
95
96int id3v2WritePictureFromFile(const char *filename, const char *kind, uint8_t type, Id3v2Tag *tag);
97
98// writes
99
100uint8_t *id3v2TagSerialize(Id3v2Tag *tag, size_t *outl);
101
102char *id3v2TagToJSON(Id3v2Tag *tag);
103
104int id3v2WriteTagToFile(const char *filename, Id3v2Tag *tag);
105
106#ifdef __cplusplus
107} //extern c end
108#endif
109
110#endif
int id3v2WriteLyrics(const char *lyrics, Id3v2Tag *tag)
Writes lyrics to the appropriate unsynchronized lyrics frame in a tag.
Definition id3v2.c:1290
char * id3v2ReadAlbum(Id3v2Tag *tag)
Extracts the album name from an ID3v2 tag.
Definition id3v2.c:483
uint8_t * id3v2TagSerialize(Id3v2Tag *tag, size_t *outl)
Serializes an ID3v2 tag structure to its binary representation.
Definition id3v2.c:1984
int id3v2WriteGenre(const char *genre, Id3v2Tag *tag)
Writes the genre/content type to an ID3v2 tag.
Definition id3v2.c:1077
bool id3v2CompareTag(Id3v2Tag *tag1, Id3v2Tag *tag2)
Performs deep structural comparison of two ID3v2 tags for equality.
Definition id3v2.c:89
int id3v2WritePictureFromFile(const char *filename, const char *kind, uint8_t type, Id3v2Tag *tag)
Reads a picture from a file and writes it to the appropriate attached picture frame in a tag.
Definition id3v2.c:1932
char * id3v2ReadGenre(Id3v2Tag *tag)
Extracts the genre/content type from an ID3v2 tag.
Definition id3v2.c:541
int id3v2WriteYear(const char *year, Id3v2Tag *tag)
Writes the year to an ID3v2 tag.
Definition id3v2.c:1051
char * id3v2ReadTrack(Id3v2Tag *tag)
Extracts the track number/position from an ID3v2 tag.
Definition id3v2.c:570
char * id3v2ReadYear(Id3v2Tag *tag)
Extracts the year from an ID3v2 tag.
Definition id3v2.c:512
char * id3v2ReadTitle(Id3v2Tag *tag)
Extracts the title/song name from an ID3v2 tag.
Definition id3v2.c:396
char * id3v2ReadAlbumArtist(Id3v2Tag *tag)
Extracts the album artist/band/orchestra from an ID3v2 tag.
Definition id3v2.c:454
int id3v2WritePicture(uint8_t *image, size_t imageSize, const char *kind, uint8_t type, Id3v2Tag *tag)
Writes a picture to the appropriate attached picture frame in a tag.
Definition id3v2.c:1794
char * id3v2ReadComment(Id3v2Tag *tag)
Extracts the comment text from an ID3v2 tag.
Definition id3v2.c:727
uint8_t * id3v2ReadPicture(uint8_t type, const Id3v2Tag *tag, size_t *dataSize)
Extracts picture/artwork data of a specific type from an ID3v2 tag.
Definition id3v2.c:797
char * id3v2ReadTextFrameContent(const char id[ID3V2_FRAME_ID_MAX_SIZE], Id3v2Tag *tag)
Extracts the text content from a text frame with the specified ID.
Definition id3v2.c:337
int id3v2WriteTextFrameContent(const char id[ID3V2_FRAME_ID_MAX_SIZE], const char *string, Id3v2Tag *tag)
Writes UTF-8 text content to a text frame, creating it if necessary.
Definition id3v2.c:836
char * id3v2ReadComposer(Id3v2Tag *tag)
Extracts the composer from an ID3v2 tag.
Definition id3v2.c:599
int id3v2ReadTagVersion(const Id3v2Tag *tag)
Retrieves the major version number from an ID3v2 tag.
Definition id3v2.c:316
int id3v2WriteAlbumArtist(const char *albumArtist, Id3v2Tag *tag)
Writes the album artist/band/orchestra to an ID3v2 tag.
Definition id3v2.c:999
char * id3v2ReadArtist(Id3v2Tag *tag)
Extracts the lead artist/performer from an ID3v2 tag.
Definition id3v2.c:425
int id3v2InsertTextFrame(const char id[ID3V2_FRAME_ID_MAX_SIZE], const uint8_t encoding, const char *string, Id3v2Tag *tag)
Creates and inserts a new text frame with the specified encoding into a tag.
Definition id3v2.c:235
int id3v2WriteDisc(const char *disc, Id3v2Tag *tag)
Writes a disc number to the appropriate disc number frame in a tag.
Definition id3v2.c:1129
char * id3v2ReadDisc(Id3v2Tag *tag)
Extracts the disc number/position from an ID3v2 tag.
Definition id3v2.c:628
int id3v2WriteComposer(const char *composer, Id3v2Tag *tag)
Writes a composer name to the appropriate composer frame in a tag.
Definition id3v2.c:1155
Id3v2Tag * id3v2TagFromFile(const char *filename)
Reads and parses an ID3v2 tag from a file.
Definition id3v2.c:31
int id3v2WriteTagToFile(const char *filename, Id3v2Tag *tag)
Writes an ID3v2 tag to a file, creating, prepending, or replacing as needed.
Definition id3v2.c:2317
Id3v2Tag * id3v2CopyTag(const Id3v2Tag *toCopy)
Creates a deep copy of an ID3v2 tag structure.
Definition id3v2.c:57
Id3v2Frame * id3v2ReadFrameByID(const char id[ID3V2_FRAME_ID_MAX_SIZE], Id3v2Tag *tag)
Searches for and returns a copy of the first frame matching the given ID.
Definition id3v2.c:173
int id3v2WriteTitle(const char *title, Id3v2Tag *tag)
Writes the title/song name to an ID3v2 tag.
Definition id3v2.c:947
char * id3v2TagToJSON(Id3v2Tag *tag)
Serializes an ID3v2 tag structure to JSON format.
Definition id3v2.c:2184
int id3v2WriteArtist(const char *artist, Id3v2Tag *tag)
Writes the lead artist/performer to an ID3v2 tag.
Definition id3v2.c:973
int id3v2WriteTrack(const char *track, Id3v2Tag *tag)
Writes the track number/position to an ID3v2 tag.
Definition id3v2.c:1103
int id3v2WriteAlbum(const char *album, Id3v2Tag *tag)
Writes the album name to an ID3v2 tag.
Definition id3v2.c:1025
int id3v2RemoveFrameByID(const char *id, Id3v2Tag *tag)
Locates and removes the first frame matching the given ID from a tag.
Definition id3v2.c:208
char * id3v2ReadLyrics(Id3v2Tag *tag)
Extracts unsynchronised lyrics/text transcription from an ID3v2 tag.
Definition id3v2.c:658
int id3v2WriteComment(const char *comment, Id3v2Tag *tag)
Writes a comment to the appropriate comment frame in a tag.
Definition id3v2.c:1553
Function definitions of ID3v2 tag header and tag structure creation, manipulation,...
Definitions for ID3v2.x tag structure, constants, and genre enumeration.
struct _Id3v2Tag Id3v2Tag
Complete ID3v2 tag structure containing header and metadata frames.
#define ID3V2_FRAME_ID_MAX_SIZE
Maximum size in bytes for a frame ID field (4 bytes).
Definition id3v2Types.h:70
struct _Id3v2Frame Id3v2Frame
Complete ID3v2 frame structure with header, parsing contexts, and data.