Subject: Fixing VideoCD playback in MPlayer
To: None <tech-pkg@netbsd.org>
From: Sergey Svishchev <svs@ropnet.ru>
List: tech-pkg
Date: 07/01/2006 20:56:48
--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Good day,

a) The code does not account for a 150-sector offset in LBA <-> MSF
conversion routines.  Suprisingly, some discs will play correctly;=20
others will be played without video.

b) The error field of struct scsireq is, as far I could tell from the
kernel sources, unused and may contain random data.  For the purposes of
MPlayer, the data returned by ioctl(SCIOCCOMMAND) are usable only if a
SCCMD_OK is returned in retsts field.

I'm going to submit those patches to mplayer development list soon.  Commen=
ts?

--- 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=20
 vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect)
 {
+  sect +=3D 150;
   vcd->entry_data.addr.msf.frame =3D sect % 75;
   sect =3D sect / 75;
   vcd->entry_data.addr.msf.second =3D sect % 60;
@@ -41,7 +42,7 @@ vcd_inc_msf(mp_vcd_priv_t* vcd)
 static inline unsigned int=20
 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 !=3D 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);

--=20
Sergey Svishchev

--ew6BAiZeqk4r7MaW
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Comment: ''

iD8DBQFEpqlQ3P+wmuUns7URAsVcAJ0WUGyMR6WbmuBOwORow8HRQh/ymwCgmOzt
4bu5hp28K4bkooX0PJR3ezI=
=04yw
-----END PGP SIGNATURE-----

--ew6BAiZeqk4r7MaW--