Add ISRC track info to cd-info output. Code from Scot C. Bontrager.

This commit is contained in:
rocky
2011-05-18 09:48:03 -04:00
parent 46876a2040
commit f2438edcbc
6 changed files with 263 additions and 257 deletions

2
THANKS
View File

@@ -78,5 +78,5 @@ Robert William Fuller
Scot C. Bontrager Scot C. Bontrager
mmc routine to get the ISRC information on a CD that is in the q subchannel mmc routine to get the ISRC information on a CD that is in the q subchannel
but not showing up in the CDTEXT. but not showing up in the CDTEXT. Addition of this information to cd-info.

View File

@@ -1,6 +1,4 @@
/* -*- c -*- /* -*- c -*-
$Id: audio.h,v 1.12 2008/03/25 15:59:08 karl Exp $
Copyright (C) 2005, 2007, 2008 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2005, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify

View File

@@ -272,6 +272,7 @@ typedef uint8_t ubyte;
/*! /*!
Number of ASCII bytes in a media catalog number (MCN). Number of ASCII bytes in a media catalog number (MCN).
We include an extra 0 byte so these can be used as C strings.
*/ */
#define CDIO_MCN_SIZE 13 #define CDIO_MCN_SIZE 13
@@ -288,7 +289,7 @@ typedef uint8_t ubyte;
#define CDIO_ISRC_SIZE 12 #define CDIO_ISRC_SIZE 12
/*! /*!
Type to hold ASCII bytes in a media catalog number (MCN). Type to hold ASCII bytes in a ISRC.
We include an extra 0 byte so these can be used as C strings. We include an extra 0 byte so these can be used as C strings.
*/ */
typedef char cdio_isrc_t[CDIO_ISRC_SIZE+1]; typedef char cdio_isrc_t[CDIO_ISRC_SIZE+1];

View File

@@ -1,6 +1,4 @@
/* /*
$Id: udf_file.h,v 1.12 2008/03/25 15:59:09 karl Exp $
Copyright (C) 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify

View File

@@ -505,7 +505,7 @@ mmc_isrc_track_read_subchannel (CdIo_t *p_cdio, /*in*/ const track_t track,
i_rc = mmc_run_cmd(p_cdio, mmc_timeout_ms, &cdb, SCSI_MMC_DATA_READ, i_rc = mmc_run_cmd(p_cdio, mmc_timeout_ms, &cdb, SCSI_MMC_DATA_READ,
sizeof(buf), buf); sizeof(buf), buf);
if (DRIVER_OP_SUCCESS == i_rc) { if (DRIVER_OP_SUCCESS == i_rc) {
strncpy(p_isrc, &buf[9], sizeof(buf)-9); strncpy(p_isrc, &buf[9], CDIO_ISRC_SIZE+1);
} }
return i_rc; return i_rc;
} }

View File

@@ -1,7 +1,6 @@
/* /*
$Id: cd-info.c,v 1.156 2008/09/09 14:44:25 rocky Exp $ Copyright (C) 2003, 2004, 2005, 2007, 2008, 2011
Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2003, 2004, 2005, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org> Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
and Heiko Ei<45>feldt <heiko@hexco.de> and Heiko Ei<45>feldt <heiko@hexco.de>
@@ -166,7 +165,6 @@ parse_source(int opt)
} }
} }
/* Parse all options. */ /* Parse all options. */
static bool static bool
parse_options (int argc, char *argv[]) parse_options (int argc, char *argv[])
@@ -368,7 +366,6 @@ parse_options (int argc, char *argv[])
return true; return true;
} }
/* CDIO logging routines */ /* CDIO logging routines */
#ifdef HAVE_CDDB #ifdef HAVE_CDDB
@@ -433,7 +430,7 @@ print_cdtext_info(CdIo_t *p_cdio, track_t i_tracks, track_t i_first_track) {
print_cdtext_track_info(p_cdio, 0, "\nCD-TEXT for Disc:"); print_cdtext_track_info(p_cdio, 0, "\nCD-TEXT for Disc:");
for ( ; i_first_track < i_last_track; i_first_track++ ) { for ( ; i_first_track < i_last_track; i_first_track++ ) {
char msg[50]; char msg[50];
sprintf(msg, "CD-TEXT for Track %d:", i_first_track); sprintf(msg, "CD-TEXT for Track %2d:", i_first_track);
print_cdtext_track_info(p_cdio, i_first_track, msg); print_cdtext_track_info(p_cdio, i_first_track, msg);
} }
} }
@@ -829,6 +826,7 @@ main(int argc, char *argv[])
cdio_drive_read_cap_t i_read_cap = 0; cdio_drive_read_cap_t i_read_cap = 0;
cdio_drive_write_cap_t i_write_cap; cdio_drive_write_cap_t i_write_cap;
cdio_drive_misc_cap_t i_misc_cap; cdio_drive_misc_cap_t i_misc_cap;
cdio_isrc_t isrc;
memset(&cdio_iso_analysis, 0, sizeof(cdio_iso_analysis)); memset(&cdio_iso_analysis, 0, sizeof(cdio_iso_analysis));
init(); init();
@@ -1098,6 +1096,17 @@ main(int argc, char *argv[])
free(media_catalog_number); free(media_catalog_number);
} }
if (i_read_cap & CDIO_DRIVE_CAP_READ_ISRC) {
driver_return_code_t status;
for (i = 1; i <= i_tracks; i++) {
bzero(&isrc, sizeof(isrc));
status = mmc_isrc_track_read_subchannel (p_cdio, i, isrc);
if (status == DRIVER_OP_SUCCESS && isrc[0] != '\0') {
report(stdout, "TRACK %2d ISRC: %s\n", i, isrc); fflush(stdout);
}
}
}
/* List number of sessions */ /* List number of sessions */
{ {
lsn_t i_last_session; lsn_t i_last_session;