/* * Private stuff */ static CdIo_t * open_cd (xmms_xform_t *xform) { CdIo_t *cdio; xmms_config_property_t *val; const gchar *device; const gchar *accessmode; cdio_log_set_handler (log_handler); val = xmms_xform_config_lookup (xform, "device"); device = xmms_config_property_get_string (val); val = xmms_xform_config_lookup (xform, "accessmode"); accessmode = xmms_config_property_get_string (val); XMMS_DBG ("Trying to open device '%s', using '%s' access mode.", device, accessmode); if (g_ascii_strcasecmp (accessmode, "default") == 0) { cdio = cdio_open (device, DRIVER_UNKNOWN); } else { cdio = cdio_open_am (device, DRIVER_UNKNOWN, accessmode); } if (!cdio) { xmms_log_error ("Failed to open device '%s'.", device); } else { cdio_set_speed (cdio, 1); xmms_log_info ("Opened device '%s'.", device); } return cdio; }
int main(int argc, const char *argv[]) { CdIo_t *p_cdio; char **ppsz_drives=NULL; cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO; /* snprintf(psz_nrgfile, sizeof(psz_nrgfile)-1, "%s/%s", TEST_DIR, cue_file[i]); */ if (!cdio_have_driver(DRIVER_FREEBSD)) return(77); p_cdio = cdio_open_am (NULL, DRIVER_UNKNOWN, NULL); if (p_cdio) { const char *psz_access_mode = cdio_get_arg(p_cdio, "access-mode"); if (0 != strncmp(psz_access_mode, "ioctl", strlen("ioctl")) && 0 != strncmp(psz_access_mode, "CAM", strlen("CAM"))) { fprintf(stderr, "Got %s; Should get back ioctl or CAM.\n", psz_access_mode); exit(2); } } cdio_destroy(p_cdio); ppsz_drives = cdio_get_devices(DRIVER_DEVICE); if (!ppsz_drives) { printf("Can't find a CD-ROM drive. Skipping test.\n"); exit(77); } p_cdio = cdio_open_freebsd(ppsz_drives[0]); if (p_cdio) { const char *psz_source = cdio_get_arg(p_cdio, "source"); if (0 != strncmp(psz_source, ppsz_drives[0], strlen(ppsz_drives[0]))) { fprintf(stderr, "Got %s; should get back %s, the name we opened.\n", psz_source, ppsz_drives[0]); exit(1); } } cdio_free_device_list(ppsz_drives); return 0; }