1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 16:33:02 +00:00

READ_TOC for making *BSD code more similar

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23876 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-07-27 17:18:03 +00:00
parent 3fd0d78c63
commit f82f6553f3
2 changed files with 8 additions and 6 deletions

View File

@ -4,6 +4,7 @@
//=================== VideoCD ========================== //=================== VideoCD ==========================
#define CDROM_LEADOUT 0xAA #define CDROM_LEADOUT 0xAA
#define TOCADDR(te) ((te).entry.addr) #define TOCADDR(te) ((te).entry.addr)
#define READ_TOC CDIOREADTOCENTRY
typedef struct { typedef struct {
uint8_t sync [12]; uint8_t sync [12];
@ -56,7 +57,7 @@ vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
{ {
vcd->entry.address_format = CD_MSF_FORMAT; vcd->entry.address_format = CD_MSF_FORMAT;
vcd->entry.track = track; vcd->entry.track = track;
if (ioctl(vcd->fd, CDIOREADTOCENTRY, &vcd->entry)) { if (ioctl(vcd->fd, READ_TOC, &vcd->entry)) {
mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno)); mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno));
return -1; return -1;
} }
@ -73,7 +74,7 @@ vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
} }
vcd->entry.address_format = CD_MSF_FORMAT; vcd->entry.address_format = CD_MSF_FORMAT;
vcd->entry.track = track<tochdr.ending_track?(track+1):CDROM_LEADOUT; vcd->entry.track = track<tochdr.ending_track?(track+1):CDROM_LEADOUT;
if (ioctl(vcd->fd, CDIOREADTOCENTRY, &vcd->entry)) { if (ioctl(vcd->fd, READ_TOC, &vcd->entry)) {
mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno)); mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno));
return -1; return -1;
} }
@ -98,7 +99,7 @@ vcd_read_toc(int fd)
tocentry.track = i<=tochdr.ending_track ? i : CDROM_LEADOUT; tocentry.track = i<=tochdr.ending_track ? i : CDROM_LEADOUT;
tocentry.address_format = CD_MSF_FORMAT; tocentry.address_format = CD_MSF_FORMAT;
if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) { if (ioctl(fd, READ_TOC, &tocentry) == -1) {
mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno));
return NULL; return NULL;
} }

View File

@ -7,6 +7,7 @@
#define CDROM_LEADOUT 0xAA #define CDROM_LEADOUT 0xAA
#define TOCADDR(te) ((te).data->addr) #define TOCADDR(te) ((te).data->addr)
#define READ_TOC CDIOREADTOCENTRYS
typedef struct mp_vcd_priv_st { typedef struct mp_vcd_priv_st {
int fd; int fd;
@ -56,7 +57,7 @@ vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
vcd->entry.starting_track = track; vcd->entry.starting_track = track;
vcd->entry.data_len = sizeof(struct cd_toc_entry); vcd->entry.data_len = sizeof(struct cd_toc_entry);
vcd->entry.data = &vcd->entry_data; vcd->entry.data = &vcd->entry_data;
if (ioctl(vcd->fd, CDIOREADTOCENTRIES, &vcd->entry)) { if (ioctl(vcd->fd, READ_TOC, &vcd->entry)) {
mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno)); mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno));
return -1; return -1;
} }
@ -75,7 +76,7 @@ vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
vcd->entry.starting_track = track < tochdr.ending_track ? (track + 1) : CDROM_LEADOUT; vcd->entry.starting_track = track < tochdr.ending_track ? (track + 1) : CDROM_LEADOUT;
vcd->entry.data_len = sizeof(struct cd_toc_entry); vcd->entry.data_len = sizeof(struct cd_toc_entry);
vcd->entry.data = &vcd->entry_data; vcd->entry.data = &vcd->entry_data;
if (ioctl(vcd->fd, CDIOREADTOCENTRYS, &vcd->entry)) { if (ioctl(vcd->fd, READ_TOC, &vcd->entry)) {
mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno)); mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno));
return -1; return -1;
} }
@ -103,7 +104,7 @@ vcd_read_toc(int fd)
tocentry.data_len = sizeof(struct cd_toc_entry); tocentry.data_len = sizeof(struct cd_toc_entry);
tocentry.data = &tocentry_data; tocentry.data = &tocentry_data;
if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { if (ioctl(fd, READ_TOC, &tocentry) == -1) {
mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno));
return NULL; return NULL;
} }