[MPlayer-dev-eng] [Patch 2/2] dvd_set_speed fixes/addons

Sebastian Kemper sebastian_ml at gmx.net
Fri Nov 16 21:38:53 CET 2007


Hi!

This patch adds some lines to reflect possible noise from the sg driver.
The ioctl() will only error (return -1) during the first sg stage (that
is up to and including the point where the driver issues the command to
the drive). The next two stages (basically sense and data transfer)
aren't checked by mplayer currently.
This is also based on sg_simple2.c.

I don't really know if this is of interest to you.
Again, sorry for the printf()'s ;-)

Regards
Sebastian
-------------- next part --------------
diff -Nur mplayer.new/stream/stream_dvd.c mplayer.new_new/stream/stream_dvd.c
--- mplayer.new/stream/stream_dvd.c	2007-11-16 20:44:55.000000000 +0100
+++ mplayer.new_new/stream/stream_dvd.c	2007-11-16 20:57:27.000000000 +0100
@@ -45,10 +45,10 @@
 static void dvd_set_speed(char *device, int speed)
 {
 #if defined(__linux__) && defined(SG_IO) && defined(GPCMD_SET_STREAMING)
-  int fd;
+  int fd, k;
   unsigned char buffer[28];
   unsigned char cmd[12];
-  unsigned char sense[16];
+  unsigned char sense[32];
   struct sg_io_hdr sghdr;
   struct stat st;
 
@@ -127,7 +127,27 @@
     close(fd);
     return;
   }
-  mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDlimitOk);
+
+  /* now for the error processing */
+  if ((sghdr.info & SG_INFO_OK_MASK) != SG_INFO_OK) {
+    if (sghdr.sb_len_wr > 0) {
+      printf("SET STREAMING sense data: ");
+      for (k = 0; k < sghdr.sb_len_wr; ++k) {
+        if ((k > 0) && (0 == (k % 10)))
+          printf("\n  ");
+        printf("0x%02x ", sense[k]);
+      }
+      printf("\n");
+    }
+    if (sghdr.masked_status)
+      printf("SET STREAMING SCSI status=0x%x\n", sghdr.status);
+    if (sghdr.host_status)
+      printf("SET STREAMING host_status=0x%x\n", sghdr.host_status);
+    if (sghdr.driver_status)
+      printf("SET STREAMING driver_status=0x%x\n", sghdr.driver_status);
+  }
+  else
+    mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDlimitOk);
   close(fd);
 #endif
 }


More information about the MPlayer-dev-eng mailing list