Add cdtext display to cd-info and adjust regression tests accordingly.
cd-read.c: don't try to print null strings.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: cdtext.h,v 1.4 2004/07/11 14:25:07 rocky Exp $
|
||||
$Id: cdtext.h,v 1.5 2004/07/16 21:29:24 rocky Exp $
|
||||
|
||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||
adapted from cuetools
|
||||
@@ -41,23 +41,25 @@ extern "C" {
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
CDTEXT_ARRANGER = 0,
|
||||
CDTEXT_COMPOSER = 1,
|
||||
CDTEXT_DISCID = 2,
|
||||
CDTEXT_GENRE = 3,
|
||||
CDTEXT_MESSAGE = 4,
|
||||
CDTEXT_ISRC = 5,
|
||||
CDTEXT_PERFORMER = 6,
|
||||
CDTEXT_SIZE_INFO = 7,
|
||||
CDTEXT_SONGWRITER = 8,
|
||||
CDTEXT_TITLE = 9,
|
||||
CDTEXT_TOC_INFO = 10,
|
||||
CDTEXT_TOC_INFO2 = 10,
|
||||
CDTEXT_ARRANGER = 0, /**< name(s) of the arranger(s) */
|
||||
CDTEXT_COMPOSER = 1, /**< name(s) of the composer(s) */
|
||||
CDTEXT_DISCID = 2, /**< disc identification information */
|
||||
CDTEXT_GENRE = 3, /**< genre identification and genre information */
|
||||
CDTEXT_MESSAGE = 4, /**< ISRC code of each track */
|
||||
CDTEXT_ISRC = 5, /**< message(s) from the content provider or artist */
|
||||
CDTEXT_PERFORMER = 6, /**< name(s) of the performer(s) */
|
||||
CDTEXT_SIZE_INFO = 7, /**< size information of the block */
|
||||
CDTEXT_SONGWRITER = 8, /**< name(s) of the songwriter(s) */
|
||||
CDTEXT_TITLE = 9, /**< title of album name or track titles */
|
||||
CDTEXT_TOC_INFO = 10, /**< table of contents information */
|
||||
CDTEXT_TOC_INFO2 = 11, /**< second table of contents information */
|
||||
CDTEXT_UPC_EAN = 12,
|
||||
CDTEXT_INVALID = MAX_CDTEXT_FIELDS
|
||||
} cdtext_field_t;
|
||||
|
||||
|
||||
/*! Return string representation of the enum values above */
|
||||
const char *cdtext_field2str (cdtext_field_t i);
|
||||
|
||||
/*! Initialize a new cdtext structure.
|
||||
When the structure is no longer needed, release the
|
||||
resources using cdtext_delete.
|
||||
|
||||
52
lib/cdtext.c
52
lib/cdtext.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: cdtext.c,v 1.4 2004/07/11 14:25:07 rocky Exp $
|
||||
$Id: cdtext.c,v 1.5 2004/07/16 21:29:25 rocky Exp $
|
||||
|
||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||
toc reading routine adapted from cuetools
|
||||
@@ -35,6 +35,37 @@
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
/*! Note: the order and number items (except CDTEXT_INVALID) should
|
||||
match the cdtext_field_t enumeration. */
|
||||
const char *cdtext_keywords[] =
|
||||
{
|
||||
"ARRANGER",
|
||||
"COMPOSER",
|
||||
"DISC_ID",
|
||||
"GENRE",
|
||||
"ISRC",
|
||||
"MESSAGE",
|
||||
"PERFORMER",
|
||||
"SIZE_INFO",
|
||||
"SONGWRITER",
|
||||
"TITLE",
|
||||
"TOC_INFO",
|
||||
"TOC_INFO2",
|
||||
"UPC_EAN",
|
||||
};
|
||||
|
||||
|
||||
/*! Return string representation of the enum values above */
|
||||
const char *
|
||||
cdtext_field2str (cdtext_field_t i)
|
||||
{
|
||||
if (i == 0 || i >= MAX_CDTEXT_FIELDS)
|
||||
return "Invalid CDTEXT field index";
|
||||
else
|
||||
return cdtext_keywords[i];
|
||||
}
|
||||
|
||||
|
||||
/*! Free memory assocated with cdtext*/
|
||||
void
|
||||
cdtext_destroy (cdtext_t *cdtext)
|
||||
@@ -77,25 +108,6 @@ cdtext_init (cdtext_t *cdtext)
|
||||
cdtext_field_t
|
||||
cdtext_is_keyword (const char *key)
|
||||
{
|
||||
/* Note: the order and number items (except CDTEXT_INVALID) should
|
||||
match the cdtext_field_t enumeration. */
|
||||
const char *cdtext_keywords[] =
|
||||
{
|
||||
"ARRANGER", /* name(s) of the arranger(s) */
|
||||
"COMPOSER", /* name(s) of the composer(s) */
|
||||
"DISC_ID", /* disc identification information */
|
||||
"GENRE", /* genre identification and genre information */
|
||||
"ISRC", /* ISRC code of each track */
|
||||
"MESSAGE", /* message(s) from the content provider and/or artist */
|
||||
"PERFORMER", /* name(s) of the performer(s) */
|
||||
"SIZE_INFO", /* size information of the block */
|
||||
"SONGWRITER", /* name(s) of the songwriter(s) */
|
||||
"TITLE", /* title of album name or track titles */
|
||||
"TOC_INFO", /* table of contents information */
|
||||
"TOC_INFO2", /* second table of contents information */
|
||||
"UPC_EAN",
|
||||
};
|
||||
|
||||
#if 0
|
||||
char *item;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: cd-info.c,v 1.70 2004/06/23 09:28:02 rocky Exp $
|
||||
$Id: cd-info.c,v 1.71 2004/07/16 21:29:25 rocky Exp $
|
||||
|
||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <cdio/util.h>
|
||||
#include <cdio/cd_types.h>
|
||||
#include <cdio/cdtext.h>
|
||||
#include <cdio/iso9660.h>
|
||||
|
||||
#include "cdio_assert.h"
|
||||
@@ -380,7 +381,25 @@ _log_handler (cdio_log_level_t level, const char message[])
|
||||
gl_default_cdio_log_handler (level, message);
|
||||
}
|
||||
|
||||
static void
|
||||
print_cdtext_info(CdIo *cdio) {
|
||||
const cdtext_t *cdtext = cdio_get_cdtext(cdio);
|
||||
|
||||
if (NULL != cdtext) {
|
||||
cdtext_field_t i;
|
||||
|
||||
printf("\nCD-TEXT info:\n");
|
||||
|
||||
for (i=0; i < MAX_CDTEXT_FIELDS; i++) {
|
||||
if (cdtext->field[i]) {
|
||||
printf("\t%s: %s\n", cdtext_field2str(i), cdtext->field[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("Didn't get CD-TEXT info.\n");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_CDDB
|
||||
static void
|
||||
print_cddb_info(CdIo *cdio, track_t num_tracks, track_t first_track_num) {
|
||||
@@ -637,6 +656,7 @@ print_analysis(int ms_offset, cdio_iso_analysis_t cdio_iso_analysis,
|
||||
#ifdef HAVE_CDDB
|
||||
if (!opts.no_cddb) print_cddb_info(p_cdio, num_tracks, first_track_num);
|
||||
#endif
|
||||
print_cdtext_info(p_cdio);
|
||||
}
|
||||
break;
|
||||
case CDIO_FS_ISO_9660:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: cd-read.c,v 1.19 2004/05/31 14:52:04 rocky Exp $
|
||||
$Id: cd-read.c,v 1.20 2004/07/16 21:29:35 rocky Exp $
|
||||
|
||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -484,7 +484,7 @@ main(int argc, const char *argv[])
|
||||
cdio = cdio_open (source_name, DRIVER_DEVICE);
|
||||
if (cdio==NULL) {
|
||||
err_exit("Error in automatically selecting device with input %s\n",
|
||||
source_name);
|
||||
source_name ? source_name : "(null)");
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -492,21 +492,21 @@ main(int argc, const char *argv[])
|
||||
cdio = cdio_open (source_name, DRIVER_BINCUE);
|
||||
if (cdio==NULL) {
|
||||
err_exit("Error in opening bin/cue file %s\n",
|
||||
source_name);
|
||||
source_name ? source_name : "(null)");
|
||||
}
|
||||
break;
|
||||
case IMAGE_CUE:
|
||||
cdio = cdio_open_cue(source_name);
|
||||
if (cdio==NULL) {
|
||||
err_exit("Error in opening cue/bin file %s with input\n",
|
||||
source_name);
|
||||
source_name ? source_name : "(null)");
|
||||
}
|
||||
break;
|
||||
case IMAGE_NRG:
|
||||
cdio = cdio_open (source_name, DRIVER_NRG);
|
||||
if (cdio==NULL) {
|
||||
err_exit("Error in opening NRG file %s for input\n",
|
||||
source_name);
|
||||
source_name ? source_name : "(null)");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -514,7 +514,7 @@ main(int argc, const char *argv[])
|
||||
cdio = cdio_open (source_name, DRIVER_CDRDAO);
|
||||
if (cdio==NULL) {
|
||||
err_exit("Error in opening TOC file %s for input\n",
|
||||
source_name);
|
||||
source_name ? source_name : "(null)");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -30,3 +30,5 @@ Media Catalog Number (MCN): 123456789ABCD
|
||||
__________________________________
|
||||
CD Analysis Report
|
||||
Audio CD, CDDB disc ID is 02000701
|
||||
|
||||
CD-TEXT info:
|
||||
|
||||
@@ -30,3 +30,7 @@ Media Catalog Number (MCN): not available
|
||||
__________________________________
|
||||
CD Analysis Report
|
||||
Audio CD, CDDB disc ID is 02000401
|
||||
|
||||
CD-TEXT info:
|
||||
PERFORMER: Richard Stallman
|
||||
TITLE: Join us now we have the software
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// $Id: cdda.toc,v 1.1 2004/05/04 03:27:11 rocky Exp $
|
||||
// $Id: cdda.toc,v 1.2 2004/07/16 21:29:35 rocky Exp $
|
||||
|
||||
// Language number should always start with 0
|
||||
LANGUAGE 0 {
|
||||
// Required fields - at least all CD-TEXT CDs I've seen so far have them.
|
||||
TITLE "Join us now we have the software"
|
||||
PERFORMER "Richard Stallman"
|
||||
}
|
||||
CD_DA
|
||||
|
||||
TRACK AUDIO
|
||||
|
||||
Reference in New Issue
Block a user