Add common routine for setting track flags.

This commit is contained in:
rocky
2005-01-01 15:08:48 +00:00
parent 4b4108ed27
commit 6c20c2ee86
7 changed files with 37 additions and 55 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: aspi32.c,v 1.2 2005/01/01 04:17:41 rocky Exp $
$Id: aspi32.c,v 1.3 2005/01/01 15:08:48 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: aspi32.c,v 1.2 2005/01/01 04:17:41 rocky Exp $";
static const char _rcsid[] = "$Id: aspi32.c,v 1.3 2005/01/01 15:08:48 rocky Exp $";
#include <cdio/cdio.h>
#include <cdio/sector.h>
@@ -712,16 +712,7 @@ read_toc_aspi (_img_private_t *p_env)
(int)p_fulltoc[ i_index+3 ];
p_env->tocent[i].Control = (UCHAR)p_fulltoc[ 1 + 8 * i ];
p_env->gen.track_flags[j].preemphasis =
p_env->tocent[i].Control & 0x1
? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
p_env->gen.track_flags[j].copy_permit =
p_env->tocent[i].Control & 0x2
? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
p_env->gen.track_flags[j].channels =
p_env->tocent[i].Control & 0x8 ? 4 : 2;
set_track_flags(&(p_env->gen.track_flags[j]), p_env->tocent[i].Control);
cdio_debug( "p_sectors: %i %lu",
i, (unsigned long int) p_env->tocent[i].start_lsn );

View File

@@ -1,5 +1,5 @@
/*
$Id: win32_ioctl.c,v 1.2 2005/01/01 04:17:41 rocky Exp $
$Id: win32_ioctl.c,v 1.3 2005/01/01 15:08:48 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.2 2005/01/01 04:17:41 rocky Exp $";
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.3 2005/01/01 15:08:48 rocky Exp $";
#ifdef HAVE_WIN32_CDROM
@@ -619,16 +619,8 @@ read_fulltoc_win32mmc (_img_private_t *p_env)
cdrom_toc_full.TrackData[i].Control;
p_env->tocent[j-1].Format = i_track_format;
p_env->gen.track_flags[j].preemphasis =
cdrom_toc_full.TrackData[i].Control & 0x1
? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
p_env->gen.track_flags[j].copy_permit =
cdrom_toc_full.TrackData[i].Control & 0x2
? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
p_env->gen.track_flags[j].channels =
cdrom_toc_full.TrackData[i].Control & 0x8 ? 4 : 2;
set_track_flags(&(p_env->gen.track_flags[j]),
p_env->tocent[j-1].Control);
cdio_debug("p_sectors: %i, %lu", i,
(unsigned long int) (p_env->tocent[i].start_lsn));

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_generic.c,v 1.3 2004/12/31 05:47:36 rocky Exp $
$Id: _cdio_generic.c,v 1.4 2005/01/01 15:08:48 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -25,7 +25,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.3 2004/12/31 05:47:36 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.4 2005/01/01 15:08:48 rocky Exp $";
#include <stdio.h>
#include <stdlib.h>
@@ -457,6 +457,20 @@ get_track_preemphasis_generic(const void *p_user_data, track_t i_track)
return p_env->track_flags[i_track].preemphasis;
}
void
set_track_flags(track_flags_t *p_track_flag, uint8_t i_flag)
{
p_track_flag->preemphasis = ( i_flag & CDIO_TRACK_FLAG_PRE_EMPHASIS )
? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
p_track_flag->copy_permit = ( i_flag & CDIO_TRACK_FLAG_COPY_PERMITTED )
? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
p_track_flag->channels = ( i_flag & CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO )
? 4 : 2;
}
/*
* Local variables:

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_linux.c,v 1.4 2005/01/01 14:20:15 rocky Exp $
$Id: _cdio_linux.c,v 1.5 2005/01/01 15:08:48 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.4 2005/01/01 14:20:15 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.5 2005/01/01 15:08:48 rocky Exp $";
#include <string.h>
@@ -848,18 +848,7 @@ read_toc_linux (void *p_user_data)
return false;
}
/** FIXME: Do in a more generic place? **/
p_env->gen.track_flags[i].preemphasis =
p_toc->cdte_ctrl & CDIO_TRACK_FLAG_PRE_EMPHASIS
? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
p_env->gen.track_flags[i].copy_permit =
p_toc->cdte_ctrl & CDIO_TRACK_FLAG_COPY_PERMITTED
? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
p_env->gen.track_flags[i].channels =
p_toc->cdte_ctrl & CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO
? 4 : 2;
set_track_flags(&(p_env->gen.track_flags[i]), p_toc->cdte_ctrl);
/****
struct cdrom_msf0 *msf= &env->tocent[i-1].cdte_addr.msf;

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_sunos.c,v 1.2 2004/12/31 08:27:49 rocky Exp $
$Id: _cdio_sunos.c,v 1.3 2005/01/01 15:08:48 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -38,7 +38,7 @@
#ifdef HAVE_SOLARIS_CDROM
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.2 2004/12/31 08:27:49 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.3 2005/01/01 15:08:48 rocky Exp $";
#ifdef HAVE_GLOB_H
#include <glob.h>
@@ -432,16 +432,7 @@ read_toc_solaris (void *p_user_data)
return false;
}
/** FIXME: Do in a more generic place? **/
p_env->gen.track_flags[i].preemphasis =
p_toc->cdte_ctrl & 0x1 ? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
p_env->gen.track_flags[i].copy_permit =
p_toc->cdte_ctrl & 0x2 ? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
p_env->gen.track_flags[i].channels =
p_toc->cdte_ctrl & 0x8 ? 4 : 2;
set_track_flags(&(p_env->gen.track_flags[i]), p_toc->cdte_ctrl);
}
/* read the lead-out track */

View File

@@ -1,5 +1,5 @@
/*
$Id: generic.h,v 1.3 2004/12/31 05:47:36 rocky Exp $
$Id: generic.h,v 1.4 2005/01/01 15:08:48 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -192,6 +192,8 @@ extern "C" {
*/
bool init_cdtext_generic (generic_img_private_t *p_env);
void set_track_flags(track_flags_t *p_track_flag, uint8_t flag);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@@ -1,5 +1,5 @@
/*
$Id: image_common.c,v 1.1 2004/12/31 07:51:43 rocky Exp $
$Id: image_common.c,v 1.2 2005/01/01 15:08:48 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -116,10 +116,13 @@ _get_drive_cap_image (const void *user_data,
cdio_drive_misc_cap_t *p_misc_cap)
{
*p_read_cap = CDIO_DRIVE_CAP_READ_AUDIO
*p_read_cap = CDIO_DRIVE_CAP_READ_CD_DA
| CDIO_DRIVE_CAP_READ_CD_G
| CDIO_DRIVE_CAP_READ_CD_R
| CDIO_DRIVE_CAP_READ_CD_RW
| CDIO_DRIVE_CAP_READ_MODE2_FORM1
| CDIO_DRIVE_CAP_READ_MODE2_FORM2
| CDIO_DRIVE_CAP_READ_MCN
;
*p_write_cap = 0;