[MPlayer-cvslog] r23940 - trunk/stream/vcd_read.h

reimar subversion at mplayerhq.hu
Mon Jul 30 17:53:50 CEST 2007


Author: reimar
Date: Mon Jul 30 17:53:50 2007
New Revision: 23940

Log:
Simplify sun SCSI command generation


Modified:
   trunk/stream/vcd_read.h

Modified: trunk/stream/vcd_read.h
==============================================================================
--- trunk/stream/vcd_read.h	(original)
+++ trunk/stream/vcd_read.h	Mon Jul 30 17:53:50 2007
@@ -1,3 +1,4 @@
+#include "libavutil/intreadwrite.h"
 //=================== VideoCD ==========================
 #if	defined(linux) || defined(sun) || defined(__bsdi__)
 
@@ -185,36 +186,15 @@ static int sun_vcd_read(mp_vcd_priv_t* v
   union scsi_cdb cdb;
   int lba = vcd_get_msf(vcd);
   int blocks = 1;
-  int sector_type;
-  int sync, header_code, user_data, edc_ecc, error_field;
-  int sub_channel;
-
-  /* sector_type = 3; *//* mode2 */
-  sector_type = 5;	/* mode2/form2 */
-  sync = 0;
-  header_code = 0;
-  user_data = 1;
-  edc_ecc = 0;
-  error_field = 0;
-  sub_channel = 0;
 
   memset(&cdb, 0, sizeof(cdb));
   memset(&sc, 0, sizeof(sc));
   cdb.scc_cmd = 0xBE;
-  cdb.cdb_opaque[1] = (sector_type) << 2;
-  cdb.cdb_opaque[2] = (lba >> 24) & 0xff;
-  cdb.cdb_opaque[3] = (lba >> 16) & 0xff;
-  cdb.cdb_opaque[4] = (lba >>  8) & 0xff;
-  cdb.cdb_opaque[5] =  lba & 0xff;
-  cdb.cdb_opaque[6] = (blocks >> 16) & 0xff;
-  cdb.cdb_opaque[7] = (blocks >>  8) & 0xff;
-  cdb.cdb_opaque[8] =  blocks & 0xff;
-  cdb.cdb_opaque[9] = (sync << 7) |
-		      (header_code << 5) |
-		      (user_data << 4) |
-		      (edc_ecc << 3) |
-		      (error_field << 1);
-  cdb.cdb_opaque[10] = sub_channel;
+  cdb.cdb_opaque[1] = 5 << 2; // mode2 / form2
+  AV_WB32(&cdb.cdb_opaque[2], lba);
+  AV_WB24(&cdb.cdb_opaque[6], blocks);
+  cdb.cdb_opaque[9] = 1 << 4; // user data only
+  cdb.cdb_opaque[10] = 0;     // subchannel
 
   sc.uscsi_cdb = (caddr_t)&cdb;
   sc.uscsi_cdblen = 12;



More information about the MPlayer-cvslog mailing list