Add audio lineout controls (play, pause, volume control)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.am,v 1.7 2005/02/05 13:07:02 rocky Exp $
|
||||
# $Id: Makefile.am,v 1.8 2005/03/01 00:41:34 rocky Exp $
|
||||
#
|
||||
# Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
#
|
||||
@@ -62,6 +62,7 @@ libcdio_sources = \
|
||||
_cdio_stream.c \
|
||||
_cdio_stream.h \
|
||||
_cdio_sunos.c \
|
||||
audio.c \
|
||||
cd_types.c \
|
||||
cdio.c \
|
||||
cdtext.c \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: _cdio_linux.c,v 1.28 2005/02/28 04:05:17 rocky Exp $
|
||||
$Id: _cdio_linux.c,v 1.29 2005/03/01 00:41:34 rocky Exp $
|
||||
|
||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -27,7 +27,7 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.28 2005/02/28 04:05:17 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.29 2005/03/01 00:41:34 rocky Exp $";
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -648,42 +648,6 @@ read_audio_sectors_linux (void *p_user_data, void *p_buf, lsn_t i_lsn,
|
||||
CDIO_MMC_READ_TYPE_CDDA, i_blocks);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* MMC driver to read audio sectors.
|
||||
Can read only up to 25 blocks.
|
||||
*/
|
||||
static driver_return_code_t
|
||||
read_data_sectors_linux (void *p_user_data, void *p_buf, lsn_t i_lsn,
|
||||
uint16_t i_blocksize, uint32_t i_blocks)
|
||||
{
|
||||
_img_private_t *p_env = p_user_data;
|
||||
if (ISO_BLOCKSIZE == i_blocksize) {
|
||||
msf_t msf;
|
||||
struct cdrom_msf0 linux_msf;
|
||||
int i_rc;
|
||||
cdio_lsn_to_msf(i_lsn, &msf);
|
||||
linux_msf.minute = msf.m;
|
||||
linux_msf.second = msf.s;
|
||||
linux_msf.frame = msf.f;
|
||||
i_rc = ioctl(p_env->gen.fd, CDROMSEEK, &linux_msf);
|
||||
// cdio_warn("%s: %s\n",
|
||||
// "error in ioctl CDROMREADTOCHDR", strerror(errno));
|
||||
if (0 == i_rc) {
|
||||
unsigned int j = 0;
|
||||
for (j=0; j<i_blocks; j++) {
|
||||
void *p_buf2 = ((char *)p_buf ) + (j * ISO_BLOCKSIZE);
|
||||
if (0 != ioctl(p_env->gen.fd, CDROMREADCOOKED, p_buf2))
|
||||
break;
|
||||
}
|
||||
if (j==i_blocks) return DRIVER_OP_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return read_data_sectors_mmc( p_env->gen.cdio, p_buf, i_lsn, i_blocksize,
|
||||
i_blocks );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Packet driver to read mode2 sectors.
|
||||
Can read only up to 25 blocks.
|
||||
*/
|
||||
@@ -1318,8 +1282,8 @@ cdio_open_am_linux (const char *psz_orig_source, const char *access_mode)
|
||||
.lseek = cdio_generic_lseek,
|
||||
.read = cdio_generic_read,
|
||||
.read_audio_sectors = read_audio_sectors_linux,
|
||||
#if 0
|
||||
.read_data_sectors = read_data_sectors_linux,
|
||||
#if 1
|
||||
.read_data_sectors = read_data_sectors_generic,
|
||||
#else
|
||||
.read_data_sectors = read_data_sectors_mmc,
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: cdio_private.h,v 1.16 2005/02/17 07:03:37 rocky Exp $
|
||||
$Id: cdio_private.h,v 1.17 2005/03/01 00:41:34 rocky Exp $
|
||||
|
||||
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#endif
|
||||
|
||||
#include <cdio/cdio.h>
|
||||
#include <cdio/audio.h>
|
||||
#include <cdio/cdtext.h>
|
||||
#include "mmc_private.h"
|
||||
|
||||
@@ -53,12 +54,67 @@ extern "C" {
|
||||
|
||||
typedef struct {
|
||||
|
||||
/*!
|
||||
Get volume of an audio CD.
|
||||
|
||||
@param p_env the CD object to be acted upon.
|
||||
|
||||
*/
|
||||
driver_return_code_t (*audio_get_volume)
|
||||
(void *p_env, /*out*/ cdio_audio_volume_t *p_volume);
|
||||
|
||||
/*!
|
||||
Pause playing CD through analog output
|
||||
|
||||
@param p_env the CD object to be acted upon.
|
||||
*/
|
||||
driver_return_code_t (*audio_pause) (void *p_env);
|
||||
|
||||
/*!
|
||||
Playing CD through analog output
|
||||
|
||||
@param p_env the CD object to be acted upon.
|
||||
*/
|
||||
driver_return_code_t (*audio_play_msf) ( void *p_env, msf_t *p_msf );
|
||||
|
||||
/*!
|
||||
Playing CD through analog output
|
||||
|
||||
@param p_env the CD object to be acted upon.
|
||||
*/
|
||||
driver_return_code_t (*audio_play_track_index)
|
||||
( void *p_env, cdio_track_index_t *p_track_index );
|
||||
|
||||
/*!
|
||||
Get subchannel information.
|
||||
|
||||
@param p_env the CD object to be acted upon.
|
||||
*/
|
||||
driver_return_code_t (*audio_read_subchannel)
|
||||
( void *p_env, cdio_subchannel_t *subchannel );
|
||||
|
||||
/*!
|
||||
Resume playing an audio CD.
|
||||
|
||||
@param p_env the CD object to be acted upon.
|
||||
|
||||
*/
|
||||
driver_return_code_t (*audio_resume) ( void *p_env );
|
||||
|
||||
/*!
|
||||
Set volume of an audio CD.
|
||||
|
||||
@param p_env the CD object to be acted upon.
|
||||
|
||||
*/
|
||||
driver_return_code_t (*audio_set_volume)
|
||||
( void *p_env, const cdio_audio_volume_t *p_volume );
|
||||
/*!
|
||||
Eject media in CD drive. If successful, as a side effect we
|
||||
also free obj. Return 0 if success and 1 for failure.
|
||||
|
||||
@param p_cdio the CD object to be acted upon.
|
||||
If the CD is ejected *p_cdio is freed and p_cdio set to NULL.
|
||||
@param p_env the CD object to be acted upon.
|
||||
If the CD is ejected *p_env is freed and p_env set to NULL.
|
||||
*/
|
||||
int (*eject_media) (void *p_env);
|
||||
|
||||
@@ -141,8 +197,8 @@ extern "C" {
|
||||
Get the CD-ROM hardware info via a SCSI MMC INQUIRY command.
|
||||
False is returned if we had an error getting the information.
|
||||
*/
|
||||
bool (*get_hwinfo) ( const CdIo_t *p_cdio,
|
||||
/* out*/ cdio_hwinfo_t *p_hw_info );
|
||||
bool (*get_hwinfo)
|
||||
( const CdIo_t *p_cdio, /* out*/ cdio_hwinfo_t *p_hw_info );
|
||||
|
||||
/*!
|
||||
Find out if media has changed since the last call.
|
||||
@@ -213,8 +269,8 @@ extern "C" {
|
||||
or -2 if not implimented (yet). Is this meaningful if not an
|
||||
audio track?
|
||||
*/
|
||||
track_flag_t (*get_track_preemphasis) (const void *p_env,
|
||||
track_t i_track);
|
||||
track_flag_t (*get_track_preemphasis)
|
||||
( const void *p_env, track_t i_track );
|
||||
|
||||
/*!
|
||||
lseek - reposition read/write file offset
|
||||
@@ -254,40 +310,41 @@ extern "C" {
|
||||
@param i_blocksize size of block. Should be either CDIO_CD_FRAMESIZE,
|
||||
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf.
|
||||
*/
|
||||
driver_return_code_t (*read_data_sectors) (void *p_env, void *p_buf,
|
||||
lsn_t i_lsn,
|
||||
uint16_t i_blocksize,
|
||||
uint32_t i_blocks);
|
||||
driver_return_code_t (*read_data_sectors)
|
||||
( void *p_env, void *p_buf, lsn_t i_lsn, uint16_t i_blocksize,
|
||||
uint32_t i_blocks );
|
||||
|
||||
/*!
|
||||
Reads a single mode2 sector from cd device into buf starting
|
||||
from lsn. Returns 0 if no error.
|
||||
*/
|
||||
int (*read_mode2_sector) (void *p_env, void *p_buf, lsn_t i_lsn,
|
||||
bool b_mode2_form2);
|
||||
int (*read_mode2_sector)
|
||||
( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2 );
|
||||
|
||||
/*!
|
||||
Reads i_blocks of mode2 sectors from cd device into data starting
|
||||
from lsn.
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
int (*read_mode2_sectors) (void *p_env, void *p_buf, lsn_t i_lsn,
|
||||
bool b_mode2_form2, unsigned int i_blocks);
|
||||
int (*read_mode2_sectors)
|
||||
( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2,
|
||||
unsigned int i_blocks );
|
||||
|
||||
/*!
|
||||
Reads a single mode1 sector from cd device into buf starting
|
||||
from lsn. Returns 0 if no error.
|
||||
*/
|
||||
int (*read_mode1_sector) (void *p_env, void *p_buf, lsn_t i_lsn,
|
||||
bool mode1_form2);
|
||||
int (*read_mode1_sector)
|
||||
( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2 );
|
||||
|
||||
/*!
|
||||
Reads i_blocks of mode1 sectors from cd device into data starting
|
||||
from lsn.
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
int (*read_mode1_sectors) (void *p_env, void *p_buf, lsn_t i_lsn,
|
||||
bool mode1_form2, unsigned int i_blocks);
|
||||
int (*read_mode1_sectors)
|
||||
( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2,
|
||||
unsigned int i_blocks );
|
||||
|
||||
bool (*read_toc) ( void *p_env ) ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user