Mercurial > libdvdnav.hg
changeset 397:a70f79850e5f src
implement and export dvdnav_get_serial_string(); patch by Matthew Wire devel - mrwire - co - uk. Fixed by Erik
author | nicodvb |
---|---|
date | Mon, 02 Feb 2009 22:55:58 +0000 |
parents | 6616c485ece0 |
children | ec2408d48b85 |
files | dvdnav.c dvdnav/dvdnav.h vm/vm.c vm/vm.h |
diffstat | 4 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/dvdnav.c Mon Jan 12 12:10:32 2009 +0000 +++ b/dvdnav.c Mon Feb 02 22:55:58 2009 +0000 @@ -825,6 +825,11 @@ 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;
--- a/dvdnav/dvdnav.h Mon Jan 12 12:10:32 2009 +0000 +++ b/dvdnav/dvdnav.h Mon Feb 02 22:55:58 2009 +0000 @@ -537,6 +537,13 @@ 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.
--- a/vm/vm.c Mon Jan 12 12:10:32 2009 +0000 +++ b/vm/vm.c Mon Feb 02 22:55:58 2009 +0000 @@ -156,7 +156,7 @@ } #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 @@ 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 @@ 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) {