On Wed, Nov 02, 2011 at 04:46:13PM -0700, John Stebbins wrote :
> Am I reading this cross-eyed or is this just totally stupid?

This is totally stupid.

Looking closer, the patch evolved during the mess, the original,
attached here, was less stupid, but seems to depend on a non-installed
dvdread header.


-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
--- dvdnav/src/vm/vm.c  2011-11-03 00:56:26.914826478 +0100
+++ dvdnav.new/src/vm/vm.c      2011-11-03 00:55:38.342585613 +0100
@@ -40,6 +40,7 @@
 #include <dvdread/nav_types.h>
 #include <dvdread/ifo_types.h>
 #include <dvdread/ifo_read.h>
+#include <dvdread/dvd_input.h>
 #include "dvdnav/dvdnav.h"
 
 #include "decoder.h"
@@ -167,19 +168,19 @@
      * all off_t are 64bit.
      */
     off_t off;
-    int fd, i;
+    dvd_input_t fd;
+    int i;
     uint8_t data[DVD_VIDEO_LB_LEN];
 
     /* Read DVD name */
-    fd = open(device, O_RDONLY);
+    fd = dvdinput_open(device);
     if (fd > 0) {
-      off = lseek( fd, 32 * (off_t) DVD_VIDEO_LB_LEN, SEEK_SET );
-      if( off == ( 32 * (off_t) DVD_VIDEO_LB_LEN ) ) {
-        off = read( fd, data, DVD_VIDEO_LB_LEN );
-        close(fd);
-        if (off == ( (off_t) DVD_VIDEO_LB_LEN )) {
+      off = dvdinput_seek( fd, 16 );
+      if (off == 16) {
+        off = dvdinput_read( fd, data, 1, DVDINPUT_NOFLAGS );
+        if (off == 1) {
           fprintf(MSG_OUT, "libdvdnav: DVD Title: ");
-          for(i=25; i < 73; i++ ) {
+          for(i=40; i < 73; i++ ) {
             if((data[i] == 0)) break;
             if((data[i] > 32) && (data[i] < 127)) {
               fprintf(MSG_OUT, "%c", data[i]);
@@ -187,10 +188,12 @@
               fprintf(MSG_OUT, " ");
             }
           }
-          strncpy(name, (char*) &data[25], 48);
-          name[48] = 0;
+          strncpy(name, (char*) &data[40], 32);
+          i=31;
+          while( (i>=0) && (name[i] <= ' ')) --i;
+          name[i+1] = '\0';
           fprintf(MSG_OUT, "\nlibdvdnav: DVD Serial Number: ");
-          for(i=73; i < 89; i++ ) {
+          for(i=813; i < 829; i++ ) {
             if((data[i] == 0)) break;
             if((data[i] > 32) && (data[i] < 127)) {
               fprintf(MSG_OUT, "%c", data[i]);
@@ -216,7 +219,7 @@
       } else {
         fprintf(MSG_OUT, "libdvdnav: Can't seek to block %u\n", 32 );
       }
-      close(fd);
+      dvdinput_close(fd);
     } else {
     fprintf(MSG_OUT, "NAME OPEN FAILED\n");
   }
_______________________________________________
DVDnav-discuss mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/dvdnav-discuss

Reply via email to