diff --git a/include/cdio/audio.h b/include/cdio/audio.h index 43ee35f0..d656d082 100644 --- a/include/cdio/audio.h +++ b/include/cdio/audio.h @@ -1,5 +1,5 @@ /* -*- c -*- - $Id: audio.h,v 1.7 2005/03/06 15:59:20 rocky Exp $ + $Id: audio.h,v 1.8 2005/03/14 02:02:49 rocky Exp $ Copyright (C) 2005 Rocky Bernstein @@ -66,6 +66,10 @@ extern "C" { Get volume of an audio CD. @param p_cdio the CD object to be acted upon. + @param p_volume place to put the list of volume outputs levels + + p_volume can be NULL in which case we return only whether the driver + has the ability to get the volume or not. */ driver_return_code_t cdio_audio_get_volume (CdIo_t *p_cdio, /*out*/ diff --git a/include/cdio/device.h b/include/cdio/device.h index af6108c4..9b1d0c1c 100644 --- a/include/cdio/device.h +++ b/include/cdio/device.h @@ -1,5 +1,5 @@ /* -*- c -*- - $Id: device.h,v 1.21 2005/03/07 07:23:52 rocky Exp $ + $Id: device.h,v 1.22 2005/03/14 02:02:49 rocky Exp $ Copyright (C) 2005 Rocky Bernstein @@ -220,11 +220,11 @@ extern "C" { /*! Close media tray in CD drive if there is a routine to do so. - - @param name of CD-ROM device to be acted upon. - driver_id is the driver to use to perform the action. If DRIVER_UNKNOWN - or DRIVER_DEVICE we'll scan for a suitable driver and set - driver_id to that on return. + + @param psz_drive the name of CD-ROM to be closed. + @param p_driver_id is the driver to be used or that got used if + it was DRIVER_UNKNOWN or DRIVER_DEVICE; If this is NULL, we won't + report back the driver used. */ driver_return_code_t cdio_close_tray (const char *psz_device, /*in/out*/ driver_id_t *p_driver_id); diff --git a/lib/driver/audio.c b/lib/driver/audio.c index b02b45e1..249b8019 100644 --- a/lib/driver/audio.c +++ b/lib/driver/audio.c @@ -1,5 +1,5 @@ /* - $Id: audio.c,v 1.7 2005/03/06 22:36:27 rocky Exp $ + $Id: audio.c,v 1.8 2005/03/14 02:02:49 rocky Exp $ Copyright (C) 2005 Rocky Bernstein @@ -46,8 +46,11 @@ cdio_audio_get_msf_seconds(msf_t *p_msf) driver_return_code_t cdio_audio_get_volume (CdIo_t *p_cdio, /*out*/ cdio_audio_volume_t *p_volume) { + cdio_audio_volume_t temp_audio_volume; + if (!p_cdio) return DRIVER_OP_UNINIT; + if (!p_volume) p_volume = &temp_audio_volume; if (p_cdio->op.audio_get_volume) { return p_cdio->op.audio_get_volume (p_cdio->env, p_volume); } else { diff --git a/lib/driver/device.c b/lib/driver/device.c index 7fcd0d23..9d0a8c61 100644 --- a/lib/driver/device.c +++ b/lib/driver/device.c @@ -1,5 +1,5 @@ /* - $Id: device.c,v 1.18 2005/03/09 02:19:54 rocky Exp $ + $Id: device.c,v 1.19 2005/03/14 02:02:49 rocky Exp $ Copyright (C) 2005 Rocky Bernstein @@ -301,13 +301,19 @@ cdio_destroy (CdIo_t *p_cdio) /*! Close media tray in CD drive if there is a routine to do so. - @param p_cdio the CD object to be acted upon. - If the CD is ejected *p_cdio is free'd and p_cdio set to NULL. + @param psz_drive the name of CD-ROM to be closed. + @param p_driver_id is the driver to be used or that got used if + it was DRIVER_UNKNOWN or DRIVER_DEVICE; If this is NULL, we won't + report back the driver used. */ driver_return_code_t -cdio_close_tray (const char *psz_device, /*in/out*/ driver_id_t +cdio_close_tray (const char *psz_drive, /*in/out*/ driver_id_t *p_driver_id) { + const driver_id_t temp_driver_id = DRIVER_DEVICE; + + if (!p_driver_id) p_driver_id = &temp_driver_id; + if (DRIVER_UNKNOWN == *p_driver_id || DRIVER_DEVICE == *p_driver_id) { *p_driver_id = CDIO_MIN_DEVICE_DRIVER; @@ -315,7 +321,7 @@ cdio_close_tray (const char *psz_device, /*in/out*/ driver_id_t for ( ; *p_driver_id<=CDIO_MAX_DRIVER; (*p_driver_id)++) { if ( (*CdIo_all_drivers[*p_driver_id].have_driver)() && *CdIo_all_drivers[*p_driver_id].close_tray ) { - return (*CdIo_all_drivers[*p_driver_id].close_tray)(psz_device); + return (*CdIo_all_drivers[*p_driver_id].close_tray)(psz_drive); } } return DRIVER_OP_UNSUPPORTED; @@ -324,7 +330,7 @@ cdio_close_tray (const char *psz_device, /*in/out*/ driver_id_t /* The driver id was specified. Use that. */ if ( (*CdIo_all_drivers[*p_driver_id].have_driver)() && *CdIo_all_drivers[*p_driver_id].close_tray ) { - return (*CdIo_all_drivers[*p_driver_id].close_tray)(psz_device); + return (*CdIo_all_drivers[*p_driver_id].close_tray)(psz_drive); } return DRIVER_OP_UNSUPPORTED; }