mirror of
https://github.com/WinampDesktop/winamp.git
synced 2024-12-12 13:31:01 -05:00
109 lines
2.8 KiB
C
109 lines
2.8 KiB
C
|
/* --------------------------------------------------------------------------
|
||
|
|
||
|
MusicBrainz -- The Internet music metadatabase
|
||
|
|
||
|
Copyright (C) 2009 Shunsuke Kuroda
|
||
|
Copyright (C) 2006 Matthias Friedrich
|
||
|
Copyright (C) 2000 Robert Kaye
|
||
|
Copyright (C) 1999 Marc E E van Woerkom
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Lesser General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2.1 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Lesser General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Lesser General Public
|
||
|
License along with this library; if not, write to the Free Software
|
||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||
|
02110-1301 USA
|
||
|
|
||
|
--------------------------------------------------------------------------- */
|
||
|
#include <stdlib.h>
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
#include <fcntl.h>
|
||
|
#include <assert.h>
|
||
|
#include <unistd.h>
|
||
|
#include <sys/types.h>
|
||
|
#include <sys/stat.h>
|
||
|
#include <sys/ioctl.h>
|
||
|
#include <sys/cdio.h>
|
||
|
|
||
|
|
||
|
#include "discid/discid.h"
|
||
|
#include "discid/discid_private.h"
|
||
|
#include "unix.h"
|
||
|
|
||
|
#define NUM_CANDIDATES 2
|
||
|
|
||
|
static char *device_candidates[NUM_CANDIDATES] = {"/vol/dev/aliases/cdrom0",
|
||
|
"/volumes/dev/aliases/cdrom0"};
|
||
|
|
||
|
int mb_disc_unix_read_toc_header(int fd, mb_disc_toc *toc) {
|
||
|
struct cdrom_tochdr th;
|
||
|
|
||
|
int ret = ioctl(fd, CDROMREADTOCHDR, &th);
|
||
|
|
||
|
if ( ret < 0 )
|
||
|
return ret; /* error */
|
||
|
|
||
|
toc->first_track_num = th.cdth_trk0;
|
||
|
toc->last_track_num = th.cdth_trk1;
|
||
|
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
|
||
|
int mb_disc_unix_read_toc_entry(int fd, int track_num, mb_disc_toc_track *track) {
|
||
|
struct cdrom_tocentry te;
|
||
|
int ret;
|
||
|
|
||
|
memset(&te, 0, sizeof te);
|
||
|
te.cdte_track = track_num;
|
||
|
te.cdte_format = CDROM_LBA;
|
||
|
|
||
|
ret = ioctl(fd, CDROMREADTOCENTRY, &te);
|
||
|
|
||
|
if ( ret < 0 )
|
||
|
return 0; /* error */
|
||
|
|
||
|
assert( te.cdte_format == CDROM_LBA );
|
||
|
track->address = te.cdte_addr.lba;
|
||
|
track->control = te.cdte_ctrl;
|
||
|
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
void mb_disc_unix_read_mcn(int fd, mb_disc_private *disc) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
void mb_disc_unix_read_isrc(int fd, mb_disc_private *disc, int track_num) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
char *mb_disc_get_default_device_unportable(void) {
|
||
|
return mb_disc_unix_find_device(device_candidates, NUM_CANDIDATES);
|
||
|
}
|
||
|
|
||
|
int mb_disc_has_feature_unportable(enum discid_feature feature) {
|
||
|
switch(feature) {
|
||
|
case DISCID_FEATURE_READ:
|
||
|
return 1;
|
||
|
default:
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int mb_disc_read_unportable(mb_disc_private *disc, const char *device,
|
||
|
unsigned int features) {
|
||
|
return mb_disc_unix_read(disc, device, features);
|
||
|
}
|
||
|
|
||
|
/* EOF */
|