Пример #1
0
/*!
  Initialization routine. This is the only thing that doesn't
  get called via a function pointer. In fact *we* are the
  ones to set that up.
 */
CdIo_t *
cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
{

#ifdef HAVE_WIN32_CDROM
  CdIo_t *ret;
  _img_private_t *_data;
  char *psz_source;

  cdio_funcs_t _funcs;

  memset( &_funcs, 0, sizeof(_funcs) );

  _funcs.audio_get_volume       = audio_get_volume_win32;
  _funcs.audio_pause            = audio_pause_win32;
  _funcs.audio_play_msf         = audio_play_msf_win32;
#if 0
  _funcs.audio_play_track_index = audio_play_track_index_win32;
#endif
  _funcs.audio_read_subchannel  = audio_read_subchannel_win32;
  _funcs.audio_resume           = audio_resume_win32;
  _funcs.audio_set_volume       = audio_set_volume_win32;
  _funcs.audio_stop             = audio_stop_win32;
  _funcs.eject_media            = eject_media_win32;
  _funcs.free                   = free_win32;
  _funcs.get_arg                = get_arg_win32;
  _funcs.get_cdtext             = get_cdtext_generic;
  _funcs.get_cdtext_raw         = read_cdtext_generic;
  _funcs.get_default_device     = cdio_get_default_device_win32;
  _funcs.get_devices            = cdio_get_devices_win32;
  _funcs.get_disc_last_lsn      = get_disc_last_lsn_win32;
  _funcs.get_discmode           = get_discmode_win32;
  _funcs.get_drive_cap          = get_drive_cap_mmc;
  _funcs.get_first_track_num    = get_first_track_num_generic;
  _funcs.get_hwinfo             = NULL;
  _funcs.get_media_changed      = get_media_changed_mmc;
  _funcs.get_mcn                = _cdio_get_mcn;
  _funcs.get_num_tracks         = get_num_tracks_generic;
  _funcs.get_track_channels     = get_track_channels_generic,
  _funcs.get_track_copy_permit  = get_track_copy_permit_generic,
  _funcs.get_track_format       = _cdio_get_track_format;
  _funcs.get_track_green        = _cdio_get_track_green;
  _funcs.get_track_lba          = NULL; /* This could be done if need be. */
  _funcs.get_track_msf          = _cdio_get_track_msf;
  _funcs.get_track_preemphasis  = get_track_preemphasis_generic,
  _funcs.lseek                  = NULL;
  _funcs.read                   = NULL;
  _funcs.read_audio_sectors     = read_audio_sectors;
  _funcs.read_data_sectors      = read_data_sectors_win32;
  _funcs.read_mode1_sector      = read_mode1_sector_win32;
  _funcs.read_mode1_sectors     = read_mode1_sectors_win32;
  _funcs.read_mode2_sector      = read_mode2_sector_win32;
  _funcs.read_mode2_sectors     = read_mode2_sectors_win32;
  _funcs.read_toc               = read_toc_win32;
  _funcs.run_mmc_cmd            = run_mmc_cmd_win32;
  _funcs.set_arg                = set_arg_win32;
  _funcs.set_blocksize          = set_blocksize_mmc;
  _funcs.set_speed              = set_drive_speed_mmc;

  _data                 = calloc(1, sizeof (_img_private_t));
  _data->access_mode    = str_to_access_mode_win32(psz_access_mode);
  _data->gen.init       = false;
  _data->gen.fd         = -1;

  if (NULL == psz_orig_source) {
    psz_source=cdio_get_default_device_win32();
    if (NULL == psz_source) return NULL;
    set_arg_win32(_data, "source", psz_source);
    free(psz_source);
  } else {
    if (cdio_is_device_win32(psz_orig_source))
      set_arg_win32(_data, "source", psz_orig_source);
    else {
      /* The below would be okay as an info message if all device
	 drivers worked this way. */
      cdio_debug ("source %s is a not a device", psz_orig_source);
      free(_data);
      return NULL;
    }
  }

  ret = cdio_new ((void *)_data, &_funcs);
  if (ret == NULL) return NULL;

  if (init_win32(_data))
    return ret;
  else {
    free_win32 (_data);
    return NULL;
  }
  
#else 
  return NULL;
#endif /* HAVE_WIN32_CDROM */

}
Пример #2
0
/*!
  Initialization routine. This is the only thing that doesn't
  get called via a function pointer. In fact *we* are the
  ones to set that up.
 */
CdIo *
cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
{

#ifdef HAVE_WIN32_CDROM
  CdIo *ret;
  _img_private_t *_data;
  char *psz_source;

  cdio_funcs_t _funcs;

  memset( &_funcs, 0, sizeof(_funcs) );

  _funcs.eject_media        = _cdio_eject_media;
  _funcs.free               = _free_win32;
  _funcs.get_arg            = _get_arg_win32;
  _funcs.get_cdtext         = get_cdtext_generic;
  _funcs.get_default_device = cdio_get_default_device_win32;
  _funcs.get_devices        = cdio_get_devices_win32;
  _funcs.get_disc_last_lsn     = get_disc_last_lsn_win32;
  _funcs.get_discmode       = get_discmode_win32;
  _funcs.get_drive_cap         = get_drive_cap_mmc;
  _funcs.get_first_track_num= get_first_track_num_generic;
  _funcs.get_hwinfo         = NULL;
  _funcs.get_mcn            = _cdio_get_mcn;
  _funcs.get_num_tracks     = get_num_tracks_generic;
  _funcs.get_track_channels    = get_track_channels_generic,
  _funcs.get_track_copy_permit = get_track_copy_permit_generic,
  _funcs.get_track_format   = _cdio_get_track_format;
  _funcs.get_track_green    = _cdio_get_track_green;
  _funcs.get_track_lba         = NULL; /* This could be done if need be. */
  _funcs.get_track_msf      = _cdio_get_track_msf;
  _funcs.get_track_preemphasis = get_track_preemphasis_generic,
  _funcs.lseek              = NULL;
  _funcs.read               = NULL;
  _funcs.read_audio_sectors = _cdio_read_audio_sectors;
  _funcs.read_mode1_sector  = _cdio_read_mode1_sector;
  _funcs.read_mode1_sectors = _cdio_read_mode1_sectors;
  _funcs.read_mode2_sector  = _cdio_read_mode2_sector;
  _funcs.read_mode2_sectors = _cdio_read_mode2_sectors;
  _funcs.read_toc           = &read_toc_win32;
  _funcs.run_scsi_mmc_cmd   = &run_scsi_cmd_win32;
  _funcs.set_arg            = set_arg_win32;
  _funcs.set_blocksize         = set_blocksize_mmc;
  _funcs.set_speed             = set_speed_mmc;

  _data                 = _cdio_malloc (sizeof (_img_private_t));
  _data->access_mode    = str_to_access_mode_win32(psz_access_mode);
  _data->gen.init       = false;
  _data->gen.fd         = -1;

  if (NULL == psz_orig_source) {
    psz_source=cdio_get_default_device_win32();
    if (NULL == psz_source) return NULL;
    set_arg_win32(_data, "source", psz_source);
    free(psz_source);
  } else {
    if (cdio_is_device_win32(psz_orig_source))
      set_arg_win32(_data, "source", psz_orig_source);
    else {
      /* The below would be okay if all device drivers worked this way. */
#if 0
      cdio_info ("source %s is a not a device", psz_orig_source);
#endif
      free(_data);
      return NULL;
    }
  }

  ret = cdio_new ((void *)_data, &_funcs);
  if (ret == NULL) return NULL;

  if (_cdio_init_win32(_data))
    return ret;
  else {
    _free_win32 (_data);
    return NULL;
  }
  
#else 
  return NULL;
#endif /* HAVE_WIN32_CDROM */

}