Merge common cdtext code into image drivers.

This commit is contained in:
rocky
2004-08-13 13:04:37 +00:00
parent 7bba78007e
commit cf7b5e9bf4
5 changed files with 51 additions and 63 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: cdrdao.c,v 1.24 2004/07/29 02:16:20 rocky Exp $
$Id: cdrdao.c,v 1.25 2004/08/13 13:04:37 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
toc reading routine adapted from cuetools
@@ -25,7 +25,7 @@
(*.cue).
*/
static const char _rcsid[] = "$Id: cdrdao.c,v 1.24 2004/07/29 02:16:20 rocky Exp $";
static const char _rcsid[] = "$Id: cdrdao.c,v 1.25 2004/08/13 13:04:37 rocky Exp $";
#include "image.h"
#include "cdio_assert.h"
@@ -81,7 +81,6 @@ typedef struct {
exactly 13 bytes */
track_info_t tocent[CDIO_CD_MAX_TRACKS+1]; /* entry info for each track
add 1 for leadout. */
cdtext_t cdtext; /* CD-TEXT */
discmode_t disc_mode;
} _img_private_t;
@@ -110,7 +109,7 @@ _init_cdrdao (_img_private_t *env)
env->psz_mcn = NULL;
env->disc_mode = CDIO_DISC_MODE_NO_INFO;
cdtext_init (&(env->cdtext));
cdtext_init (&(env->gen.cdtext));
/* Read in TOC sheet. */
if ( !parse_tocfile(env, env->psz_cue_name) ) return false;
@@ -289,6 +288,11 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
return false;
}
if (cd) {
cd->gen.b_cdtext_init = true;
cd->gen.b_cdtext_error = false;
}
while ((fgets(psz_line, MAXLINE, fp)) != NULL) {
i_line++;
@@ -368,7 +372,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
/* TRACK <track-mode> [<sub-channel-mode>] */
} else if (0 == strcmp ("TRACK", psz_keyword)) {
i++;
if (NULL != cd) cdtext_init (&(cd->tocent[i].cdtext));
if (NULL != cd) cdtext_init (&(cd->gen.cdtext_track[i]));
if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) {
if (0 == strcmp ("AUDIO", psz_field)) {
if (NULL != cd) {
@@ -786,12 +790,15 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
(cdtext_key = cdtext_is_keyword (psz_keyword)) ) {
if (-1 == i) {
if (NULL != cd) {
cdtext_set (cdtext_key, strtok (NULL, "\"\t\n\r"), &(cd->cdtext));
cdtext_set (cdtext_key,
strtok (NULL, "\"\t\n\r"),
&(cd->gen.cdtext));
}
} else {
if (NULL != cd) {
cdtext_set (cdtext_key, strtok (NULL, "\"\t\n\r"),
&(cd->tocent[i].cdtext));
cdtext_set (cdtext_key,
strtok (NULL, "\"\t\n\r"),
&(cd->gen.cdtext_track[i]));
}
}
@@ -1117,7 +1124,7 @@ cdio_open_cdrdao (const char *psz_cue_name)
.eject_media = _eject_media_image,
.free = _free_image,
.get_arg = _get_arg_image,
.get_cdtext = _get_cdtext_image,
.get_cdtext = get_cdtext_generic,
.get_devices = cdio_get_devices_cdrdao,
.get_default_device = cdio_get_default_device_cdrdao,
.get_discmode = _get_discmode_image,