libdiscid  0.6.4
libdiscid

Introduction

Libdiscid is a C library for calculating DiscIDs (MusicBrainz and freedb) for Audio CDs. Additionally the library can extract the MCN/UPC/EAN and the ISRCs from disc.

The idea is to have an easy to use library without any dependencies that can be used from scripting languages.

The API is documented in discid.h.

Examples

This is an example of the most basic usage:

DiscId *disc = discid_new();
if ( discid_read_sparse(disc, "/dev/cdrom", 0) == 0 ) {
fprintf(stderr, "Error: %s\n", discid_get_error_msg(disc));
return 1;
}
printf("DiscID : %s\n", discid_get_id(disc));
printf("Submit via : %s\n", discid_get_submission_url(disc));
LIBDISCID_API DiscId * discid_new()
Return a handle for a new DiscId object.
LIBDISCID_API char * discid_get_id(DiscId *d)
Return a MusicBrainz DiscID.
LIBDISCID_API char * discid_get_submission_url(DiscId *d)
Return an URL for submitting the DiscID to MusicBrainz.
void * DiscId
A transparent handle for an Audio CD.
Definition: discid.h:122
LIBDISCID_API char * discid_get_error_msg(DiscId *d)
Return a human-readable error message.
LIBDISCID_API int discid_read_sparse(DiscId *d, const char *device, unsigned int features)
Read the disc in the given CD-ROM/DVD-ROM drive extracting only the TOC and additionally specified fe...
LIBDISCID_API void discid_free(DiscId *d)
Release the memory allocated for the DiscId object.

Building

libdiscid provides a pkg-config script that returns the necessary compiler and linker flags, as well as the version number. To build a small sample program one would use:

gcc libdiscid-test.c `pkg-config libdiscid --cflags --libs` -o libdiscid-test

Contact