Corrections to audio. First glimpse at working (on GNU/Linux) audio
controls.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: _cdio_linux.c,v 1.29 2005/03/01 00:41:34 rocky Exp $
|
$Id: _cdio_linux.c,v 1.30 2005/03/01 02:49:43 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.29 2005/03/01 00:41:34 rocky Exp $";
|
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.30 2005/03/01 02:49:43 rocky Exp $";
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.29 2005/03/01 00:41:34 rock
|
|||||||
#include <cdio/util.h>
|
#include <cdio/util.h>
|
||||||
#include <cdio/types.h>
|
#include <cdio/types.h>
|
||||||
#include <cdio/mmc.h>
|
#include <cdio/mmc.h>
|
||||||
|
#include <cdio/audio.h>
|
||||||
#include <cdio/cdtext.h>
|
#include <cdio/cdtext.h>
|
||||||
#include "cdtext_private.h"
|
#include "cdtext_private.h"
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
@@ -231,6 +232,20 @@ audio_play_track_index_linux (void *p_user_data,
|
|||||||
return ioctl(p_env->gen.fd, CDROMPLAYTRKIND, p_track_index);
|
return ioctl(p_env->gen.fd, CDROMPLAYTRKIND, p_track_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Resume playing an audio CD.
|
||||||
|
|
||||||
|
@param p_cdio the CD object to be acted upon.
|
||||||
|
|
||||||
|
*/
|
||||||
|
static driver_return_code_t
|
||||||
|
audio_read_subchannel_linux (void *p_user_data,
|
||||||
|
cdio_subchannel_t *p_subchannel) {
|
||||||
|
|
||||||
|
const _img_private_t *p_env = p_user_data;
|
||||||
|
return ioctl(p_env->gen.fd, CDROMSUBCHNL, p_subchannel);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Resume playing an audio CD.
|
Resume playing an audio CD.
|
||||||
|
|
||||||
@@ -1251,6 +1266,7 @@ cdio_open_am_linux (const char *psz_orig_source, const char *access_mode)
|
|||||||
.audio_pause = audio_pause_linux,
|
.audio_pause = audio_pause_linux,
|
||||||
.audio_play_msf = audio_play_msf_linux,
|
.audio_play_msf = audio_play_msf_linux,
|
||||||
.audio_play_track_index= audio_play_track_index_linux,
|
.audio_play_track_index= audio_play_track_index_linux,
|
||||||
|
.audio_read_subchannel = audio_read_subchannel_linux,
|
||||||
.audio_resume = audio_resume_linux,
|
.audio_resume = audio_resume_linux,
|
||||||
.audio_set_volume = audio_set_volume_linux,
|
.audio_set_volume = audio_set_volume_linux,
|
||||||
.eject_media = eject_media_linux,
|
.eject_media = eject_media_linux,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: audio.c,v 1.1 2005/03/01 00:49:24 rocky Exp $
|
$Id: audio.c,v 1.2 2005/03/01 02:49:43 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ cdio_audio_get_volume (CdIo_t *p_cdio, /*out*/ cdio_audio_volume_t *p_volume)
|
|||||||
{
|
{
|
||||||
if (!p_cdio) return DRIVER_OP_UNINIT;
|
if (!p_cdio) return DRIVER_OP_UNINIT;
|
||||||
|
|
||||||
if (!p_cdio->op.audio_get_volume) {
|
if (p_cdio->op.audio_get_volume) {
|
||||||
return p_cdio->op.audio_get_volume (p_cdio->env, p_volume);
|
return p_cdio->op.audio_get_volume (p_cdio->env, p_volume);
|
||||||
} else {
|
} else {
|
||||||
return DRIVER_OP_UNSUPPORTED;
|
return DRIVER_OP_UNSUPPORTED;
|
||||||
@@ -55,7 +55,7 @@ cdio_audio_pause (CdIo_t *p_cdio)
|
|||||||
{
|
{
|
||||||
if (!p_cdio) return DRIVER_OP_UNINIT;
|
if (!p_cdio) return DRIVER_OP_UNINIT;
|
||||||
|
|
||||||
if (!p_cdio->op.audio_pause) {
|
if (p_cdio->op.audio_pause) {
|
||||||
return p_cdio->op.audio_pause (p_cdio->env);
|
return p_cdio->op.audio_pause (p_cdio->env);
|
||||||
} else {
|
} else {
|
||||||
return DRIVER_OP_UNSUPPORTED;
|
return DRIVER_OP_UNSUPPORTED;
|
||||||
@@ -72,7 +72,7 @@ cdio_audio_play_msf (CdIo_t *p_cdio, msf_t *p_msf)
|
|||||||
{
|
{
|
||||||
if (!p_cdio) return DRIVER_OP_UNINIT;
|
if (!p_cdio) return DRIVER_OP_UNINIT;
|
||||||
|
|
||||||
if (!p_cdio->op.audio_play_msf) {
|
if (p_cdio->op.audio_play_msf) {
|
||||||
return p_cdio->op.audio_play_msf (p_cdio->env, p_msf);
|
return p_cdio->op.audio_play_msf (p_cdio->env, p_msf);
|
||||||
} else {
|
} else {
|
||||||
return DRIVER_OP_UNSUPPORTED;
|
return DRIVER_OP_UNSUPPORTED;
|
||||||
@@ -89,7 +89,7 @@ cdio_audio_play_track_index (CdIo_t *p_cdio, cdio_track_index_t *p_track_index)
|
|||||||
{
|
{
|
||||||
if (!p_cdio) return DRIVER_OP_UNINIT;
|
if (!p_cdio) return DRIVER_OP_UNINIT;
|
||||||
|
|
||||||
if (!p_cdio->op.audio_play_track_index) {
|
if (p_cdio->op.audio_play_track_index) {
|
||||||
return p_cdio->op.audio_play_track_index (p_cdio->env, p_track_index);
|
return p_cdio->op.audio_play_track_index (p_cdio->env, p_track_index);
|
||||||
} else {
|
} else {
|
||||||
return DRIVER_OP_UNSUPPORTED;
|
return DRIVER_OP_UNSUPPORTED;
|
||||||
@@ -106,7 +106,7 @@ cdio_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel)
|
|||||||
{
|
{
|
||||||
if (!p_cdio) return DRIVER_OP_UNINIT;
|
if (!p_cdio) return DRIVER_OP_UNINIT;
|
||||||
|
|
||||||
if (!p_cdio->op.audio_read_subchannel) {
|
if (p_cdio->op.audio_read_subchannel) {
|
||||||
return p_cdio->op.audio_read_subchannel(p_cdio->env, p_subchannel);
|
return p_cdio->op.audio_read_subchannel(p_cdio->env, p_subchannel);
|
||||||
} else {
|
} else {
|
||||||
return DRIVER_OP_UNSUPPORTED;
|
return DRIVER_OP_UNSUPPORTED;
|
||||||
@@ -142,7 +142,7 @@ cdio_audio_set_volume (CdIo_t *p_cdio, const cdio_audio_volume_t *p_volume)
|
|||||||
{
|
{
|
||||||
if (!p_cdio) return DRIVER_OP_UNINIT;
|
if (!p_cdio) return DRIVER_OP_UNINIT;
|
||||||
|
|
||||||
if (!p_cdio->op.audio_set_volume) {
|
if (p_cdio->op.audio_set_volume) {
|
||||||
return p_cdio->op.audio_set_volume(p_cdio->env, p_volume);
|
return p_cdio->op.audio_set_volume(p_cdio->env, p_volume);
|
||||||
} else {
|
} else {
|
||||||
return DRIVER_OP_UNSUPPORTED;
|
return DRIVER_OP_UNSUPPORTED;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-info.c,v 1.120 2005/02/22 02:02:46 rocky Exp $
|
$Id: cd-info.c,v 1.121 2005/03/01 02:49:43 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>
|
||||||
@@ -44,7 +44,8 @@
|
|||||||
#include <cdio/cd_types.h>
|
#include <cdio/cd_types.h>
|
||||||
#include <cdio/cdtext.h>
|
#include <cdio/cdtext.h>
|
||||||
#include <cdio/iso9660.h>
|
#include <cdio/iso9660.h>
|
||||||
#include <cdio/scsi_mmc.h>
|
#include <cdio/mmc.h>
|
||||||
|
#include <cdio/audio.h>
|
||||||
|
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
|
|
||||||
@@ -1139,8 +1140,53 @@ main(int argc, const char *argv[])
|
|||||||
printf("%s\n", media_catalog_number);
|
printf("%s\n", media_catalog_number);
|
||||||
free(media_catalog_number);
|
free(media_catalog_number);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/* get audio status from subchannel */
|
||||||
|
if ( CDIO_DISC_MODE_CD_DA == discmode ||
|
||||||
|
CDIO_DISC_MODE_CD_MIXED == discmode ) {
|
||||||
|
cdio_subchannel_t subchannel;
|
||||||
|
driver_return_code_t rc;
|
||||||
|
|
||||||
|
memset(&subchannel, 0, sizeof(subchannel));
|
||||||
|
subchannel.cdsc_format = CDIO_CDROM_MSF;
|
||||||
|
|
||||||
|
rc = cdio_audio_read_subchannel(p_cdio, &subchannel);
|
||||||
|
|
||||||
|
if (DRIVER_OP_SUCCESS == rc) {
|
||||||
|
|
||||||
|
report( stdout, "audio status: "); fflush(stdout);
|
||||||
|
|
||||||
|
switch (subchannel.cdsc_audiostatus) {
|
||||||
|
case CDIO_MMC_READ_SUB_ST_INVALID:
|
||||||
|
report( stdout, "invalid\n" ); break;
|
||||||
|
case CDIO_MMC_READ_SUB_ST_PLAY:
|
||||||
|
report( stdout, "playing" ); break;
|
||||||
|
case CDIO_MMC_READ_SUB_ST_PAUSED:
|
||||||
|
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:
|
||||||
|
report( stdout, "no status\n" ); break;
|
||||||
|
default:
|
||||||
|
report( stdout, "Oops: unknown\n" );
|
||||||
|
}
|
||||||
|
if (subchannel.cdsc_audiostatus == CDIO_MMC_READ_SUB_ST_PLAY ||
|
||||||
|
subchannel.cdsc_audiostatus == CDIO_MMC_READ_SUB_ST_PAUSED) {
|
||||||
|
report( stdout, " at: %02d:%02d abs / %02d:%02d track %d\n",
|
||||||
|
subchannel.cdsc_absaddr.msf.m,
|
||||||
|
subchannel.cdsc_absaddr.msf.s,
|
||||||
|
subchannel.cdsc_reladdr.msf.m,
|
||||||
|
subchannel.cdsc_reladdr.msf.s,
|
||||||
|
subchannel.cdsc_trk );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
report( stdout, "FAILED\n" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if CDIO_IOCTL_FINISHED
|
#if CDIO_IOCTL_FINISHED
|
||||||
@@ -1149,41 +1195,14 @@ main(int argc, const char *argv[])
|
|||||||
|
|
||||||
#ifdef CDROMMULTISESSION
|
#ifdef CDROMMULTISESSION
|
||||||
/* get multisession */
|
/* get multisession */
|
||||||
printf("multisession: "); fflush(stdout);
|
report( stdout, "multisession: "); fflush(stdout);
|
||||||
ms.addr_format = CDROM_LBA;
|
ms.addr_format = CDROM_LBA;
|
||||||
if (ioctl(filehandle,CDROMMULTISESSION,&ms))
|
if (ioctl(filehandle,CDROMMULTISESSION,&ms))
|
||||||
printf("FAILED\n");
|
report( stdout, "FAILED\n");
|
||||||
else
|
else
|
||||||
printf("%d%s\n",ms.addr.lba,ms.xa_flag?" XA":"");
|
report( stdout, "%d%s\n",ms.addr.lba,ms.xa_flag?" XA":"");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CDROMSUBCHNL
|
|
||||||
/* get audio status from subchnl */
|
|
||||||
printf("audio status: "); fflush(stdout);
|
|
||||||
sub.cdsc_format = CDROM_MSF;
|
|
||||||
if (ioctl(filehandle,CDROMSUBCHNL,&sub))
|
|
||||||
printf("FAILED\n");
|
|
||||||
else {
|
|
||||||
switch (sub.cdsc_audiostatus) {
|
|
||||||
case CDROM_AUDIO_INVALID: printf("invalid\n"); break;
|
|
||||||
case CDROM_AUDIO_PLAY: printf("playing"); break;
|
|
||||||
case CDROM_AUDIO_PAUSED: printf("paused"); break;
|
|
||||||
case CDROM_AUDIO_COMPLETED: printf("completed\n"); break;
|
|
||||||
case CDROM_AUDIO_ERROR: printf("error\n"); break;
|
|
||||||
case CDROM_AUDIO_NO_STATUS: printf("no status\n"); break;
|
|
||||||
default: printf("Oops: unknown\n");
|
|
||||||
}
|
|
||||||
if (sub.cdsc_audiostatus == CDROM_AUDIO_PLAY ||
|
|
||||||
sub.cdsc_audiostatus == CDROM_AUDIO_PAUSED) {
|
|
||||||
printf(" at: %02d:%02d abs / %02d:%02d track %d\n",
|
|
||||||
sub.cdsc_absaddr.msf.minute,
|
|
||||||
sub.cdsc_absaddr.msf.second,
|
|
||||||
sub.cdsc_reladdr.msf.minute,
|
|
||||||
sub.cdsc_reladdr.msf.second,
|
|
||||||
sub.cdsc_trk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* CDROMSUBCHNL */
|
|
||||||
}
|
}
|
||||||
#endif /*CDIO_IOCTL_FINISHED*/
|
#endif /*CDIO_IOCTL_FINISHED*/
|
||||||
|
|
||||||
@@ -1204,7 +1223,7 @@ main(int argc, const char *argv[])
|
|||||||
fs |= CDIO_FS_ANAL_HIDDEN_TRACK;
|
fs |= CDIO_FS_ANAL_HIDDEN_TRACK;
|
||||||
else {
|
else {
|
||||||
fs &= ~CDIO_FS_MASK; /* del filesystem info */
|
fs &= ~CDIO_FS_MASK; /* del filesystem info */
|
||||||
printf("Oops: %lu unused sectors at start, "
|
report( stdout, "Oops: %lu unused sectors at start, "
|
||||||
"but hidden track check failed.\n",
|
"but hidden track check failed.\n",
|
||||||
(long unsigned int) start_track_lsn);
|
(long unsigned int) start_track_lsn);
|
||||||
}
|
}
|
||||||
@@ -1249,12 +1268,12 @@ main(int argc, const char *argv[])
|
|||||||
if (i > 1) {
|
if (i > 1) {
|
||||||
/* track is beyond last session -> new session found */
|
/* track is beyond last session -> new session found */
|
||||||
ms_offset = start_track_lsn;
|
ms_offset = start_track_lsn;
|
||||||
printf("session #%d starts at track %2i, LSN: %lu,"
|
report( stdout, "session #%d starts at track %2i, LSN: %lu,"
|
||||||
" ISO 9660 blocks: %6i\n",
|
" ISO 9660 blocks: %6i\n",
|
||||||
j++, i, (unsigned long int) start_track_lsn,
|
j++, i, (unsigned long int) start_track_lsn,
|
||||||
cdio_iso_analysis.isofs_size);
|
cdio_iso_analysis.isofs_size);
|
||||||
printf("ISO 9660: %i blocks, label `%.32s'\n",
|
report( stdout, "ISO 9660: %i blocks, label `%.32s'\n",
|
||||||
cdio_iso_analysis.isofs_size, cdio_iso_analysis.iso_label);
|
cdio_iso_analysis.isofs_size, cdio_iso_analysis.iso_label);
|
||||||
fs |= CDIO_FS_ANAL_MULTISESSION;
|
fs |= CDIO_FS_ANAL_MULTISESSION;
|
||||||
} else {
|
} else {
|
||||||
print_analysis(ms_offset, cdio_iso_analysis, fs, first_data,
|
print_analysis(ms_offset, cdio_iso_analysis, fs, first_data,
|
||||||
|
|||||||
Reference in New Issue
Block a user