changeset 23853:565d08e0ee51

Simplify NetBSD vcd_read code
author reimar
date Fri, 27 Jul 2007 16:59:41 +0000
parents 5982ecb1dcdf
children 3522fdbd3d2a
files stream/vcd_read_nbsd.h
diffstat 1 files changed, 6 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/stream/vcd_read_nbsd.h	Fri Jul 27 16:34:52 2007 +0000
+++ b/stream/vcd_read_nbsd.h	Fri Jul 27 16:59:41 2007 +0000
@@ -3,6 +3,7 @@
 #ifdef __NetBSD__
 #include <sys/inttypes.h>
 #endif
+#include "libavutil/intreadwrite.h"
 #include <sys/cdio.h>
 #include <sys/scsiio.h>
 
@@ -155,33 +156,17 @@
   struct scsireq  sc;
   int             lba = vcd_get_msf(vcd);
   int             blocks;
-  int             sector_type;
-  int             sync, header_code, user_data, edc_ecc, error_field;
-  int             sub_channel;
   int             rc;
 
   blocks = 1;
-  sector_type = 5;		/* mode2/form2 */
-  sync = 0;
-  header_code = 0;
-  user_data = 1;
-  edc_ecc = 0;
-  error_field = 0;
-  sub_channel = 0;
 
   memset(&sc, 0, sizeof(sc));
   sc.cmd[0] = 0xBE;
-  sc.cmd[1] = (sector_type) << 2;
-  sc.cmd[2] = (lba >> 24) & 0xff;
-  sc.cmd[3] = (lba >> 16) & 0xff;
-  sc.cmd[4] = (lba >> 8) & 0xff;
-  sc.cmd[5] = lba & 0xff;
-  sc.cmd[6] = (blocks >> 16) & 0xff;
-  sc.cmd[7] = (blocks >> 8) & 0xff;
-  sc.cmd[8] = blocks & 0xff;
-  sc.cmd[9] = (sync << 7) | (header_code << 5) | (user_data << 4) |
-    (edc_ecc << 3) | (error_field << 1);
-  sc.cmd[10] = sub_channel;
+  sc.cmd[1] = 5 << 2; // mode2/form2
+  AV_WB32(&sc.cmd[2], lba);
+  AV_WB24(&sc.cmd[6], blocks);
+  sc.cmd[9] = 1 << 4; // user data only
+  sc.cmd[10] = 0;     // no subchannel
   sc.cmdlen = 12;
   sc.databuf = (caddr_t) mem;
   sc.datalen = 2328;