# HG changeset patch # User ib # Date 1385992383 0 # Node ID 3a192d8ecc5632e6df27ba6fb0a17187cdb75935 # Parent 9893f5323b22a9dcf7b523324ab2df8d783ae275 Revise and fix stream control for VCD. A VCD's stream->priv is a pointer of type mp_vcd_priv_t and not one of type stream_priv_s. Add a struct member 'track' to mp_vcd_priv_t to store the track information there. diff -r 9893f5323b22 -r 3a192d8ecc56 stream/stream_vcd.c --- a/stream/stream_vcd.c Sun Dec 01 04:17:02 2013 +0000 +++ b/stream/stream_vcd.c Mon Dec 02 13:53:03 2013 +0000 @@ -90,14 +90,13 @@ } static int control(stream_t *stream, int cmd, void *arg) { - struct stream_priv_s *p = stream->priv; + mp_vcd_priv_t *vcd = stream->priv; switch(cmd) { case STREAM_CTRL_GET_NUM_TITLES: case STREAM_CTRL_GET_NUM_CHAPTERS: { - mp_vcd_priv_t *vcd = vcd_read_toc(stream->fd); if (!vcd) - break; + return STREAM_ERROR; *(unsigned int *)arg = vcd_end_track(vcd); return STREAM_OK; } @@ -105,19 +104,18 @@ { int r; unsigned int track = *(unsigned int *)arg + 1; - mp_vcd_priv_t *vcd = vcd_read_toc(stream->fd); if (!vcd) - break; + return STREAM_ERROR; r = vcd_seek_to_track(vcd, track); if (r >= 0) { - p->track = track; + vcd->track = track; return STREAM_OK; } break; } case STREAM_CTRL_GET_CURRENT_CHAPTER: { - *(unsigned int *)arg = p->track - 1; + *(unsigned int *)arg = vcd->track - 1; return STREAM_OK; } } @@ -227,6 +225,8 @@ } #endif + vcd->track = p->track; + stream->fd = f; stream->type = STREAMTYPE_VCD; stream->sector_size = VCD_SECTOR_DATA; diff -r 9893f5323b22 -r 3a192d8ecc56 stream/vcd_read.h --- a/stream/vcd_read.h Sun Dec 01 04:17:02 2013 +0000 +++ b/stream/vcd_read.h Mon Dec 02 13:53:03 2013 +0000 @@ -44,6 +44,7 @@ struct cdrom_tocentry entry; char buf[VCD_SECTOR_SIZE]; struct cdrom_tochdr tochdr; + unsigned int track; }; static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect){ diff -r 9893f5323b22 -r 3a192d8ecc56 stream/vcd_read_darwin.h --- a/stream/vcd_read_darwin.h Sun Dec 01 04:17:02 2013 +0000 +++ b/stream/vcd_read_darwin.h Mon Dec 02 13:53:03 2013 +0000 @@ -55,6 +55,7 @@ dk_cd_read_track_info_t entry; struct CDDiscInfo hdr; CDMSF msf; + unsigned int track; } mp_vcd_priv_t; static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect) diff -r 9893f5323b22 -r 3a192d8ecc56 stream/vcd_read_fbsd.h --- a/stream/vcd_read_fbsd.h Sun Dec 01 04:17:02 2013 +0000 +++ b/stream/vcd_read_fbsd.h Mon Dec 02 13:53:03 2013 +0000 @@ -67,6 +67,7 @@ cdsector_t buf; #endif struct ioc_toc_header tochdr; + unsigned int track; } mp_vcd_priv_t; static inline void diff -r 9893f5323b22 -r 3a192d8ecc56 stream/vcd_read_os2.h --- a/stream/vcd_read_os2.h Sun Dec 01 04:17:02 2013 +0000 +++ b/stream/vcd_read_os2.h Mon Dec 02 13:53:03 2013 +0000 @@ -39,6 +39,7 @@ int iLastTrack; struct msf msfLeadOut; BYTE abVCDSector[VCD_SECTOR_SIZE]; + unsigned int track; } mp_vcd_priv_t; static inline void vcd_set_msf(mp_vcd_priv_t *vcd, unsigned sect) diff -r 9893f5323b22 -r 3a192d8ecc56 stream/vcd_read_win32.h --- a/stream/vcd_read_win32.h Sun Dec 01 04:17:02 2013 +0000 +++ b/stream/vcd_read_win32.h Mon Dec 02 13:53:03 2013 +0000 @@ -38,6 +38,7 @@ CDROM_TOC toc; unsigned sect; char buf[VCD_SECTOR_SIZE]; + unsigned int track; }; static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned sect)