discid.h File Reference

Go to the source code of this file.

Typedefs

typedef void * DiscId
 A transparent handle for an Audio CD.

Functions

DiscIddiscid_new ()
 Return a handle for a new DiscId object.
void discid_free (DiscId *d)
 Release the memory allocated for the DiscId object.
int discid_read (DiscId *d, const char *device)
 Read the disc in the given CD-ROM/DVD-ROM drive.
int discid_put (DiscId *d, int first, int last, int *offsets)
 Provides the TOC of a known CD.
char * discid_get_error_msg (DiscId *d)
 Return a human-readable error message.
char * discid_get_id (DiscId *d)
 Return a MusicBrainz DiscID.
char * discid_get_freedb_id (DiscId *d)
 Return a FreeDB DiscID.
char * discid_get_submission_url (DiscId *d)
 Return an URL for submitting the DiscID to MusicBrainz.
char * discid_get_default_device (void)
 Return the name of the default disc drive for this operating system.
int discid_get_first_track_num (DiscId *d)
 Return the number of the first track on this disc.
int discid_get_last_track_num (DiscId *d)
 Return the number of the last track on this disc.
int discid_get_sectors (DiscId *d)
 Return the length of the disc in sectors.
int discid_get_track_offset (DiscId *d, int track_num)
 Return the sector offset of a track.
int discid_get_track_length (DiscId *d, int track_num)
 Return the length of a track in sectors.


Typedef Documentation

typedef void* DiscId
 

A transparent handle for an Audio CD.

This is returned by discid_new() and has to be passed as the first parameter to all discid_*() functions.


Function Documentation

void discid_free DiscId d  ) 
 

Release the memory allocated for the DiscId object.

Parameters:
d a DiscId object created by discid_new()

char* discid_get_default_device void   ) 
 

Return the name of the default disc drive for this operating system.

Returns:
a string containing an operating system dependent device identifier

char* discid_get_error_msg DiscId d  ) 
 

Return a human-readable error message.

This function may only be used if discid_read() failed. The returned error message is only valid as long as the DiscId object exists.

Parameters:
d a DiscId object created by discid_new()
Returns:
a string describing the error that occurred

int discid_get_first_track_num DiscId d  ) 
 

Return the number of the first track on this disc.

Parameters:
d a DiscId object created by discid_new()
Returns:
the number of the first track

char* discid_get_freedb_id DiscId d  ) 
 

Return a FreeDB DiscID.

The returned string is only valid as long as the DiscId object exists.

Parameters:
d a DiscId object created by discid_new()
Returns:
a string containing a FreeDB DiscID

char* discid_get_id DiscId d  ) 
 

Return a MusicBrainz DiscID.

The returned string is only valid as long as the DiscId object exists.

Parameters:
d a DiscId object created by discid_new()
Returns:
a string containing a MusicBrainz DiscID

int discid_get_last_track_num DiscId d  ) 
 

Return the number of the last track on this disc.

Parameters:
d a DiscId object created by discid_new()
Returns:
the number of the last track

int discid_get_sectors DiscId d  ) 
 

Return the length of the disc in sectors.

Parameters:
d a DiscId object created by discid_new()
Returns:
the length of the disc in sectors

char* discid_get_submission_url DiscId d  ) 
 

Return an URL for submitting the DiscID to MusicBrainz.

The URL leads to an interactive disc submission wizard that guides the user through the process of associating this disc's DiscID with a release in the MusicBrainz database.

The returned string is only valid as long as the DiscId object exists.

Parameters:
d a DiscId object created by discid_new()
Returns:
a string containing an URL

int discid_get_track_length DiscId d,
int  track_num
 

Return the length of a track in sectors.

Only track numbers between (and including) discid_get_first_track_num() and discid_get_last_track_num() may be used.

Parameters:
d a DiscId object created by discid_new()
track_num the number of a track
Returns:
length of the specified track

int discid_get_track_offset DiscId d,
int  track_num
 

Return the sector offset of a track.

Only track numbers between (and including) discid_get_first_track_num() and discid_get_last_track_num() may be used.

Parameters:
d a DiscId object created by discid_new()
track_num the number of a track
Returns:
sector offset of the specified track

DiscId* discid_new  ) 
 

Return a handle for a new DiscId object.

If no memory could be allocated, NULL is returned. Don't use the created DiscId object before calling discid_read().

Returns:
a DiscId object, or NULL.

int discid_put DiscId d,
int  first,
int  last,
int *  offsets
 

Provides the TOC of a known CD.

This function may be used if the TOC has been read earlier and you want to calculate the disc ID afterwards, without accessing the disc drive. It replaces the discid_read function in this case.

On error, this function returns false and sets the error message which you can access using discid_get_error_msg(). In this case, the other functions won't return meaningful values and should not be used.

The offsets parameter points to an array which contains the track offsets for each track. The first element, offsets[0], is the leadout track. It must contain the total numbers of sectors on the disc.

Parameters:
d a DiscID object created by discid_new()
first the number of the first audio track on disc (usually one)
last the number of the last audio track on the disc
offsets a pointer to an array of 100 track offsets
Returns:
true if the given data was valid, and false on error

int discid_read DiscId d,
const char *  device
 

Read the disc in the given CD-ROM/DVD-ROM drive.

This function reads the disc in the drive specified by the given device identifier. If the device is NULL, the default drive, as returned by discid_get_default_device() is used.

On error, this function returns false and sets the error message which you can access using discid_get_error_msg(). In this case, the other functions won't return meaningful values and should not be used.

This function may be used multiple times with the same DiscId object.

Parameters:
d a DiscId object created by discid_new()
device an operating system dependent device identifier, or NULL
Returns:
true if successful, or false on error.


Generated on Sat Jul 22 18:31:35 2006 for libdiscid by  doxygen 1.4.6-NO