Mercurial > mplayer.hg
comparison stream/vcd_read_nbsd.h @ 23856:07d30c4c81b8
READ_TOC for making *BSD code more similar
author | reimar |
---|---|
date | Fri, 27 Jul 2007 17:18:03 +0000 |
parents | 3522fdbd3d2a |
children |
comparison
equal
deleted
inserted
replaced
23855:30c690e359c2 | 23856:07d30c4c81b8 |
---|---|
5 #include <sys/cdio.h> | 5 #include <sys/cdio.h> |
6 #include <sys/scsiio.h> | 6 #include <sys/scsiio.h> |
7 | 7 |
8 #define CDROM_LEADOUT 0xAA | 8 #define CDROM_LEADOUT 0xAA |
9 #define TOCADDR(te) ((te).data->addr) | 9 #define TOCADDR(te) ((te).data->addr) |
10 #define READ_TOC CDIOREADTOCENTRYS | |
10 | 11 |
11 typedef struct mp_vcd_priv_st { | 12 typedef struct mp_vcd_priv_st { |
12 int fd; | 13 int fd; |
13 struct ioc_read_toc_entry entry; | 14 struct ioc_read_toc_entry entry; |
14 struct cd_toc_entry entry_data; | 15 struct cd_toc_entry entry_data; |
54 { | 55 { |
55 vcd->entry.address_format = CD_MSF_FORMAT; | 56 vcd->entry.address_format = CD_MSF_FORMAT; |
56 vcd->entry.starting_track = track; | 57 vcd->entry.starting_track = track; |
57 vcd->entry.data_len = sizeof(struct cd_toc_entry); | 58 vcd->entry.data_len = sizeof(struct cd_toc_entry); |
58 vcd->entry.data = &vcd->entry_data; | 59 vcd->entry.data = &vcd->entry_data; |
59 if (ioctl(vcd->fd, CDIOREADTOCENTRIES, &vcd->entry)) { | 60 if (ioctl(vcd->fd, READ_TOC, &vcd->entry)) { |
60 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno)); | 61 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno)); |
61 return -1; | 62 return -1; |
62 } | 63 } |
63 return VCD_SECTOR_DATA * vcd_get_msf(vcd); | 64 return VCD_SECTOR_DATA * vcd_get_msf(vcd); |
64 } | 65 } |
73 } | 74 } |
74 vcd->entry.address_format = CD_MSF_FORMAT; | 75 vcd->entry.address_format = CD_MSF_FORMAT; |
75 vcd->entry.starting_track = track < tochdr.ending_track ? (track + 1) : CDROM_LEADOUT; | 76 vcd->entry.starting_track = track < tochdr.ending_track ? (track + 1) : CDROM_LEADOUT; |
76 vcd->entry.data_len = sizeof(struct cd_toc_entry); | 77 vcd->entry.data_len = sizeof(struct cd_toc_entry); |
77 vcd->entry.data = &vcd->entry_data; | 78 vcd->entry.data = &vcd->entry_data; |
78 if (ioctl(vcd->fd, CDIOREADTOCENTRYS, &vcd->entry)) { | 79 if (ioctl(vcd->fd, READ_TOC, &vcd->entry)) { |
79 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno)); | 80 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno)); |
80 return -1; | 81 return -1; |
81 } | 82 } |
82 return VCD_SECTOR_DATA * vcd_get_msf(vcd); | 83 return VCD_SECTOR_DATA * vcd_get_msf(vcd); |
83 } | 84 } |
101 tocentry.starting_track = i<=tochdr.ending_track ? i : CDROM_LEADOUT; | 102 tocentry.starting_track = i<=tochdr.ending_track ? i : CDROM_LEADOUT; |
102 tocentry.address_format = CD_MSF_FORMAT; | 103 tocentry.address_format = CD_MSF_FORMAT; |
103 tocentry.data_len = sizeof(struct cd_toc_entry); | 104 tocentry.data_len = sizeof(struct cd_toc_entry); |
104 tocentry.data = &tocentry_data; | 105 tocentry.data = &tocentry_data; |
105 | 106 |
106 if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { | 107 if (ioctl(fd, READ_TOC, &tocentry) == -1) { |
107 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); | 108 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); |
108 return NULL; | 109 return NULL; |
109 } | 110 } |
110 | 111 |
111 if (i <= tochdr.ending_track) | 112 if (i <= tochdr.ending_track) |