aboutsummaryrefslogtreecommitdiffhomepage
path: root/stream
diff options
context:
space:
mode:
authorGravatar ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-17 15:24:40 +0000
committerGravatar ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-17 15:24:40 +0000
commitfdd52f2f9345af567428ba18668eb12d7e278a9b (patch)
tree579a505b0d61d191fadaa49055d6b0b754d7fa1b /stream
parentcc840ba8b262d880757a08961b2ea18eb61336f9 (diff)
Caching toc header in vcd private structure for later use.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25439 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r--stream/vcd_read.h9
-rw-r--r--stream/vcd_read_fbsd.h9
2 files changed, 6 insertions, 12 deletions
diff --git a/stream/vcd_read.h b/stream/vcd_read.h
index 9d2765aa5a..587a783f19 100644
--- a/stream/vcd_read.h
+++ b/stream/vcd_read.h
@@ -17,6 +17,7 @@ struct mp_vcd_priv_st {
int fd;
struct cdrom_tocentry entry;
char buf[VCD_SECTOR_SIZE];
+ struct cdrom_tochdr tochdr;
};
static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect){
@@ -45,13 +46,8 @@ int vcd_seek_to_track(mp_vcd_priv_t* vcd,int track){
}
int vcd_get_track_end(mp_vcd_priv_t* vcd,int track){
- struct cdrom_tochdr tochdr;
- if (ioctl(vcd->fd,CDROMREADTOCHDR,&tochdr)==-1) {
- mp_msg(MSGT_STREAM,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno));
- return -1;
- }
vcd->entry.cdte_format = CDROM_MSF;
- vcd->entry.cdte_track = track<tochdr.cdth_trk1?(track+1):CDROM_LEADOUT;
+ vcd->entry.cdte_track = track<vcd->tochdr.cdth_trk1?(track+1):CDROM_LEADOUT;
if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) {
mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno));
return -1;
@@ -118,6 +114,7 @@ mp_vcd_priv_t* vcd_read_toc(int fd){
}
vcd = malloc(sizeof(mp_vcd_priv_t));
vcd->fd = fd;
+ vcd->tochdr = tochdr;
return vcd;
}
diff --git a/stream/vcd_read_fbsd.h b/stream/vcd_read_fbsd.h
index 47d583643d..96cc23a858 100644
--- a/stream/vcd_read_fbsd.h
+++ b/stream/vcd_read_fbsd.h
@@ -40,6 +40,7 @@ typedef struct mp_vcd_priv_st {
#else
cdsector_t buf;
#endif
+ struct ioc_toc_header tochdr;
} mp_vcd_priv_t;
static inline void
@@ -120,13 +121,8 @@ vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
int
vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
{
- struct ioc_toc_header tochdr;
- if (ioctl(vcd->fd, CDIOREADTOCHEADER, &tochdr) == -1) {
- mp_msg(MSGT_STREAM,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno));
- return -1;
- }
if (!read_toc_entry(vcd,
- track < tochdr.ending_track ? track + 1 : CDROM_LEADOUT))
+ track < vcd->tochdr.ending_track ? track + 1 : CDROM_LEADOUT))
return -1;
return VCD_SECTOR_DATA * vcd_get_msf(vcd);
}
@@ -145,6 +141,7 @@ vcd_read_toc(int fd)
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", tochdr.ending_track);
vcd = malloc(sizeof(mp_vcd_priv_t));
vcd->fd = fd;
+ vcd->tochdr = tochdr;
for (i = tochdr.starting_track; i <= tochdr.ending_track + 1; i++) {
if (!read_toc_entry(vcd,
i <= tochdr.ending_track ? i : CDROM_LEADOUT)) {