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

Sergey Svishchev svs+mplayer at grep.ru
Sun Sep 10 17:33:59 CEST 2006


Good day,

NetBSD-specific code (stream/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 3.0.1 machine.

-- 
Sergey Svishchev
-------------- next part --------------
Index: stream/vcd_read_nbsd.h
===================================================================
--- stream/vcd_read_nbsd.h	(revision 19789)
+++ stream/vcd_read_nbsd.h	(working copy)
@@ -17,6 +17,7 @@
 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 @@
 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 @@
     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);
-------------- 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/20060910/a728b076/attachment.pgp>


More information about the MPlayer-dev-eng mailing list