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)  

track.h File Reference

The top-level header for track-related libcdio calls. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  track_flags_t
 Structure containing attributes associated with a track. More...
 

Macros

#define CDIO_CD_MIN_TRACK_NO   1
 

Enumerations

enum  track_format_t {
  TRACK_FORMAT_AUDIO, TRACK_FORMAT_CDI, TRACK_FORMAT_XA, TRACK_FORMAT_DATA,
  TRACK_FORMAT_PSX, TRACK_FORMAT_ERROR
}
 
enum  track_flag_t { CDIO_TRACK_FLAG_FALSE, CDIO_TRACK_FLAG_TRUE, CDIO_TRACK_FLAG_ERROR, CDIO_TRACK_FLAG_UNKNOWN }
 
enum  cdio_track_enums {
  CDIO_CDROM_LBA = 0x01, CDIO_CDROM_MSF = 0x02, CDIO_CDROM_DATA_TRACK = 0x04, CDIO_CDROM_CDI_TRACK = 0x10,
  CDIO_CDROM_XA_TRACK = 0x20, CDIO_CD_MAX_TRACKS = 99, CDIO_CDROM_LEADOUT_TRACK = 0xAA, CDIO_INVALID_TRACK = 0xFF
}
 
enum  trackmode_t {
  AUDIO, MODE1, MODE1_RAW, MODE2,
  MODE2_FORM1, MODE2_FORM2, MODE2_FORM_MIX, MODE2_RAW
}
 

Functions

track_t cdio_get_first_track_num (const CdIo_t *p_cdio)
 
track_t cdio_get_last_track_num (const CdIo_t *p_cdio)
 
track_t cdio_get_track (const CdIo_t *p_cdio, lsn_t lsn)
 
int cdio_get_track_channels (const CdIo_t *p_cdio, track_t i_track)
 
track_flag_t cdio_get_track_copy_permit (const CdIo_t *p_cdio, track_t i_track)
 
track_format_t cdio_get_track_format (const CdIo_t *p_cdio, track_t i_track)
 
bool cdio_get_track_green (const CdIo_t *p_cdio, track_t i_track)
 
lsn_t cdio_get_track_last_lsn (const CdIo_t *p_cdio, track_t i_track)
 
lba_t cdio_get_track_lba (const CdIo_t *p_cdio, track_t i_track)
 
lsn_t cdio_get_track_lsn (const CdIo_t *p_cdio, track_t i_track)
 
lba_t cdio_get_track_pregap_lba (const CdIo_t *p_cdio, track_t i_track)
 
lsn_t cdio_get_track_pregap_lsn (const CdIo_t *p_cdio, track_t i_track)
 
char * cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track)
 
bool cdio_get_track_msf (const CdIo_t *p_cdio, track_t i_track, msf_t *msf)
 
track_flag_t cdio_get_track_preemphasis (const CdIo_t *p_cdio, track_t i_track)
 
unsigned int cdio_get_track_sec_count (const CdIo_t *p_cdio, track_t i_track)
 

Variables

const char * track_format2str [6]
 
enum cdio_track_enums cdio_track_enums
 

Detailed Description

The top-level header for track-related libcdio calls.

Definition in file track.h.

Macro Definition Documentation

◆ CDIO_CD_MIN_TRACK_NO

#define CDIO_CD_MIN_TRACK_NO   1

Smallest CD track number

Definition at line 83 of file track.h.

Enumeration Type Documentation

◆ cdio_track_enums

The leadout track is always 0xAA, regardless of # of tracks on disc, or what value may be used internally. For example although OS X uses a different value for the lead-out track internally than given below, programmers should use CDIO_CDROM_LEADOUT_TRACK and not worry about this.

An enumeration for some of the CDIO_CDROM_* #defines below. This isn't really an enumeration one would really use in a program; it is to be helpful in debuggers where wants just to refer to the CDIO_CDROM_* names and get something.

Enumerator
CDIO_CDROM_LBA 

"logical block": first frame is #0

CDIO_CDROM_MSF 

"minute-second-frame": binary, not BCD here!

CDIO_CDROM_DATA_TRACK 
CDIO_CDROM_CDI_TRACK 
CDIO_CDROM_XA_TRACK 
CDIO_CD_MAX_TRACKS 

Largest CD track number

CDIO_CDROM_LEADOUT_TRACK 

Lead-out track number

CDIO_INVALID_TRACK 

Constant for invalid track number

Definition at line 70 of file track.h.

◆ track_flag_t

Enumerator
CDIO_TRACK_FLAG_FALSE 
CDIO_TRACK_FLAG_TRUE 
CDIO_TRACK_FLAG_ERROR 
CDIO_TRACK_FLAG_UNKNOWN 

Definition at line 42 of file track.h.

◆ track_format_t

Enumerator
TRACK_FORMAT_AUDIO 

Audio track, e.g. CD-DA

TRACK_FORMAT_CDI 

CD-i. How this is different from DATA below?

TRACK_FORMAT_XA 

Mode2 of some sort

TRACK_FORMAT_DATA 

Mode1 of some sort

TRACK_FORMAT_PSX 

Playstation CD. Like audio but only 2336 bytes of user data.

TRACK_FORMAT_ERROR 

Dunno what is, or some other error.

Definition at line 31 of file track.h.

◆ trackmode_t

track modes (Table 350) reference: MMC-3 draft revsion - 10g

Enumerator
AUDIO 

2352 byte block length

MODE1 

2048 byte block length

MODE1_RAW 

2352 byte block length

MODE2 

2336 byte block length

MODE2_FORM1 

2048 byte block length

MODE2_FORM2 

2324 byte block length

MODE2_FORM_MIX 

2336 byte block length

MODE2_RAW 

2352 byte block length

Definition at line 88 of file track.h.

Function Documentation

◆ cdio_get_first_track_num()

track_t cdio_get_first_track_num ( const CdIo_t p_cdio)

Get the number of the first track.

Returns
the track number or CDIO_INVALID_TRACK on error.

Return the number of the first track. CDIO_INVALID_TRACK is returned on error.

Definition at line 47 of file track.c.

References cdio_info(), CDIO_INVALID_TRACK, _CdIo::env, cdio_funcs_t::get_first_track_num, NULL, and _CdIo::op.

Referenced by cdio_get_devices_with_cap_ret(), cdio_get_last_track_num(), cdio_get_track(), getFirstTrack(), getFirstTrackNum(), main(), and read_toc().

◆ cdio_get_last_track_num()

track_t cdio_get_last_track_num ( const CdIo_t p_cdio)

Return the last track number. CDIO_INVALID_TRACK is returned on error.

Definition at line 67 of file track.c.

References cdio_get_first_track_num(), cdio_get_num_tracks(), cdio_info(), CDIO_INVALID_TRACK, and NULL.

Referenced by cdio_get_track(), cdio_get_track_channels(), cdio_get_track_isrc(), getLastTrack(), getLastTrackNum(), and read_toc().

◆ cdio_get_track()

track_t cdio_get_track ( const CdIo_t p_cdio,
lsn_t  lsn 
)

Find the track which contains lsn. CDIO_INVALID_TRACK is returned if the lsn outside of the CD or if there was some error.

If the lsn is before the pregap of the first track 0 is returned. Otherwise we return the track that spans the lsn.

Find the track which contans lsn. CDIO_INVALID_TRACK is returned if the lsn outside of the CD or if there was some error.

If the lsn is before the pregap of the first track 0 is returned. Otherwise we return the track that spans the lsn.

Definition at line 175 of file track.c.

References CDIO_CDROM_LEADOUT_TRACK, cdio_get_first_track_num(), cdio_get_last_track_num(), cdio_get_track_lsn(), and CDIO_INVALID_TRACK.

Referenced by getTrackFromLsn(), and read_data_sectors_image().

◆ cdio_get_track_channels()

int cdio_get_track_channels ( const CdIo_t p_cdio,
track_t  u_track 
)

Return number of channels in track: 2 or 4; -2 if not implemented or -1 for error. Not meaningful if track is not an audio track.

Definition at line 90 of file track.c.

References cdio_get_last_track_num(), cdio_info(), cdio_log(), CDIO_LOG_WARN, _CdIo::env, cdio_funcs_t::get_track_channels, NULL, and _CdIo::op.

Referenced by getChannels(), and main().

◆ cdio_get_track_copy_permit()

track_flag_t cdio_get_track_copy_permit ( const CdIo_t p_cdio,
track_t  u_track 
)

Return copy protection status on a track. Is this meaningful if not an audio track?

Definition at line 114 of file track.c.

References CDIO_TRACK_FLAG_UNKNOWN, _CdIo::env, cdio_funcs_t::get_track_copy_permit, and _CdIo::op.

Referenced by getCopyPermit(), and main().

◆ cdio_get_track_format()

track_format_t cdio_get_track_format ( const CdIo_t p_cdio,
track_t  u_track 
)

Get the format (audio, mode2, mode1) of track.

Get format of track.

Definition at line 127 of file track.c.

References _CdIo::env, cdio_funcs_t::get_track_format, _CdIo::op, and TRACK_FORMAT_ERROR.

Referenced by cdio_guess_cd_type(), getFormat(), main(), read_data_sectors_image(), and read_toc().

◆ cdio_get_track_green()

bool cdio_get_track_green ( const CdIo_t p_cdio,
track_t  u_track 
)

Return true if we have XA data (green, mode2 form1) or XA data (green, mode2 form2). That is track begins: sync - header - subheader 12 4 - 8

FIXME: there's gotta be a better design for this and get_track_format?

Definition at line 220 of file track.c.

References _CdIo::env, cdio_funcs_t::get_track_green, NULL, and _CdIo::op.

Referenced by getGreen(), and main().

◆ cdio_get_track_isrc()

char* cdio_get_track_isrc ( const CdIo_t p_cdio,
track_t  u_track 
)

Get the International Standard Recording Code (ISRC) for track number i_track in p_cdio. Track numbers usually start at something greater than 0, usually 1.

Returns
the International Standard Recording Code (ISRC) or NULL if there is none or we don't have the ability to get it.

Note: The caller must free the returned string with cdio_free() when done with it.

Return the International Standard Recording Code (ISRC) for track number u_track in p_cdio. Track numbers start at 1.

Note: The caller must free the returned string with cdio_free() when done with it.

Definition at line 301 of file track.c.

References cdio_get_last_track_num(), cdio_info(), cdio_log(), CDIO_LOG_WARN, _CdIo::env, cdio_funcs_t::get_track_isrc, NULL, and _CdIo::op.

Referenced by main().

◆ cdio_get_track_last_lsn()

lsn_t cdio_get_track_last_lsn ( const CdIo_t p_cdio,
track_t  u_track 
)

Return the ending LSN for track number i_track in cdio. CDIO_INVALID_LSN is returned on error.

Return the ending LSN for track number u_track in cdio. CDIO_INVALID_LSN is returned on error.

Definition at line 359 of file track.c.

References cdio_get_track_lsn(), and CDIO_INVALID_LSN.

Referenced by getLastLsn().

◆ cdio_get_track_lba()

lba_t cdio_get_track_lba ( const CdIo_t p_cdio,
track_t  u_track 
)

Get the starting LBA for track number i_track in p_cdio. Track numbers usually start at something greater than 0, usually 1.

The "leadout" track is specified either by using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1.

Parameters
p_cdioobject to get information from
i_trackthe track number we want the LSN for
Returns
the starting LBA or CDIO_INVALID_LBA on error.

Return the starting LBA for track number track_num in cdio. Tracks numbers start at 1. The "leadout" track is specified either by using track_num LEADOUT_TRACK or the total tracks+1. CDIO_INVALID_LBA is returned on error.

Definition at line 241 of file track.c.

References cdio_get_track_msf(), cdio_info(), CDIO_INVALID_LBA, cdio_msf_to_lba(), _CdIo::env, cdio_funcs_t::get_track_lba, cdio_funcs_t::get_track_msf, NULL, and _CdIo::op.

Referenced by cdio_get_track_sec_count(), and getLba().

◆ cdio_get_track_lsn()

lsn_t cdio_get_track_lsn ( const CdIo_t p_cdio,
track_t  u_track 
)

Return the starting LSN for track number i_track in p_cdio. Track numbers usually start at something greater than 0, usually 1.

The "leadout" track is specified either by using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1.

Parameters
p_cdioobject to get information from
i_trackthe track number we want the LSN for
Returns
the starting LSN or CDIO_INVALID_LSN on error.

Return the starting LSN for track number u_track in cdio. Tracks numbers start at 1. The "leadout" track is specified either by using u_track LEADOUT_TRACK or the total tracks+1. CDIO_INVALID_LSN is returned on error.

Definition at line 267 of file track.c.

References cdio_get_track_msf(), cdio_info(), CDIO_INVALID_LSN, cdio_lba_to_lsn(), cdio_msf_to_lsn(), _CdIo::env, cdio_funcs_t::get_track_lba, NULL, and _CdIo::op.

Referenced by cdio_get_track(), cdio_get_track_last_lsn(), getLsn(), and main().

◆ cdio_get_track_msf()

bool cdio_get_track_msf ( const CdIo_t p_cdio,
track_t  u_track,
msf_t msf 
)

Return the starting MSF (minutes/secs/frames) for track number i_track in p_cdio. Track numbers usually start at something greater than 0, usually 1.

The "leadout" track is specified either by using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1.

Returns
true if things worked or false if there is no track entry.

Return the starting MSF (minutes/secs/frames) for track number u_track in cdio. Track numbers start at 1. The "leadout" track is specified either by using u_track LEADOUT_TRACK or the total tracks+1. False is returned if there is no track entry.

Definition at line 376 of file track.c.

References CDIO_INVALID_LBA, cdio_lba_to_msf(), _CdIo::env, cdio_funcs_t::get_track_lba, cdio_funcs_t::get_track_msf, and _CdIo::op.

Referenced by cddb_discid(), cdio_get_track_lba(), cdio_get_track_lsn(), getMsf(), main(), and read_toc().

◆ cdio_get_track_preemphasis()

track_flag_t cdio_get_track_preemphasis ( const CdIo_t p_cdio,
track_t  i_track 
)

Get linear preemphasis status on an audio track This is not meaningful if not an audio track?

Referenced by getPreemphasis(), and main().

◆ cdio_get_track_pregap_lba()

lba_t cdio_get_track_pregap_lba ( const CdIo_t p_cdio,
track_t  u_track 
)

Return the starting LBA for the pregap for track number i_track in p_cdio. Track numbers usually start at something greater than 0, usually 1.

Parameters
p_cdioobject to get information from
i_trackthe track number we want the LBA for
Returns
the starting LBA or CDIO_INVALID_LBA on error.

Return the starting LBA for the pregap for track number u_track in cdio. Track numbers start at 1. CDIO_INVALID_LBA is returned on error.

Definition at line 329 of file track.c.

References cdio_info(), CDIO_INVALID_LBA, _CdIo::env, cdio_funcs_t::get_track_pregap_lba, NULL, and _CdIo::op.

Referenced by cdio_get_track_pregap_lsn().

◆ cdio_get_track_pregap_lsn()

lsn_t cdio_get_track_pregap_lsn ( const CdIo_t p_cdio,
track_t  u_track 
)

Return the starting LSN for the pregap for track number i_track in p_cdio. Track numbers usually start at something greater than 0, usually 1.

Parameters
p_cdioobject to get information from
i_trackthe track number we want the LSN for
Returns
the starting LSN or CDIO_INVALID_LSN on error.

Return the starting LSN for the pregap for track number u_track in cdio. Track numbers start at 1. CDIO_INVALID_LSN is returned on error.

Definition at line 349 of file track.c.

References cdio_get_track_pregap_lba(), and cdio_lba_to_lsn().

◆ cdio_get_track_sec_count()

unsigned int cdio_get_track_sec_count ( const CdIo_t p_cdio,
track_t  u_track 
)

Get the number of sectors between this track an the next. This includes any pregap sectors before the start of the next track. Track numbers usually start at something greater than 0, usually 1.

Returns
the number of sectors or 0 if there is an error.

Return the number of sectors between this track an the next. This includes any pregap sectors before the start of the next track. Tracks start at 1. 0 is returned if there is an error.

Definition at line 412 of file track.c.

References cdio_get_num_tracks(), and cdio_get_track_lba().

Referenced by _cdio_read_block(), and getSecCount().

Variable Documentation

◆ cdio_track_enums

◆ track_format2str

const char* track_format2str[6]

Printable tags for track_format_t enumeration.

Track-related routines.

Definition at line 34 of file track.c.

Referenced by main().