From b02c3fa64fdcfc95bcbad4204c1200e3d7d73e84 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 17 Jul 2004 09:12:21 +0000 Subject: [PATCH] Win32 fixes for new CD-TEXT interface. --- lib/MSWindows/aspi32.c | 36 ++++-------------------------------- lib/MSWindows/aspi32.h | 11 +++++++---- lib/MSWindows/win32.c | 24 +++++++++++++++--------- lib/MSWindows/win32.h | 13 ++++++------- lib/MSWindows/win32_ioctl.c | 18 ++++++------------ 5 files changed, 38 insertions(+), 64 deletions(-) diff --git a/lib/MSWindows/aspi32.c b/lib/MSWindows/aspi32.c index 678c720e..1bcb0ef6 100644 --- a/lib/MSWindows/aspi32.c +++ b/lib/MSWindows/aspi32.c @@ -1,5 +1,5 @@ /* - $Id: aspi32.c,v 1.25 2004/07/17 02:43:41 rocky Exp $ + $Id: aspi32.c,v 1.26 2004/07/17 09:12:21 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -27,7 +27,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: aspi32.c,v 1.25 2004/07/17 02:43:41 rocky Exp $"; +static const char _rcsid[] = "$Id: aspi32.c,v 1.26 2004/07/17 09:12:21 rocky Exp $"; #include #include @@ -716,15 +716,8 @@ wnaspi32_eject_media (void *user_data) { return true on success, false on error or CD-TEXT information does not exist. */ -/*! - Get cdtext information for a CdIo object . - - @param obj the CD object that may contain CD-TEXT information. - @return the CD-TEXT object or NULL if obj is NULL - or CD-TEXT information does not exist. -*/ -static const cdtext_t * -_init_cdtext_aspi (_img_private_t *env) +bool +init_cdtext_aspi (_img_private_t *env) { uint8_t wdata[5000] = { 0, }; uint8_t scsi_cdb[10] = { 0, }; @@ -801,27 +794,6 @@ _init_cdtext_aspi (_img_private_t *env) return true; } -/*! - Get cdtext information for a CdIo object . - - @param obj the CD object that may contain CD-TEXT information. - @return the CD-TEXT object or NULL if obj is NULL - or CD-TEXT information does not exist. -*/ -const cdtext_t * -get_cdtext_aspi (_img_private_t *env, track_t i_track) -{ - - env->b_cdtext_init = _init_cdtext_aspi(env); - if (!env->b_cdtext_init) return NULL; - - if (0 == i_track) - return &(env->cdtext); - else - return &(env->cdtext_track[i_track-env->i_first_track]); -} - - /*! Return the the kind of drive capabilities of device. diff --git a/lib/MSWindows/aspi32.h b/lib/MSWindows/aspi32.h index 393487d8..e07161e4 100644 --- a/lib/MSWindows/aspi32.h +++ b/lib/MSWindows/aspi32.h @@ -1,6 +1,6 @@ /* Win32 aspi specific */ /* - $Id: aspi32.h,v 1.7 2004/07/16 01:25:59 rocky Exp $ + $Id: aspi32.h,v 1.8 2004/07/17 09:12:21 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -194,10 +194,13 @@ track_format_t get_track_format_aspi(const _img_private_t *env, */ bool init_aspi (_img_private_t *env); -/*! - Return the CD-TEXT structure +/* + Read cdtext information for a CdIo object . + + return true on success, false on error or CD-TEXT information does + not exist. */ -const cdtext_t *get_cdtext_aspi (_img_private_t *env); +bool init_cdtext_aspi (_img_private_t *env); const char *is_cdrom_aspi(const char drive_letter); diff --git a/lib/MSWindows/win32.c b/lib/MSWindows/win32.c index 19c10d11..22a2e549 100644 --- a/lib/MSWindows/win32.c +++ b/lib/MSWindows/win32.c @@ -1,5 +1,5 @@ /* - $Id: win32.c,v 1.22 2004/07/17 02:43:41 rocky Exp $ + $Id: win32.c,v 1.23 2004/07/17 09:12:21 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32.c,v 1.22 2004/07/17 02:43:41 rocky Exp $"; +static const char _rcsid[] = "$Id: win32.c,v 1.23 2004/07/17 09:12:21 rocky Exp $"; #include #include @@ -442,11 +442,17 @@ _get_cdtext_win32 (void *user_data, track_t i_track) && i_track >= env->i_tracks + env->i_first_track ) ) return NULL; - if (env->hASPI) { - return get_cdtext_aspi(env, i_track); - } else - return get_cdtext_win32ioctl(env, i_track); + env->b_cdtext_init = init_cdtext_aspi(env); + } else + env->b_cdtext_init = init_cdtext_win32ioctl(env); + + if (!env->b_cdtext_init) return NULL; + + if (0 == i_track) + return &(env->cdtext); + else + return &(env->tocent[i_track-env->i_first_track].cdtext); return NULL; } @@ -501,7 +507,7 @@ _cdio_get_num_tracks(void *user_data) Get format of track. */ static track_format_t -_cdio_get_track_format(void *obj, track_t i_tracks) +_cdio_get_track_format(void *obj, track_t i_track) { _img_private_t *env = obj; @@ -511,9 +517,9 @@ _cdio_get_track_format(void *obj, track_t i_tracks) return TRACK_FORMAT_ERROR; if( env->hASPI ) { - return get_track_format_aspi(env, i_tracks); + return get_track_format_aspi(env, i_track); } else { - return get_track_format_win32ioctl(env, i_tracks); + return get_track_format_win32ioctl(env, i_track); } } diff --git a/lib/MSWindows/win32.h b/lib/MSWindows/win32.h index b63abe35..85226e72 100644 --- a/lib/MSWindows/win32.h +++ b/lib/MSWindows/win32.h @@ -1,5 +1,5 @@ /* - $Id: win32.h,v 1.10 2004/07/16 02:48:49 rocky Exp $ + $Id: win32.h,v 1.11 2004/07/17 09:12:21 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -105,14 +105,13 @@ bool read_toc_win32ioctl (_img_private_t *env); */ char *get_mcn_win32ioctl (const _img_private_t *env); -/*! - Get cdtext information for a CdIo object . +/* + Read cdtext information for a CdIo object . - @param obj the CD object that may contain CD-TEXT information. - @return the CD-TEXT object or NULL if obj is NULL - or CD-TEXT information does not exist. + return true on success, false on error or CD-TEXT information does + not exist. */ -const cdtext_t * get_cdtext_win32ioctl (_img_private_t *env); +bool init_cdtext_win32ioctl (_img_private_t *env); /*! Return the the kind of drive capabilities of device. diff --git a/lib/MSWindows/win32_ioctl.c b/lib/MSWindows/win32_ioctl.c index d775caf4..371493e6 100644 --- a/lib/MSWindows/win32_ioctl.c +++ b/lib/MSWindows/win32_ioctl.c @@ -1,5 +1,5 @@ /* - $Id: win32_ioctl.c,v 1.14 2004/07/16 03:06:53 rocky Exp $ + $Id: win32_ioctl.c,v 1.15 2004/07/17 09:12:21 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.14 2004/07/16 03:06:53 rocky Exp $"; +static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.15 2004/07/17 09:12:21 rocky Exp $"; #include #include @@ -403,12 +403,9 @@ read_toc_win32ioctl (_img_private_t *env) @return the CD-TEXT object or NULL if obj is NULL or CD-TEXT information does not exist. */ -const cdtext_t * -get_cdtext_win32ioctl (_img_private_t *env) +bool +init_cdtext_win32ioctl (_img_private_t *env) { -#if 0 - return NULL; -#else uint8_t wdata[5000] = { 0, }; SCSI_PASS_THROUGH_DIRECT sptd; @@ -451,7 +448,7 @@ get_cdtext_win32ioctl (_img_private_t *env) (LPSTR) psz_msg, 0, NULL); cdio_info("Error reading cdtext: %s", psz_msg); LocalFree(psz_msg); - return NULL; + return false; } { @@ -513,10 +510,7 @@ get_cdtext_win32ioctl (_img_private_t *env) pdata++; } } - - env->b_cdtext_init = true; - return &(env->cdtext); -#endif + return true; } /*!