libcdio  2.1.0
About: GNU libcdio is a library for CD-ROM and CD image access.
  Fossies Dox: libcdio-2.1.0.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

cdtext.h File Reference

The top-level header for CD-Text information. Applications include this for CD-Text access. More...

#include <cdio/types.h>
Include dependency graph for cdtext.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MIN_CDTEXT_FIELD   0
 
#define MAX_CDTEXT_FIELDS   10
 

Typedefs

typedef struct cdtext_s cdtext_t
 Opaque type for CD-Text. More...
 

Enumerations

enum  cdtext_field_t {
  CDTEXT_FIELD_TITLE = 0, CDTEXT_FIELD_PERFORMER = 1, CDTEXT_FIELD_SONGWRITER = 2, CDTEXT_FIELD_COMPOSER = 3,
  CDTEXT_FIELD_MESSAGE = 4, CDTEXT_FIELD_ARRANGER = 5, CDTEXT_FIELD_ISRC = 6, CDTEXT_FIELD_UPC_EAN = 7,
  CDTEXT_FIELD_GENRE = 8, CDTEXT_FIELD_DISCID = 9, CDTEXT_FIELD_INVALID = 10
}
 Enumeration of CD-TEXT text fields. More...
 
enum  cdtext_genre_t {
  CDTEXT_GENRE_UNUSED = 0, CDTEXT_GENRE_UNDEFINED = 1, CDTEXT_GENRE_ADULT_CONTEMP = 2, CDTEXT_GENRE_ALT_ROCK = 3,
  CDTEXT_GENRE_CHILDRENS = 4, CDTEXT_GENRE_CLASSIC = 5, CDTEXT_GENRE_CHRIST_CONTEMP = 6, CDTEXT_GENRE_COUNTRY = 7,
  CDTEXT_GENRE_DANCE = 8, CDTEXT_GENRE_EASY_LISTENING = 9, CDTEXT_GENRE_EROTIC = 10, CDTEXT_GENRE_FOLK = 11,
  CDTEXT_GENRE_GOSPEL = 12, CDTEXT_GENRE_HIPHOP = 13, CDTEXT_GENRE_JAZZ = 14, CDTEXT_GENRE_LATIN = 15,
  CDTEXT_GENRE_MUSICAL = 16, CDTEXT_GENRE_NEWAGE = 17, CDTEXT_GENRE_OPERA = 18, CDTEXT_GENRE_OPERETTA = 19,
  CDTEXT_GENRE_POP = 20, CDTEXT_GENRE_RAP = 21, CDTEXT_GENRE_REGGAE = 22, CDTEXT_GENRE_ROCK = 23,
  CDTEXT_GENRE_RYTHMANDBLUES = 24, CDTEXT_GENRE_SOUNDEFFECTS = 25, CDTEXT_GENRE_SOUNDTRACK = 26, CDTEXT_GENRE_SPOKEN_WORD = 27,
  CDTEXT_GENRE_WORLD_MUSIC = 28
}
 Enumeration of possible genre codes. More...
 
enum  cdtext_lang_t {
  CDTEXT_LANGUAGE_UNKNOWN = 0x00, CDTEXT_LANGUAGE_ALBANIAN = 0x01, CDTEXT_LANGUAGE_BRETON = 0x02, CDTEXT_LANGUAGE_CATALAN = 0x03,
  CDTEXT_LANGUAGE_CROATIAN = 0x04, CDTEXT_LANGUAGE_WELSH = 0x05, CDTEXT_LANGUAGE_CZECH = 0x06, CDTEXT_LANGUAGE_DANISH = 0x07,
  CDTEXT_LANGUAGE_GERMAN = 0x08, CDTEXT_LANGUAGE_ENGLISH = 0x09, CDTEXT_LANGUAGE_SPANISH = 0x0A, CDTEXT_LANGUAGE_ESPERANTO = 0x0B,
  CDTEXT_LANGUAGE_ESTONIAN = 0x0C, CDTEXT_LANGUAGE_BASQUE = 0x0D, CDTEXT_LANGUAGE_FAROESE = 0x0E, CDTEXT_LANGUAGE_FRENCH = 0x0F,
  CDTEXT_LANGUAGE_FRISIAN = 0x10, CDTEXT_LANGUAGE_IRISH = 0x11, CDTEXT_LANGUAGE_GAELIC = 0x12, CDTEXT_LANGUAGE_GALICIAN = 0x13,
  CDTEXT_LANGUAGE_ICELANDIC = 0x14, CDTEXT_LANGUAGE_ITALIAN = 0x15, CDTEXT_LANGUAGE_LAPPISH = 0x16, CDTEXT_LANGUAGE_LATIN = 0x17,
  CDTEXT_LANGUAGE_LATVIAN = 0x18, CDTEXT_LANGUAGE_LUXEMBOURGIAN = 0x19, CDTEXT_LANGUAGE_LITHUANIAN = 0x1A, CDTEXT_LANGUAGE_HUNGARIAN = 0x1B,
  CDTEXT_LANGUAGE_MALTESE = 0x1C, CDTEXT_LANGUAGE_DUTCH = 0x1D, CDTEXT_LANGUAGE_NORWEGIAN = 0x1E, CDTEXT_LANGUAGE_OCCITAN = 0x1F,
  CDTEXT_LANGUAGE_POLISH = 0x20, CDTEXT_LANGUAGE_PORTUGUESE = 0x21, CDTEXT_LANGUAGE_ROMANIAN = 0x22, CDTEXT_LANGUAGE_ROMANSH = 0x23,
  CDTEXT_LANGUAGE_SERBIAN = 0x24, CDTEXT_LANGUAGE_SLOVAK = 0x25, CDTEXT_LANGUAGE_SLOVENIAN = 0x26, CDTEXT_LANGUAGE_FINNISH = 0x27,
  CDTEXT_LANGUAGE_SWEDISH = 0x28, CDTEXT_LANGUAGE_TURKISH = 0x29, CDTEXT_LANGUAGE_FLEMISH = 0x2A, CDTEXT_LANGUAGE_WALLON = 0x2B,
  CDTEXT_LANGUAGE_ZULU = 0x45, CDTEXT_LANGUAGE_VIETNAMESE = 0x46, CDTEXT_LANGUAGE_UZBEK = 0x47, CDTEXT_LANGUAGE_URDU = 0x48,
  CDTEXT_LANGUAGE_UKRAINIAN = 0x49, CDTEXT_LANGUAGE_THAI = 0x4A, CDTEXT_LANGUAGE_TELUGU = 0x4B, CDTEXT_LANGUAGE_TATAR = 0x4C,
  CDTEXT_LANGUAGE_TAMIL = 0x4D, CDTEXT_LANGUAGE_TADZHIK = 0x4E, CDTEXT_LANGUAGE_SWAHILI = 0x4F, CDTEXT_LANGUAGE_SRANANTONGO = 0x50,
  CDTEXT_LANGUAGE_SOMALI = 0x51, CDTEXT_LANGUAGE_SINHALESE = 0x52, CDTEXT_LANGUAGE_SHONA = 0x53, CDTEXT_LANGUAGE_SERBO_CROAT = 0x54,
  CDTEXT_LANGUAGE_RUTHENIAN = 0x55, CDTEXT_LANGUAGE_RUSSIAN = 0x56, CDTEXT_LANGUAGE_QUECHUA = 0x57, CDTEXT_LANGUAGE_PUSHTU = 0x58,
  CDTEXT_LANGUAGE_PUNJABI = 0x59, CDTEXT_LANGUAGE_PERSIAN = 0x5A, CDTEXT_LANGUAGE_PAPAMIENTO = 0x5B, CDTEXT_LANGUAGE_ORIYA = 0x5C,
  CDTEXT_LANGUAGE_NEPALI = 0x5D, CDTEXT_LANGUAGE_NDEBELE = 0x5E, CDTEXT_LANGUAGE_MARATHI = 0x5F, CDTEXT_LANGUAGE_MOLDAVIAN = 0x60,
  CDTEXT_LANGUAGE_MALAYSIAN = 0x61, CDTEXT_LANGUAGE_MALAGASAY = 0x62, CDTEXT_LANGUAGE_MACEDONIAN = 0x63, CDTEXT_LANGUAGE_LAOTIAN = 0x64,
  CDTEXT_LANGUAGE_KOREAN = 0x65, CDTEXT_LANGUAGE_KHMER = 0x66, CDTEXT_LANGUAGE_KAZAKH = 0x67, CDTEXT_LANGUAGE_KANNADA = 0x68,
  CDTEXT_LANGUAGE_JAPANESE = 0x69, CDTEXT_LANGUAGE_INDONESIAN = 0x6A, CDTEXT_LANGUAGE_HINDI = 0x6B, CDTEXT_LANGUAGE_HEBREW = 0x6C,
  CDTEXT_LANGUAGE_HAUSA = 0x6D, CDTEXT_LANGUAGE_GURANI = 0x6E, CDTEXT_LANGUAGE_GUJURATI = 0x6F, CDTEXT_LANGUAGE_GREEK = 0x70,
  CDTEXT_LANGUAGE_GEORGIAN = 0x71, CDTEXT_LANGUAGE_FULANI = 0x72, CDTEXT_LANGUAGE_DARI = 0x73, CDTEXT_LANGUAGE_CHURASH = 0x74,
  CDTEXT_LANGUAGE_CHINESE = 0x75, CDTEXT_LANGUAGE_BURMESE = 0x76, CDTEXT_LANGUAGE_BULGARIAN = 0x77, CDTEXT_LANGUAGE_BENGALI = 0x78,
  CDTEXT_LANGUAGE_BIELORUSSIAN = 0x79, CDTEXT_LANGUAGE_BAMBORA = 0x7A, CDTEXT_LANGUAGE_AZERBAIJANI = 0x7B, CDTEXT_LANGUAGE_ASSAMESE = 0x7C,
  CDTEXT_LANGUAGE_ARMENIAN = 0x7D, CDTEXT_LANGUAGE_ARABIC = 0x7E, CDTEXT_LANGUAGE_AMHARIC = 0x7F, CDTEXT_LANGUAGE_INVALID = 0x100,
  CDTEXT_LANGUAGE_BLOCK_UNUSED = 0x101
}
 Enumeration of possible CD-TEXT languages. More...
 

Functions

const char * cdtext_genre2str (cdtext_genre_t i)
 
const char * cdtext_lang2str (cdtext_lang_t i)
 
cdtext_lang_t cdtext_str2lang (const char *lang)
 
const char * cdtext_field2str (cdtext_field_t i)
 
cdtext_tcdtext_init (void)
 
int cdtext_data_init (cdtext_t *p_cdtext, uint8_t *wdata, size_t i_data)
 
void cdtext_destroy (cdtext_t *p_cdtext)
 
char * cdtext_get (const cdtext_t *p_cdtext, cdtext_field_t key, track_t track)
 
const char * cdtext_get_const (const cdtext_t *p_cdtext, cdtext_field_t field, track_t track)
 
cdtext_genre_t cdtext_get_genre (const cdtext_t *p_cdtext)
 
cdtext_lang_t cdtext_get_language (const cdtext_t *p_cdtext)
 
track_t cdtext_get_first_track (const cdtext_t *p_cdtext)
 
track_t cdtext_get_last_track (const cdtext_t *p_cdtext)
 
bool cdtext_select_language (cdtext_t *p_cdtext, cdtext_lang_t language)
 
cdtext_lang_tcdtext_list_languages (const cdtext_t *p_cdtext)
 
cdtext_lang_tcdtext_list_languages_v2 (cdtext_t *p_cdtext)
 
bool cdtext_set_language_index (cdtext_t *p_cdtext, int idx)
 
void cdtext_set (cdtext_t *p_cdtext, cdtext_field_t key, const uint8_t *value, track_t track, const char *charset)
 

Detailed Description

The top-level header for CD-Text information. Applications include this for CD-Text access.

Definition in file cdtext.h.

Macro Definition Documentation

◆ MAX_CDTEXT_FIELDS

#define MAX_CDTEXT_FIELDS   10

Definition at line 38 of file cdtext.h.

◆ MIN_CDTEXT_FIELD

#define MIN_CDTEXT_FIELD   0

Definition at line 37 of file cdtext.h.

Typedef Documentation

◆ cdtext_t

Opaque type for CD-Text.

Definition at line 218 of file cdtext.h.

Enumeration Type Documentation

◆ cdtext_field_t

enum enum cdtext_field_t

Enumeration of CD-TEXT text fields.

Enumerator
CDTEXT_FIELD_TITLE 

title of album name or track titles

CDTEXT_FIELD_PERFORMER 

name(s) of the performer(s)

CDTEXT_FIELD_SONGWRITER 

name(s) of the songwriter(s)

CDTEXT_FIELD_COMPOSER 

name(s) of the composer(s)

CDTEXT_FIELD_MESSAGE 

message(s) from content provider or artist, ISO-8859-1 encoded

CDTEXT_FIELD_ARRANGER 

name(s) of the arranger(s)

CDTEXT_FIELD_ISRC 

ISRC code of each track

CDTEXT_FIELD_UPC_EAN 

upc/european article number of disc, ISO-8859-1 encoded

CDTEXT_FIELD_GENRE 

genre identification and genre information, ASCII encoded

CDTEXT_FIELD_DISCID 

disc identification, ASCII encoded (may be non-printable)

CDTEXT_FIELD_INVALID 

INVALID FIELD

Definition at line 44 of file cdtext.h.

◆ cdtext_genre_t

enum enum cdtext_genre_t

Enumeration of possible genre codes.

Enumerator
CDTEXT_GENRE_UNUSED 

field is not used. default

CDTEXT_GENRE_UNDEFINED 

not defined

CDTEXT_GENRE_ADULT_CONTEMP 

Adult Contemporary

CDTEXT_GENRE_ALT_ROCK 

Alternative Rock

CDTEXT_GENRE_CHILDRENS 

Childrens Music

CDTEXT_GENRE_CLASSIC 

Classical

CDTEXT_GENRE_CHRIST_CONTEMP 

Contemporary Christian

CDTEXT_GENRE_COUNTRY 

Country

CDTEXT_GENRE_DANCE 

Dance

CDTEXT_GENRE_EASY_LISTENING 

Easy Listening

CDTEXT_GENRE_EROTIC 

Erotic

CDTEXT_GENRE_FOLK 

Folk

CDTEXT_GENRE_GOSPEL 

Gospel

CDTEXT_GENRE_HIPHOP 

Hip Hop

CDTEXT_GENRE_JAZZ 

Jazz

CDTEXT_GENRE_LATIN 

Latin

CDTEXT_GENRE_MUSICAL 

Musical

CDTEXT_GENRE_NEWAGE 

New Age

CDTEXT_GENRE_OPERA 

Opera

CDTEXT_GENRE_OPERETTA 

Operetta

CDTEXT_GENRE_POP 

Pop Music

CDTEXT_GENRE_RAP 

RAP

CDTEXT_GENRE_REGGAE 

Reggae

CDTEXT_GENRE_ROCK 

Rock Music

CDTEXT_GENRE_RYTHMANDBLUES 

Rhythm & Blues

CDTEXT_GENRE_SOUNDEFFECTS 

Sound Effects

CDTEXT_GENRE_SOUNDTRACK 

Soundtrack

CDTEXT_GENRE_SPOKEN_WORD 

Spoken Word

CDTEXT_GENRE_WORLD_MUSIC 

World Music

Definition at line 62 of file cdtext.h.

◆ cdtext_lang_t

enum typedef enum cdtext_lang_t

Enumeration of possible CD-TEXT languages.

The language code is encoded as specified in ANNEX 1 to part 5 of EBU Tech 32 58 -E (1991).

Enumerator
CDTEXT_LANGUAGE_UNKNOWN 
CDTEXT_LANGUAGE_ALBANIAN 
CDTEXT_LANGUAGE_BRETON 
CDTEXT_LANGUAGE_CATALAN 
CDTEXT_LANGUAGE_CROATIAN 
CDTEXT_LANGUAGE_WELSH 
CDTEXT_LANGUAGE_CZECH 
CDTEXT_LANGUAGE_DANISH 
CDTEXT_LANGUAGE_GERMAN 
CDTEXT_LANGUAGE_ENGLISH 
CDTEXT_LANGUAGE_SPANISH 
CDTEXT_LANGUAGE_ESPERANTO 
CDTEXT_LANGUAGE_ESTONIAN 
CDTEXT_LANGUAGE_BASQUE 
CDTEXT_LANGUAGE_FAROESE 
CDTEXT_LANGUAGE_FRENCH 
CDTEXT_LANGUAGE_FRISIAN 
CDTEXT_LANGUAGE_IRISH 
CDTEXT_LANGUAGE_GAELIC 
CDTEXT_LANGUAGE_GALICIAN 
CDTEXT_LANGUAGE_ICELANDIC 
CDTEXT_LANGUAGE_ITALIAN 
CDTEXT_LANGUAGE_LAPPISH 
CDTEXT_LANGUAGE_LATIN 
CDTEXT_LANGUAGE_LATVIAN 
CDTEXT_LANGUAGE_LUXEMBOURGIAN 
CDTEXT_LANGUAGE_LITHUANIAN 
CDTEXT_LANGUAGE_HUNGARIAN 
CDTEXT_LANGUAGE_MALTESE 
CDTEXT_LANGUAGE_DUTCH 
CDTEXT_LANGUAGE_NORWEGIAN 
CDTEXT_LANGUAGE_OCCITAN 
CDTEXT_LANGUAGE_POLISH 
CDTEXT_LANGUAGE_PORTUGUESE 
CDTEXT_LANGUAGE_ROMANIAN 
CDTEXT_LANGUAGE_ROMANSH 
CDTEXT_LANGUAGE_SERBIAN 
CDTEXT_LANGUAGE_SLOVAK 
CDTEXT_LANGUAGE_SLOVENIAN 
CDTEXT_LANGUAGE_FINNISH 
CDTEXT_LANGUAGE_SWEDISH 
CDTEXT_LANGUAGE_TURKISH 
CDTEXT_LANGUAGE_FLEMISH 
CDTEXT_LANGUAGE_WALLON 
CDTEXT_LANGUAGE_ZULU 
CDTEXT_LANGUAGE_VIETNAMESE 
CDTEXT_LANGUAGE_UZBEK 
CDTEXT_LANGUAGE_URDU 
CDTEXT_LANGUAGE_UKRAINIAN 
CDTEXT_LANGUAGE_THAI 
CDTEXT_LANGUAGE_TELUGU 
CDTEXT_LANGUAGE_TATAR 
CDTEXT_LANGUAGE_TAMIL 
CDTEXT_LANGUAGE_TADZHIK 
CDTEXT_LANGUAGE_SWAHILI 
CDTEXT_LANGUAGE_SRANANTONGO 
CDTEXT_LANGUAGE_SOMALI 
CDTEXT_LANGUAGE_SINHALESE 
CDTEXT_LANGUAGE_SHONA 
CDTEXT_LANGUAGE_SERBO_CROAT 
CDTEXT_LANGUAGE_RUTHENIAN 
CDTEXT_LANGUAGE_RUSSIAN 
CDTEXT_LANGUAGE_QUECHUA 
CDTEXT_LANGUAGE_PUSHTU 
CDTEXT_LANGUAGE_PUNJABI 
CDTEXT_LANGUAGE_PERSIAN 
CDTEXT_LANGUAGE_PAPAMIENTO 
CDTEXT_LANGUAGE_ORIYA 
CDTEXT_LANGUAGE_NEPALI 
CDTEXT_LANGUAGE_NDEBELE 
CDTEXT_LANGUAGE_MARATHI 
CDTEXT_LANGUAGE_MOLDAVIAN 
CDTEXT_LANGUAGE_MALAYSIAN 
CDTEXT_LANGUAGE_MALAGASAY 
CDTEXT_LANGUAGE_MACEDONIAN 
CDTEXT_LANGUAGE_LAOTIAN 
CDTEXT_LANGUAGE_KOREAN 
CDTEXT_LANGUAGE_KHMER 
CDTEXT_LANGUAGE_KAZAKH 
CDTEXT_LANGUAGE_KANNADA 
CDTEXT_LANGUAGE_JAPANESE 
CDTEXT_LANGUAGE_INDONESIAN 
CDTEXT_LANGUAGE_HINDI 
CDTEXT_LANGUAGE_HEBREW 
CDTEXT_LANGUAGE_HAUSA 
CDTEXT_LANGUAGE_GURANI 
CDTEXT_LANGUAGE_GUJURATI 
CDTEXT_LANGUAGE_GREEK 
CDTEXT_LANGUAGE_GEORGIAN 
CDTEXT_LANGUAGE_FULANI 
CDTEXT_LANGUAGE_DARI 
CDTEXT_LANGUAGE_CHURASH 
CDTEXT_LANGUAGE_CHINESE 
CDTEXT_LANGUAGE_BURMESE 
CDTEXT_LANGUAGE_BULGARIAN 
CDTEXT_LANGUAGE_BENGALI 
CDTEXT_LANGUAGE_BIELORUSSIAN 
CDTEXT_LANGUAGE_BAMBORA 
CDTEXT_LANGUAGE_AZERBAIJANI 
CDTEXT_LANGUAGE_ASSAMESE 
CDTEXT_LANGUAGE_ARMENIAN 
CDTEXT_LANGUAGE_ARABIC 
CDTEXT_LANGUAGE_AMHARIC 
CDTEXT_LANGUAGE_INVALID 

Invalid language code

CDTEXT_LANGUAGE_BLOCK_UNUSED 

Language code should be ignored

Definition at line 101 of file cdtext.h.

Function Documentation

◆ cdtext_data_init()

int cdtext_data_init ( cdtext_t p_cdtext,
uint8_t *  wdata,
size_t  i_data 
)

Fill a cdtext_t object with text pack bytes as they were handed out by the CD drive, but without the 4-byte header which the drive prepended.

The text pack data can be obtained by the calls

Each sets in the buffer passed into values that begin with a 4-byte header. This should be skipped. Here is some sample code:

if (DRIVER_OP_SUCCESS == mmc_read_toc_cdtext (p_cdio, &i_length, p_buf, 0)
&& 4 < i_length)
cdtext_data_init(p_cdtext, p_buf + 4, (size_t) i_length - 4);

Instead of calling cdtext_data_init(), you can call cdio_get_cdtext() which returns a pointer to the cdtext_t object that is attached to the inquired CdIo_t object. This cdtext_t object gets created and filled if none is yet attached to the inquired CdIo_t object.

Parameters
p_cdtextthe CD-TEXT object
wdatathe data
i_datasize of wdata
Returns
0 on success, non-zero on failure

Read a binary CD-TEXT and fill a cdtext struct.

Parameters
p_cdtextthe CD-TEXT object
wdatathe data
i_datasize of wdata
Returns
0 on success, non-zero on failure

Definition at line 601 of file cdtext.c.

References cdtext_pack_s::block, cdtext_s::block, cdtext_s::block_i, buffer, cdio_warn(), CDTEXT_CHARCODE_ASCII, CDTEXT_CHARCODE_ISO_8859_1, CDTEXT_CHARCODE_SHIFT_JIS, CDTEXT_COMPARE_CHAR, CDTEXT_FIELD_ARRANGER, CDTEXT_FIELD_COMPOSER, CDTEXT_FIELD_DISCID, CDTEXT_FIELD_GENRE, CDTEXT_FIELD_ISRC, CDTEXT_FIELD_MESSAGE, CDTEXT_FIELD_PERFORMER, CDTEXT_FIELD_SONGWRITER, CDTEXT_FIELD_TITLE, CDTEXT_FIELD_UPC_EAN, CDTEXT_GENRE_UNUSED, CDTEXT_GET_LEN16, CDTEXT_LANGUAGE_AMHARIC, CDTEXT_LANGUAGE_INVALID, CDTEXT_LANGUAGE_WALLON, CDTEXT_LANGUAGE_ZULU, CDTEXT_LEN_BLOCKSIZE, CDTEXT_LEN_PACK, CDTEXT_LEN_TEXTDATA, CDTEXT_NUM_BLOCKS_MAX, CDTEXT_PACK_ARRANGER, CDTEXT_PACK_BLOCKSIZE, CDTEXT_PACK_COMPOSER, CDTEXT_PACK_DISCID, CDTEXT_PACK_GENRE, CDTEXT_PACK_MESSAGE, CDTEXT_PACK_PERFORMER, CDTEXT_PACK_SONGWRITER, CDTEXT_PACK_TITLE, CDTEXT_PACK_UPC, cdtext_read_pack(), cdtext_set(), cdtext_blocksize_s::charcode, cdtext_blocksize_s::copyright, cdtext_block_s::copyright, cdtext_pack_s::db_chars, cdtext_block_s::first_track, cdtext_block_s::genre_code, i, i_data, cdtext_blocksize_s::i_first_track, cdtext_blocksize_s::i_last_track, cdtext_blocksize_s::i_packs, cdtext_pack_s::i_track, j, cdtext_blocksize_s::langcode, cdtext_block_s::language_code, cdtext_block_s::last_track, cdtext_blocksize_s::lastseq, NULL, cdtext_pack_s::seq, cdtext_pack_s::text, and cdtext_pack_s::type.

Referenced by get_cdtext_generic(), parse_cuefile(), and parse_nrg().

◆ cdtext_destroy()

void cdtext_destroy ( cdtext_t p_cdtext)

Free memory associated with the given cdtext_t object.

Parameters
p_cdtextthe CD-TEXT object

Free memory associated with the given cdtext_t object.

Parameters
p_cdtextthe CD-TEXT object

Definition at line 242 of file cdtext.c.

References cdtext_s::block, CDTEXT_NUM_BLOCKS_MAX, CDTEXT_NUM_TRACKS_MAX, cdtext_track_s::field, i, j, MAX_CDTEXT_FIELDS, NULL, and cdtext_block_s::track.

Referenced by _free_image(), cdio_generic_free(), get_cdtext_generic(), parse_nrg(), and CdioCDText::~CdioCDText().

◆ cdtext_field2str()

const char* cdtext_field2str ( cdtext_field_t  i)

Return string representation of given field type.

Definition at line 203 of file cdtext.c.

References cdtext_field, i, and MAX_CDTEXT_FIELDS.

Referenced by field2str(), and print_cdtext_track_info().

◆ cdtext_genre2str()

const char* cdtext_genre2str ( cdtext_genre_t  i)

Return string representation of the given genre code.

Definition at line 215 of file cdtext.c.

References cdtext_genre, i, and MAX_CDTEXT_GENRE_CODE.

Referenced by genre2str(), and print_cdtext_info().

◆ cdtext_get()

char* cdtext_get ( const cdtext_t p_cdtext,
cdtext_field_t  field,
track_t  track 
)

Returns a copy of the return value of cdtext_get_const or NULL.

Must be freed using cdio_free() when done.

See also
cdtext_get_const

Definition at line 269 of file cdtext.c.

References cdtext_get_const(), and NULL.

Referenced by get().

◆ cdtext_get_const()

const char* cdtext_get_const ( const cdtext_t p_cdtext,
cdtext_field_t  field,
track_t  track 
)

Returns value of the given field.

NULL is returned if key is CDTEXT_INVALID or the field is not set. Strings are encoded in UTF-8.

Parameters
p_cdtextthe CD-TEXT object
fieldtype of the field to return
trackspecifies the track, 0 stands for disc

Definition at line 289 of file cdtext.c.

References cdtext_s::block, cdtext_s::block_i, CDIO_CD_MAX_TRACKS, CDTEXT_FIELD_INVALID, cdtext_track_s::field, NULL, and cdtext_block_s::track.

Referenced by cdtext_get(), getConst(), and print_cdtext_track_info().

◆ cdtext_get_first_track()

track_t cdtext_get_first_track ( const cdtext_t p_cdtext)

Returns the first track number.

Parameters
p_cdtextthe CD-TEXT object

Definition at line 331 of file cdtext.c.

References cdtext_s::block, cdtext_s::block_i, cdtext_block_s::first_track, and NULL.

◆ cdtext_get_genre()

cdtext_genre_t cdtext_get_genre ( const cdtext_t p_cdtext)

Returns the discs genre code.

Parameters
p_cdtextthe CD-TEXT object

Definition at line 305 of file cdtext.c.

References cdtext_s::block, cdtext_s::block_i, CDTEXT_GENRE_UNUSED, cdtext_block_s::genre_code, and NULL.

Referenced by print_cdtext_info().

◆ cdtext_get_language()

cdtext_lang_t cdtext_get_language ( const cdtext_t p_cdtext)

Returns the currently active language.

Parameters
p_cdtextthe CD-TEXT object

Definition at line 318 of file cdtext.c.

References cdtext_s::block, cdtext_s::block_i, CDTEXT_LANGUAGE_BLOCK_UNUSED, cdtext_block_s::language_code, and NULL.

Referenced by getLanguage().

◆ cdtext_get_last_track()

track_t cdtext_get_last_track ( const cdtext_t p_cdtext)

Returns the last track number.

Parameters
p_cdtextthe CD-TEXT object

Definition at line 344 of file cdtext.c.

References cdtext_s::block, cdtext_s::block_i, cdtext_block_s::last_track, and NULL.

◆ cdtext_init()

cdtext_t* cdtext_init ( void  )

Initialize a new cdtext_t structure.

When the structure is no longer needed, release the resources using cdtext_delete.

Initialize a new cdtext structure.

When the structure is no longer needed, release the resources using cdtext_delete.

Definition at line 486 of file cdtext.c.

References cdtext_s::block, cdtext_s::block_i, CDTEXT_GENRE_UNUSED, CDTEXT_LANGUAGE_BLOCK_UNUSED, CDTEXT_NUM_BLOCKS_MAX, CDTEXT_NUM_TRACKS_MAX, cdtext_track_s::field, cdtext_block_s::genre_code, i, j, cdtext_block_s::language_code, MAX_CDTEXT_FIELDS, NULL, and cdtext_block_s::track.

Referenced by CdioCDText::CdioCDText(), get_cdtext_generic(), parse_cuefile(), parse_nrg(), and parse_tocfile().

◆ cdtext_lang2str()

const char* cdtext_lang2str ( cdtext_lang_t  i)

Return string representation of the given language code.

Definition at line 227 of file cdtext.c.

References cdtext_language, CDTEXT_LANGUAGE_AMHARIC, CDTEXT_LANGUAGE_WALLON, CDTEXT_LANGUAGE_ZULU, and i.

Referenced by lang2str(), and print_cdtext_info().

◆ cdtext_list_languages()

cdtext_lang_t* cdtext_list_languages ( const cdtext_t p_cdtext)
Deprecated:
Use cdtext_list_languages_v2()

Returns a list of available languages or NULL.

WARNING: The indices in the returned array do not match the indexing as expected by cdtext_set_language_index(). Use cdtext_select_language() with the values of array elements.

Internally the list is stored in a static array.

Parameters
p_cdtextthe CD-TEXT object
Returns
NULL if p_cdtext is NULL, or an array of 8 cdtext_lang_t elements: CDTEXT_LANGUAGE_UNKNOWN not only marks language code 0x00 but also invalid language codes and invalid language blocks.
Deprecated:
Use cdtext_list_languages_v2()

Returns a list of available languages or NULL.

WARNING: The indices in the returned array do not match the indexing as expected by cdtext_set_language_index(). Use cdtext_select_language with the values of array elements.

Internally the list is stored in a static array.

Parameters
p_cdtextthe CD-TEXT object
Returns
NULL if p_cdtext is NULL. Else an array of 8 cdtext_lang_t elements: CDTEXT_LANGUAGE_UNKNOWN not only marks language code 0x00 but also invalid language codes and invalid language blocks.

Definition at line 369 of file cdtext.c.

References cdtext_s::block, CDTEXT_LANGUAGE_BLOCK_UNUSED, CDTEXT_LANGUAGE_INVALID, CDTEXT_LANGUAGE_UNKNOWN, CDTEXT_NUM_BLOCKS_MAX, i, j, cdtext_block_s::language_code, and NULL.

Referenced by listLanguages().

◆ cdtext_list_languages_v2()

cdtext_lang_t* cdtext_list_languages_v2 ( cdtext_t p_cdtext)

Returns an array of available languages or NULL. The index of an array element may be used to select the corresponding language block by call cdtext_set_language_index().

The return value is a pointer into the memory range of *p_cdtext. Do not use it after having freed that memory range.

Parameters
p_cdtextthe CD-TEXT object
Returns
NULL if p_cdtext is NULL, or an array of 8 cdtext_lang_t elements.

If an enumeration is CDTEXT_LANGUAGE_INVALID, then the language block has an invalid language code.

If an enumeration is CDTEXT_LANGUAGE_BLOCK_UNUSED, then the block does not exist on CD or could not be read in CD-TEXT for some reason.

Otherwise, the enumeration of element will be a value in CDTEXT_LANGUAGE_UNKNOWN to CDTEXT_LANGUAGE_AMHARIC, and is a block in that language.

Definition at line 411 of file cdtext.c.

References cdtext_s::block, CDTEXT_NUM_BLOCKS_MAX, i, cdtext_block_s::language_code, cdtext_s::languages, and NULL.

Referenced by listLanguagesV2(), and print_cdtext_info().

◆ cdtext_select_language()

bool cdtext_select_language ( cdtext_t p_cdtext,
cdtext_lang_t  language 
)

Try to select the given language.

Parameters
p_cdtextthe CD-TEXT object
languagestring representation of the language
Returns
true on success, false if language is not available

Try to select the given language. Select default language if specified is not available or invalid and return false.

Parameters
p_cdtextthe CD-TEXT object
languagelanguage identifier
Returns
true on success, false if language is not available

Definition at line 459 of file cdtext.c.

References cdtext_s::block, cdtext_s::block_i, CDTEXT_LANGUAGE_BLOCK_UNUSED, CDTEXT_NUM_BLOCKS_MAX, i, cdtext_block_s::language_code, and NULL.

Referenced by selectLanguage().

◆ cdtext_set()

void cdtext_set ( cdtext_t p_cdtext,
cdtext_field_t  key,
const uint8_t *  value,
track_t  track,
const char *  charset 
)

Sets the given field at the given track to the given value.

Recodes to UTF-8 if charset is not NULL.

Parameters
p_cdtextthe CD-TEXT object
keyfield to set
valuevalue to set
tracktrack to work on
charsetcharset to convert from

Sets the given field at the given track to the given value.

Recodes to UTF-8 if charset is not NULL.

Parameters
p_cdtextthe CD-TEXT object
keyfield to set
valuevalue to set
tracktrack to work on
charsetcharset to convert from

Definition at line 568 of file cdtext.c.

References cdtext_s::block, cdtext_s::block_i, CDIO_CD_MAX_TRACKS, cdio_charset_to_utf8(), CDTEXT_FIELD_INVALID, cdtext_track_s::field, NULL, and cdtext_block_s::track.

Referenced by cdtext_data_init(), parse_cuefile(), parse_tocfile(), and set().

◆ cdtext_set_language_index()

bool cdtext_set_language_index ( cdtext_t p_cdtext,
int  idx 
)

Select the given language by block index. See cdtext_list_languages_v2(). If the index is bad, or no language block with that index was read: select the default language at index 0 and return false.

Parameters
p_cdtextthe CD-TEXT object
idxthe desired index: 0 to 7.
Returns
true on success, false if no language block is associated to idx.

Select the given language by block index. See cdtext_list_languages_v2(). If the index is bad, or no language block with that index was read: select the default language at index 0 and return false.

Parameters
p_cdtextthe CD-TEXT object
idxthe desired index: 0 to 7.
Returns
true on success, false if no language block is associated to idx

Definition at line 435 of file cdtext.c.

References cdtext_s::block, cdtext_s::block_i, CDTEXT_LANGUAGE_BLOCK_UNUSED, cdtext_block_s::language_code, and NULL.

Referenced by print_cdtext_info(), and setLanguageIndex().

◆ cdtext_str2lang()

cdtext_lang_t cdtext_str2lang ( const char *  lang)

Return the language code of a given language string representation. This is the inverse of cdtext_lang2str().

Parameters
langlanguage to look up
Returns
if lang is among the possible results of cdtext_lang2str(): the cdtext_lang_t which is associated, or CDTEXT_LANGUAGE_INVALID otherwise.

Return the language code of a given language string representation. This is the inverse of cdtext_lang2str().

Parameters
langlanguage to look up
Returns
if lang is among the possible results of cdtext_lang2str(): the cdtext_lang_t which is associated. else: CDTEXT_LANGUAGE_INVALID

Definition at line 542 of file cdtext.c.

References cdtext_language, CDTEXT_LANGUAGE_INVALID, i, and MAX_CDTEXT_LANGUAGE_CODE.

mmc_ll_cmds.h
Wrappers for specific Multimedia Command (MMC) commands e.g., READ DISC, START/STOP UNIT.
cdtext_data_init
int cdtext_data_init(cdtext_t *p_cdtext, uint8_t *wdata, size_t i_data)
Definition: cdtext.c:601
DRIVER_OP_SUCCESS
Definition: device.h:206
mmc_read_toc_cdtext
driver_return_code_t mmc_read_toc_cdtext(const CdIo_t *p_cdio, unsigned int *i_length, unsigned char *p_buf, unsigned int i_timeout_ms)
Definition: mmc_ll_cmds.c:562