[MPlayer-dev-eng] [PATCH] NetBSD vcd fix, from bugzilla #751

Roberto Togni rxt at rtogni.it
Sat May 19 14:18:22 CEST 2007


Hi all,
 this patch is from bugzilla, but I have no clue about vcd on NetBSD.
Can someone look at it?

%%%%%%%%

http://bugzilla.mplayerhq.hu/show_bug.cgi?id=751

NetBSD-specific code in 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.

--- stream/vcd_read_nbsd.h.orig	2006-06-11 18:35:46.000000000
+0000 +++ stream/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);


Ciao,
 Roberto



More information about the MPlayer-dev-eng mailing list