Add routine to turn audio status into a string.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: mmc.h,v 1.16 2005/03/02 04:24:00 rocky Exp $
|
$Id: mmc.h,v 1.17 2005/03/06 02:59:26 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -425,6 +425,12 @@ typedef struct mmc_subchannel_s
|
|||||||
driver_return_code_t
|
driver_return_code_t
|
||||||
mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel);
|
mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return a string containing the name of the audio state as returned from
|
||||||
|
the Q_SUBCHANNEL.
|
||||||
|
*/
|
||||||
|
const char *mmc_audio_state2str( uint8_t i_audio_state );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Eject using MMC commands.
|
* Eject using MMC commands.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Common Multimedia Command (MMC) routines.
|
/* Common Multimedia Command (MMC) routines.
|
||||||
|
|
||||||
$Id: mmc.c,v 1.20 2005/03/06 00:03:53 rocky Exp $
|
$Id: mmc.c,v 1.21 2005/03/06 02:59:26 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -68,6 +68,30 @@ audio_read_subchannel_mmc ( void *p_user_data, cdio_subchannel_t *p_subchannel)
|
|||||||
return mmc_audio_read_subchannel(p_env->cdio, p_subchannel);
|
return mmc_audio_read_subchannel(p_env->cdio, p_subchannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return a string containing the name of the audio state as returned from
|
||||||
|
the Q_SUBCHANNEL.
|
||||||
|
*/
|
||||||
|
const char *mmc_audio_state2str( uint8_t i_audio_state )
|
||||||
|
{
|
||||||
|
switch(i_audio_state) {
|
||||||
|
case CDIO_MMC_READ_SUB_ST_INVALID:
|
||||||
|
return "invalid";
|
||||||
|
case CDIO_MMC_READ_SUB_ST_PLAY:
|
||||||
|
return "playing";
|
||||||
|
case CDIO_MMC_READ_SUB_ST_PAUSED:
|
||||||
|
return "paused";
|
||||||
|
case CDIO_MMC_READ_SUB_ST_COMPLETED:
|
||||||
|
return "completed";
|
||||||
|
case CDIO_MMC_READ_SUB_ST_ERROR:
|
||||||
|
return "error";
|
||||||
|
case CDIO_MMC_READ_SUB_ST_NO_STATUS:
|
||||||
|
return "no status";
|
||||||
|
default:
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Get the block size for subsequest read requests, via MMC.
|
Get the block size for subsequest read requests, via MMC.
|
||||||
@return the blocksize if > 0; error if <= 0
|
@return the blocksize if > 0; error if <= 0
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-info.c,v 1.130 2005/03/05 19:27:28 rocky Exp $
|
$Id: cd-info.c,v 1.131 2005/03/06 02:59:26 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
|
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
|
||||||
@@ -1133,9 +1133,11 @@ main(int argc, const char *argv[])
|
|||||||
|
|
||||||
if (cdio_is_discmode_cdrom(discmode)) {
|
if (cdio_is_discmode_cdrom(discmode)) {
|
||||||
/* get and print MCN */
|
/* get and print MCN */
|
||||||
|
|
||||||
|
report(stdout, "Media Catalog Number (MCN): "); fflush(stdout);
|
||||||
|
|
||||||
media_catalog_number = cdio_get_mcn(p_cdio);
|
media_catalog_number = cdio_get_mcn(p_cdio);
|
||||||
|
|
||||||
report(stdout, "Media Catalog Number (MCN): "); fflush(stdout);
|
|
||||||
if (NULL == media_catalog_number) {
|
if (NULL == media_catalog_number) {
|
||||||
if (i_read_cap & CDIO_DRIVE_CAP_READ_MCN)
|
if (i_read_cap & CDIO_DRIVE_CAP_READ_MCN)
|
||||||
report(stdout, "not available\n");
|
report(stdout, "not available\n");
|
||||||
@@ -1170,35 +1172,29 @@ main(int argc, const char *argv[])
|
|||||||
memset(&subchannel, 0, sizeof(subchannel));
|
memset(&subchannel, 0, sizeof(subchannel));
|
||||||
subchannel.format = CDIO_CDROM_MSF;
|
subchannel.format = CDIO_CDROM_MSF;
|
||||||
|
|
||||||
rc = cdio_audio_read_subchannel(p_cdio, &subchannel);
|
|
||||||
|
|
||||||
report( stdout, "audio status: "); fflush(stdout);
|
report( stdout, "audio status: "); fflush(stdout);
|
||||||
|
|
||||||
|
rc = cdio_audio_read_subchannel(p_cdio, &subchannel);
|
||||||
|
|
||||||
if (DRIVER_OP_SUCCESS == rc) {
|
if (DRIVER_OP_SUCCESS == rc) {
|
||||||
bool b_volume = false;
|
bool b_volume = false;
|
||||||
bool b_position = false;
|
bool b_position = false;
|
||||||
|
|
||||||
|
report ( stdout, "%s\n",
|
||||||
|
mmc_audio_state2str(subchannel.audio_status) );
|
||||||
|
|
||||||
switch (subchannel.audio_status) {
|
switch (subchannel.audio_status) {
|
||||||
case CDIO_MMC_READ_SUB_ST_INVALID:
|
|
||||||
report( stdout, "invalid\n" ); break;
|
|
||||||
case CDIO_MMC_READ_SUB_ST_PLAY:
|
case CDIO_MMC_READ_SUB_ST_PLAY:
|
||||||
b_playing_audio = true;
|
b_playing_audio = true;
|
||||||
b_position = true;
|
/* Fall through to next case. */
|
||||||
b_volume = true;
|
|
||||||
report( stdout, "playing" ); break;
|
|
||||||
case CDIO_MMC_READ_SUB_ST_PAUSED:
|
case CDIO_MMC_READ_SUB_ST_PAUSED:
|
||||||
b_position = true;
|
b_position = true;
|
||||||
b_volume = true;
|
/* Fall through to next case. */
|
||||||
report( stdout, "paused" ); break;
|
|
||||||
case CDIO_MMC_READ_SUB_ST_COMPLETED:
|
|
||||||
report( stdout, "completed\n"); break;
|
|
||||||
case CDIO_MMC_READ_SUB_ST_ERROR:
|
|
||||||
report( stdout, "error\n" ); break;
|
|
||||||
case CDIO_MMC_READ_SUB_ST_NO_STATUS:
|
case CDIO_MMC_READ_SUB_ST_NO_STATUS:
|
||||||
b_volume = true;
|
b_volume = true;
|
||||||
report( stdout, "no status\n" ); break;
|
break;
|
||||||
default:
|
default:
|
||||||
report( stdout, "Oops: unknown\n" );
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b_position)
|
if (b_position)
|
||||||
|
|||||||
Reference in New Issue
Block a user