Cotton code
34 lines · 1.3 KB · CRaw
// What a song file says about itself, read by TagLib behind a C door, so a// Swift module reads it without C++ interop.//// `cotton_tags_read` answers one JSON object, malloc'd, that the caller frees// with `cotton_tags_free`, or NULL when TagLib cannot open the file:////   { "tags": { "title": …, "artist": …, … }, "picture": "image/jpeg" | null }//// `tags` holds only the keys Cotton Music reads (`cotton_core::music::Tags`,// camelCase, `TAG_FIELDS`): the tag families' common fields, the audio// properties, the lyrics (plain, and an ID3 SYLT frame as LRC), ReplayGain or// R128 gains, the ISRC, the MusicBrainz ids, the sort names, the original// date and the release's label, catalogue number, barcode and kind// (`lyricsBeside` alone is the intake's, never the file's). Nothing else is// asked of TagLib: the// iTunes purchaser atoms (the buyer's account and name, the purchase date)// are never read. The first embedded picture, a front cover first, is written// to `picture_path` when one is given and the file carries one; `picture`// names its type.#ifndef COTTON_TAG_READER_H#define COTTON_TAG_READER_H#ifdef __cplusplusextern "C" {#endifchar *cotton_tags_read(const char *path, const char *picture_path);void cotton_tags_free(char *json);#ifdef __cplusplus}#endif#endif