comparison vm.c @ 138:5ce26c18c455 src

dvd_read_name can be static and does not need the whole vm_t*
author mroi
date Sat, 29 Mar 2003 12:21:15 +0000
parents 5897ff629f7c
children 19a31f4f57cb
comparison
equal deleted inserted replaced
137:15e239caef8f 138:5ce26c18c455
119 (vm->state).TTN_REG, 119 (vm->state).TTN_REG,
120 (vm->state).TT_PGCN_REG); 120 (vm->state).TT_PGCN_REG);
121 } 121 }
122 #endif 122 #endif
123 123
124 void dvd_read_name( vm_t *this, const char *devname) { 124 static void dvd_read_name(char *name, const char *device) {
125 int fd, i; 125 int fd, i;
126 #ifndef __FreeBSD__ 126 #ifndef __FreeBSD__
127 off64_t off; 127 off64_t off;
128 #else 128 #else
129 off_t off; 129 off_t off;
130 #endif 130 #endif
131 uint8_t data[DVD_VIDEO_LB_LEN]; 131 uint8_t data[DVD_VIDEO_LB_LEN];
132 132
133 /* Read DVD name */ 133 /* Read DVD name */
134 fd=open(devname, O_RDONLY); 134 fd=open(device, O_RDONLY);
135 if (fd > 0) { 135 if (fd > 0) {
136 off = lseek64( fd, 32 * (int64_t) DVD_VIDEO_LB_LEN, SEEK_SET ); 136 off = lseek64( fd, 32 * (int64_t) DVD_VIDEO_LB_LEN, SEEK_SET );
137 if( off == ( 32 * (int64_t) DVD_VIDEO_LB_LEN ) ) { 137 if( off == ( 32 * (int64_t) DVD_VIDEO_LB_LEN ) ) {
138 off = read( fd, data, DVD_VIDEO_LB_LEN ); 138 off = read( fd, data, DVD_VIDEO_LB_LEN );
139 close(fd); 139 close(fd);
145 fprintf(MSG_OUT, "%c", data[i]); 145 fprintf(MSG_OUT, "%c", data[i]);
146 } else { 146 } else {
147 fprintf(MSG_OUT, " "); 147 fprintf(MSG_OUT, " ");
148 } 148 }
149 } 149 }
150 strncpy(&this->dvd_name[0], &data[25], 48); 150 strncpy(name, &data[25], 48);
151 this->dvd_name[48]=0; 151 name[48] = 0;
152 fprintf(MSG_OUT, "\nlibdvdnav: DVD Serial Number: "); 152 fprintf(MSG_OUT, "\nlibdvdnav: DVD Serial Number: ");
153 for(i=73; i < 89; i++ ) { 153 for(i=73; i < 89; i++ ) {
154 if((data[i] == 0)) break; 154 if((data[i] == 0)) break;
155 if((data[i] > 32) && (data[i] < 127)) { 155 if((data[i] > 32) && (data[i] < 127)) {
156 fprintf(MSG_OUT, "%c", data[i]); 156 fprintf(MSG_OUT, "%c", data[i]);
313 vm->dvd = DVDOpen(dvdroot); 313 vm->dvd = DVDOpen(dvdroot);
314 if(!vm->dvd) { 314 if(!vm->dvd) {
315 fprintf(MSG_OUT, "libdvdnav: vm: faild to open/read the DVD\n"); 315 fprintf(MSG_OUT, "libdvdnav: vm: faild to open/read the DVD\n");
316 return 0; 316 return 0;
317 } 317 }
318 dvd_read_name(vm, dvdroot); 318 dvd_read_name(vm->dvd_name, dvdroot);
319 vm->map = remap_loadmap(vm->dvd_name); 319 vm->map = remap_loadmap(vm->dvd_name);
320 vm->vmgi = ifoOpenVMGI(vm->dvd); 320 vm->vmgi = ifoOpenVMGI(vm->dvd);
321 if(!vm->vmgi) { 321 if(!vm->vmgi) {
322 fprintf(MSG_OUT, "libdvdnav: vm: faild to read VIDEO_TS.IFO\n"); 322 fprintf(MSG_OUT, "libdvdnav: vm: faild to read VIDEO_TS.IFO\n");
323 return 0; 323 return 0;
1806 #endif 1806 #endif
1807 1807
1808 1808
1809 /* 1809 /*
1810 * $Log$ 1810 * $Log$
1811 * Revision 1.50 2003/03/29 12:21:15 mroi
1812 * dvd_read_name can be static and does not need the whole vm_t*
1813 *
1811 * Revision 1.49 2003/03/27 15:12:22 mroi 1814 * Revision 1.49 2003/03/27 15:12:22 mroi
1812 * reorganize mutual header inclusion to fix warnings when compiling with TRACE defined 1815 * reorganize mutual header inclusion to fix warnings when compiling with TRACE defined
1813 * fix vm_jump_title_part to use correct title number (up to now the number was 1816 * fix vm_jump_title_part to use correct title number (up to now the number was
1814 * considered to be VTS-relative, which it is not) 1817 * considered to be VTS-relative, which it is not)
1815 * 1818 *