[DVDnav-discuss] r1167 - in trunk/libdvdnav/src: dvdnav.c dvdnav/dvdnav.h vm/vm.c vm/vm.h

nicodvb subversion at mplayerhq.hu
Mon Feb 2 23:55:58 CET 2009


Author: nicodvb
Date: Mon Feb  2 23:55:58 2009
New Revision: 1167

Log:
implement and export dvdnav_get_serial_string(); patch by Matthew Wire devel - mrwire - co - uk. Fixed by Erik

Modified:
   trunk/libdvdnav/src/dvdnav.c
   trunk/libdvdnav/src/dvdnav/dvdnav.h
   trunk/libdvdnav/src/vm/vm.c
   trunk/libdvdnav/src/vm/vm.h

Modified: trunk/libdvdnav/src/dvdnav.c
==============================================================================
--- trunk/libdvdnav/src/dvdnav.c	Mon Jan 12 13:10:32 2009	(r1166)
+++ trunk/libdvdnav/src/dvdnav.c	Mon Feb  2 23:55:58 2009	(r1167)
@@ -825,6 +825,11 @@ dvdnav_status_t dvdnav_get_title_string(
   return DVDNAV_STATUS_OK;
 }
 
+dvdnav_status_t dvdnav_get_serial_string(dvdnav_t *this, const char **serial_str) {
+  (*serial_str) = this->vm->dvd_serial;
+  return DVDNAV_STATUS_OK;
+}
+
 uint8_t dvdnav_get_video_aspect(dvdnav_t *this) {
   uint8_t         retval;
 

Modified: trunk/libdvdnav/src/dvdnav/dvdnav.h
==============================================================================
--- trunk/libdvdnav/src/dvdnav/dvdnav.h	Mon Jan 12 13:10:32 2009	(r1166)
+++ trunk/libdvdnav/src/dvdnav/dvdnav.h	Mon Feb  2 23:55:58 2009	(r1167)
@@ -537,6 +537,13 @@ dvdnav_status_t dvdnav_spu_language_sele
 dvdnav_status_t dvdnav_get_title_string(dvdnav_t *self, const char **title_str);
 
 /*
+ * Returns a string containing the serial number of the DVD.
+ * This has a max of 15 characters and should be more unique than the
+ * title string.
+ */
+dvdnav_status_t dvdnav_get_serial_string(dvdnav_t *self, const char **serial_str);
+
+/*
  * Get video aspect code.
  * The aspect code does only change on VTS boundaries.
  * See the DVDNAV_VTS_CHANGE event.

Modified: trunk/libdvdnav/src/vm/vm.c
==============================================================================
--- trunk/libdvdnav/src/vm/vm.c	Mon Jan 12 13:10:32 2009	(r1166)
+++ trunk/libdvdnav/src/vm/vm.c	Mon Feb  2 23:55:58 2009	(r1167)
@@ -156,7 +156,7 @@ static int os2_open(const char *name, in
 }
 #endif
 
-static void dvd_read_name(char *name, const char *device) {
+static void dvd_read_name(char *name, char *serial, const char *device) {
     /* Because we are compiling with _FILE_OFFSET_BITS=64
      * all off_t are 64bit.
      */
@@ -192,6 +192,8 @@ static void dvd_read_name(char *name, co
               fprintf(MSG_OUT, " ");
             }
           }
+          strncpy(serial, (char*) &data[73], (i-73));
+          serial[14] = 0;
           fprintf(MSG_OUT, "\nlibdvdnav: DVD Title (Alternative): ");
           for(i=89; i < 128; i++ ) {
             if((data[i] == 0)) break;
@@ -352,7 +354,7 @@ int vm_reset(vm_t *vm, const char *dvdro
       fprintf(MSG_OUT, "libdvdnav: vm: failed to open/read the DVD\n");
       return 0;
     }
-    dvd_read_name(vm->dvd_name, dvdroot);
+    dvd_read_name(vm->dvd_name, vm->dvd_serial, dvdroot);
     vm->map  = remap_loadmap(vm->dvd_name);
     vm->vmgi = ifoOpenVMGI(vm->dvd);
     if(!vm->vmgi) {

Modified: trunk/libdvdnav/src/vm/vm.h
==============================================================================
--- trunk/libdvdnav/src/vm/vm.h	Mon Jan 12 13:10:32 2009	(r1166)
+++ trunk/libdvdnav/src/vm/vm.h	Mon Feb  2 23:55:58 2009	(r1167)
@@ -82,6 +82,7 @@ typedef struct {
   dvd_state_t   state;
   int32_t       hop_channel;
   char          dvd_name[50];
+  char          dvd_serial[15];
   remap_t      *map;
   int           stopped;
 } vm_t;



More information about the DVDnav-discuss mailing list