2
$Id: tracks.cpp,v 1.1 2005/11/10 11:11:15 rocky Exp $
4
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
/* Simple program to list track numbers and logical sector numbers of
22
a Compact Disc using libcdio. */
27
#ifdef HAVE_SYS_TYPES_H
28
#include <sys/types.h>
30
#include <cdio++/cdio.hpp>
32
main(int argc, const char *argv[])
35
track_t i_first_track;
40
if (!device.open (NULL)) {
41
printf("Couldn't find a driver.. leaving.\n");
45
i_tracks = device.getNumTracks();
46
i_first_track = i = device.getFirstTrackNum();
48
printf("CD-ROM Track List (%i - %i)\n", i_first_track, i_tracks);
52
for (j = 0; j < i_tracks; i++, j++) {
53
track = device.getTrackFromNum(i);
54
lsn_t lsn = track->getLsn();
55
if (CDIO_INVALID_LSN != lsn)
56
printf("%3d: %06lu\n", (int) i, (long unsigned int) lsn);
60
track = device.getTrackFromNum(CDIO_CDROM_LEADOUT_TRACK);
61
printf("%3X: %06lu leadout\n", CDIO_CDROM_LEADOUT_TRACK,
62
(long unsigned int) track->getLsn());