[MPlayer-dev-eng] Fixing VideoCD playback in NetBSD

Sergey Svishchev svs at ropnet.ru
Wed Jul 5 22:31:13 CEST 2006


Good day,

NetBSD-specific code (vcd_read_nbsd.h) has problems:

a) Sector address conversion routines do not take into account
150-sector offset (MSF address 0:0.0 is LBA -150); thus, wrong locations
on disc are read.  Usual failure mode: the disc will be played without
video; surprisingly, some discs will still play correctly.

b) The "error" field of struct scsireq is unused by NetBSD kernel and
may contain random data.

Please review these patches.  I've applied them to 1.0pre8 and verified
that troublesome VCDs now play OK on my NetBSD/i386-current machine.

--- libmpdemux/vcd_read_nbsd.h.orig	2006-06-11 18:35:46.000000000 +0000
+++ libmpdemux/vcd_read_nbsd.h
@@ -17,6 +17,7 @@ typedef struct mp_vcd_priv_st {
static inline void 
vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect)
{
+  sect += 150;
   vcd->entry_data.addr.msf.frame = sect % 75;
   sect = sect / 75;
   vcd->entry_data.addr.msf.second = sect % 60;
@@ -41,7 +42,7 @@ vcd_inc_msf(mp_vcd_priv_t* vcd)
static inline unsigned int 
vcd_get_msf(mp_vcd_priv_t* vcd)
{
-  return vcd->entry_data.addr.msf.frame +
+  return (-150) + vcd->entry_data.addr.msf.frame +
   (vcd->entry_data.addr.msf.second +
    vcd->entry_data.addr.msf.minute * 60) * 75;
}
@@ -188,9 +189,9 @@ vcd_read(mp_vcd_priv_t* vcd, char *mem)
     mp_msg(MSGT_STREAM,MSGL_ERR,"SCIOCCOMMAND: %s\n",strerror(errno));
     return -1;
   }
-  if (sc.retsts || sc.error) {
-    mp_msg(MSGT_STREAM,MSGL_ERR,"scsi command failed: status %d error %d\n",
-	   sc.retsts,sc.error);
+  if (sc.retsts != SCCMD_OK) {
+    mp_msg(MSGT_STREAM,MSGL_ERR,"scsi command failed: retsts %d status %d\n",
+      sc.retsts,sc.status);
     return -1;
   }
   vcd_inc_msf(vcd);

-- 
Sergey Svishchev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 167 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20060706/db968ccd/attachment.pgp>


More information about the MPlayer-dev-eng mailing list