Mercurial > mplayer.hg
comparison libmpdvdkit2/ifo_read.c @ 18879:cc65a585fdcc
rm unnecesary casts from void* - part 3
author | reynaldo |
---|---|
date | Sun, 02 Jul 2006 08:17:07 +0000 |
parents | e1d6fbd607e0 |
children |
comparison
equal
deleted
inserted
replaced
18878:3bf0d70b4c7f | 18879:cc65a585fdcc |
---|---|
95 | 95 |
96 | 96 |
97 ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) { | 97 ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) { |
98 ifo_handle_t *ifofile; | 98 ifo_handle_t *ifofile; |
99 | 99 |
100 ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); | 100 ifofile = malloc(sizeof(ifo_handle_t)); |
101 if(!ifofile) | 101 if(!ifofile) |
102 return 0; | 102 return 0; |
103 | 103 |
104 memset(ifofile, 0, sizeof(ifo_handle_t)); | 104 memset(ifofile, 0, sizeof(ifo_handle_t)); |
105 | 105 |
180 | 180 |
181 | 181 |
182 ifo_handle_t *ifoOpenVMGI(dvd_reader_t *dvd) { | 182 ifo_handle_t *ifoOpenVMGI(dvd_reader_t *dvd) { |
183 ifo_handle_t *ifofile; | 183 ifo_handle_t *ifofile; |
184 | 184 |
185 ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); | 185 ifofile = malloc(sizeof(ifo_handle_t)); |
186 if(!ifofile) | 186 if(!ifofile) |
187 return 0; | 187 return 0; |
188 | 188 |
189 memset(ifofile, 0, sizeof(ifo_handle_t)); | 189 memset(ifofile, 0, sizeof(ifo_handle_t)); |
190 | 190 |
207 | 207 |
208 | 208 |
209 ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) { | 209 ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) { |
210 ifo_handle_t *ifofile; | 210 ifo_handle_t *ifofile; |
211 | 211 |
212 ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); | 212 ifofile = malloc(sizeof(ifo_handle_t)); |
213 if(!ifofile) | 213 if(!ifofile) |
214 return 0; | 214 return 0; |
215 | 215 |
216 memset(ifofile, 0, sizeof(ifo_handle_t)); | 216 memset(ifofile, 0, sizeof(ifo_handle_t)); |
217 | 217 |
272 | 272 |
273 | 273 |
274 static int ifoRead_VMG(ifo_handle_t *ifofile) { | 274 static int ifoRead_VMG(ifo_handle_t *ifofile) { |
275 vmgi_mat_t *vmgi_mat; | 275 vmgi_mat_t *vmgi_mat; |
276 | 276 |
277 vmgi_mat = (vmgi_mat_t *)malloc(sizeof(vmgi_mat_t)); | 277 vmgi_mat = malloc(sizeof(vmgi_mat_t)); |
278 if(!vmgi_mat) | 278 if(!vmgi_mat) |
279 return 0; | 279 return 0; |
280 | 280 |
281 ifofile->vmgi_mat = vmgi_mat; | 281 ifofile->vmgi_mat = vmgi_mat; |
282 | 282 |
363 | 363 |
364 static int ifoRead_VTS(ifo_handle_t *ifofile) { | 364 static int ifoRead_VTS(ifo_handle_t *ifofile) { |
365 vtsi_mat_t *vtsi_mat; | 365 vtsi_mat_t *vtsi_mat; |
366 int i; | 366 int i; |
367 | 367 |
368 vtsi_mat = (vtsi_mat_t *)malloc(sizeof(vtsi_mat_t)); | 368 vtsi_mat = malloc(sizeof(vtsi_mat_t)); |
369 if(!vtsi_mat) | 369 if(!vtsi_mat) |
370 return 0; | 370 return 0; |
371 | 371 |
372 ifofile->vtsi_mat = vtsi_mat; | 372 ifofile->vtsi_mat = vtsi_mat; |
373 | 373 |
491 | 491 |
492 CHECK_VALUE(cmd_tbl->nr_of_pre + cmd_tbl->nr_of_post + cmd_tbl->nr_of_cell<= 255); | 492 CHECK_VALUE(cmd_tbl->nr_of_pre + cmd_tbl->nr_of_post + cmd_tbl->nr_of_cell<= 255); |
493 | 493 |
494 if(cmd_tbl->nr_of_pre != 0) { | 494 if(cmd_tbl->nr_of_pre != 0) { |
495 unsigned int pre_cmds_size = cmd_tbl->nr_of_pre * COMMAND_DATA_SIZE; | 495 unsigned int pre_cmds_size = cmd_tbl->nr_of_pre * COMMAND_DATA_SIZE; |
496 cmd_tbl->pre_cmds = (vm_cmd_t *)malloc(pre_cmds_size); | 496 cmd_tbl->pre_cmds = malloc(pre_cmds_size); |
497 if(!cmd_tbl->pre_cmds) | 497 if(!cmd_tbl->pre_cmds) |
498 return 0; | 498 return 0; |
499 | 499 |
500 if(!(DVDReadBytes(ifofile->file, cmd_tbl->pre_cmds, pre_cmds_size))) { | 500 if(!(DVDReadBytes(ifofile->file, cmd_tbl->pre_cmds, pre_cmds_size))) { |
501 free(cmd_tbl->pre_cmds); | 501 free(cmd_tbl->pre_cmds); |
503 } | 503 } |
504 } | 504 } |
505 | 505 |
506 if(cmd_tbl->nr_of_post != 0) { | 506 if(cmd_tbl->nr_of_post != 0) { |
507 unsigned int post_cmds_size = cmd_tbl->nr_of_post * COMMAND_DATA_SIZE; | 507 unsigned int post_cmds_size = cmd_tbl->nr_of_post * COMMAND_DATA_SIZE; |
508 cmd_tbl->post_cmds = (vm_cmd_t *)malloc(post_cmds_size); | 508 cmd_tbl->post_cmds = malloc(post_cmds_size); |
509 if(!cmd_tbl->post_cmds) { | 509 if(!cmd_tbl->post_cmds) { |
510 if(cmd_tbl->pre_cmds) | 510 if(cmd_tbl->pre_cmds) |
511 free(cmd_tbl->pre_cmds); | 511 free(cmd_tbl->pre_cmds); |
512 return 0; | 512 return 0; |
513 } | 513 } |
519 } | 519 } |
520 } | 520 } |
521 | 521 |
522 if(cmd_tbl->nr_of_cell != 0) { | 522 if(cmd_tbl->nr_of_cell != 0) { |
523 unsigned int cell_cmds_size = cmd_tbl->nr_of_cell * COMMAND_DATA_SIZE; | 523 unsigned int cell_cmds_size = cmd_tbl->nr_of_cell * COMMAND_DATA_SIZE; |
524 cmd_tbl->cell_cmds = (vm_cmd_t *)malloc(cell_cmds_size); | 524 cmd_tbl->cell_cmds = malloc(cell_cmds_size); |
525 if(!cmd_tbl->cell_cmds) { | 525 if(!cmd_tbl->cell_cmds) { |
526 if(cmd_tbl->pre_cmds) | 526 if(cmd_tbl->pre_cmds) |
527 free(cmd_tbl->pre_cmds); | 527 free(cmd_tbl->pre_cmds); |
528 if(cmd_tbl->post_cmds) | 528 if(cmd_tbl->post_cmds) |
529 free(cmd_tbl->post_cmds); | 529 free(cmd_tbl->post_cmds); |
746 /* It seems that first_play_pgc is optional after all. */ | 746 /* It seems that first_play_pgc is optional after all. */ |
747 ifofile->first_play_pgc = 0; | 747 ifofile->first_play_pgc = 0; |
748 if(ifofile->vmgi_mat->first_play_pgc == 0) | 748 if(ifofile->vmgi_mat->first_play_pgc == 0) |
749 return 1; | 749 return 1; |
750 | 750 |
751 ifofile->first_play_pgc = (pgc_t *)malloc(sizeof(pgc_t)); | 751 ifofile->first_play_pgc = malloc(sizeof(pgc_t)); |
752 if(!ifofile->first_play_pgc) | 752 if(!ifofile->first_play_pgc) |
753 return 0; | 753 return 0; |
754 | 754 |
755 if(!ifoRead_PGC(ifofile, ifofile->first_play_pgc, | 755 if(!ifoRead_PGC(ifofile, ifofile->first_play_pgc, |
756 ifofile->vmgi_mat->first_play_pgc)) { | 756 ifofile->vmgi_mat->first_play_pgc)) { |
800 return 0; | 800 return 0; |
801 | 801 |
802 if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->tt_srpt * DVD_BLOCK_LEN)) | 802 if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->tt_srpt * DVD_BLOCK_LEN)) |
803 return 0; | 803 return 0; |
804 | 804 |
805 tt_srpt = (tt_srpt_t *)malloc(sizeof(tt_srpt_t)); | 805 tt_srpt = malloc(sizeof(tt_srpt_t)); |
806 if(!tt_srpt) | 806 if(!tt_srpt) |
807 return 0; | 807 return 0; |
808 | 808 |
809 ifofile->tt_srpt = tt_srpt; | 809 ifofile->tt_srpt = tt_srpt; |
810 | 810 |
817 B2N_16(tt_srpt->nr_of_srpts); | 817 B2N_16(tt_srpt->nr_of_srpts); |
818 B2N_32(tt_srpt->last_byte); | 818 B2N_32(tt_srpt->last_byte); |
819 | 819 |
820 info_length = tt_srpt->last_byte + 1 - TT_SRPT_SIZE; | 820 info_length = tt_srpt->last_byte + 1 - TT_SRPT_SIZE; |
821 | 821 |
822 tt_srpt->title = (title_info_t *)malloc(info_length); | 822 tt_srpt->title = malloc(info_length); |
823 if(!tt_srpt->title) { | 823 if(!tt_srpt->title) { |
824 free(tt_srpt); | 824 free(tt_srpt); |
825 ifofile->tt_srpt = 0; | 825 ifofile->tt_srpt = 0; |
826 return 0; | 826 return 0; |
827 } | 827 } |
902 | 902 |
903 if(!DVDFileSeek_(ifofile->file, | 903 if(!DVDFileSeek_(ifofile->file, |
904 ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN)) | 904 ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN)) |
905 return 0; | 905 return 0; |
906 | 906 |
907 vts_ptt_srpt = (vts_ptt_srpt_t *)malloc(sizeof(vts_ptt_srpt_t)); | 907 vts_ptt_srpt = malloc(sizeof(vts_ptt_srpt_t)); |
908 if(!vts_ptt_srpt) | 908 if(!vts_ptt_srpt) |
909 return 0; | 909 return 0; |
910 | 910 |
911 ifofile->vts_ptt_srpt = vts_ptt_srpt; | 911 ifofile->vts_ptt_srpt = vts_ptt_srpt; |
912 | 912 |
923 CHECK_VALUE(vts_ptt_srpt->nr_of_srpts != 0); | 923 CHECK_VALUE(vts_ptt_srpt->nr_of_srpts != 0); |
924 CHECK_VALUE(vts_ptt_srpt->nr_of_srpts < 100); // ?? | 924 CHECK_VALUE(vts_ptt_srpt->nr_of_srpts < 100); // ?? |
925 | 925 |
926 info_length = vts_ptt_srpt->last_byte + 1 - VTS_PTT_SRPT_SIZE; | 926 info_length = vts_ptt_srpt->last_byte + 1 - VTS_PTT_SRPT_SIZE; |
927 | 927 |
928 data = (uint32_t *)malloc(info_length); | 928 data = malloc(info_length); |
929 if(!data) { | 929 if(!data) { |
930 free(vts_ptt_srpt); | 930 free(vts_ptt_srpt); |
931 ifofile->vts_ptt_srpt = 0; | 931 ifofile->vts_ptt_srpt = 0; |
932 return 0; | 932 return 0; |
933 } | 933 } |
1041 return 1; | 1041 return 1; |
1042 | 1042 |
1043 if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN)) | 1043 if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN)) |
1044 return 0; | 1044 return 0; |
1045 | 1045 |
1046 ptl_mait = (ptl_mait_t *)malloc(sizeof(ptl_mait_t)); | 1046 ptl_mait = malloc(sizeof(ptl_mait_t)); |
1047 if(!ptl_mait) | 1047 if(!ptl_mait) |
1048 return 0; | 1048 return 0; |
1049 | 1049 |
1050 ifofile->ptl_mait = ptl_mait; | 1050 ifofile->ptl_mait = ptl_mait; |
1051 | 1051 |
1065 CHECK_VALUE(ptl_mait->nr_of_vtss < 100); // ?? | 1065 CHECK_VALUE(ptl_mait->nr_of_vtss < 100); // ?? |
1066 CHECK_VALUE(ptl_mait->nr_of_countries * PTL_MAIT_COUNTRY_SIZE | 1066 CHECK_VALUE(ptl_mait->nr_of_countries * PTL_MAIT_COUNTRY_SIZE |
1067 <= ptl_mait->last_byte + 1 - PTL_MAIT_SIZE); | 1067 <= ptl_mait->last_byte + 1 - PTL_MAIT_SIZE); |
1068 | 1068 |
1069 info_length = ptl_mait->nr_of_countries * sizeof(ptl_mait_country_t); | 1069 info_length = ptl_mait->nr_of_countries * sizeof(ptl_mait_country_t); |
1070 ptl_mait->countries = (ptl_mait_country_t *)malloc(info_length); | 1070 ptl_mait->countries = malloc(info_length); |
1071 if(!ptl_mait->countries) { | 1071 if(!ptl_mait->countries) { |
1072 free(ptl_mait); | 1072 free(ptl_mait); |
1073 ifofile->ptl_mait = 0; | 1073 ifofile->ptl_mait = 0; |
1074 return 0; | 1074 return 0; |
1075 } | 1075 } |
1106 free(ptl_mait->countries); | 1106 free(ptl_mait->countries); |
1107 free(ptl_mait); | 1107 free(ptl_mait); |
1108 return 0; | 1108 return 0; |
1109 } | 1109 } |
1110 info_length = (ptl_mait->nr_of_vtss + 1) * sizeof(pf_level_t); | 1110 info_length = (ptl_mait->nr_of_vtss + 1) * sizeof(pf_level_t); |
1111 pf_temp = (uint16_t *)malloc(info_length); | 1111 pf_temp = malloc(info_length); |
1112 if(!pf_temp) { | 1112 if(!pf_temp) { |
1113 for(j = 0; j < i ; j++) { | 1113 for(j = 0; j < i ; j++) { |
1114 free(ptl_mait->countries[j].pf_ptl_mai); | 1114 free(ptl_mait->countries[j].pf_ptl_mai); |
1115 } | 1115 } |
1116 free(ptl_mait->countries); | 1116 free(ptl_mait->countries); |
1128 return 0; | 1128 return 0; |
1129 } | 1129 } |
1130 for (j = 0; j < ((ptl_mait->nr_of_vtss + 1) * 8); j++) { | 1130 for (j = 0; j < ((ptl_mait->nr_of_vtss + 1) * 8); j++) { |
1131 B2N_16(pf_temp[j]); | 1131 B2N_16(pf_temp[j]); |
1132 } | 1132 } |
1133 ptl_mait->countries[i].pf_ptl_mai = (pf_level_t *)malloc(info_length); | 1133 ptl_mait->countries[i].pf_ptl_mai = malloc(info_length); |
1134 if(!ptl_mait->countries[i].pf_ptl_mai) { | 1134 if(!ptl_mait->countries[i].pf_ptl_mai) { |
1135 free(pf_temp); | 1135 free(pf_temp); |
1136 for(j = 0; j < i ; j++) { | 1136 for(j = 0; j < i ; j++) { |
1137 free(ptl_mait->countries[j].pf_ptl_mai); | 1137 free(ptl_mait->countries[j].pf_ptl_mai); |
1138 } | 1138 } |
1192 offset = ifofile->vtsi_mat->vts_tmapt * DVD_BLOCK_LEN; | 1192 offset = ifofile->vtsi_mat->vts_tmapt * DVD_BLOCK_LEN; |
1193 | 1193 |
1194 if(!DVDFileSeek_(ifofile->file, offset)) | 1194 if(!DVDFileSeek_(ifofile->file, offset)) |
1195 return 0; | 1195 return 0; |
1196 | 1196 |
1197 vts_tmapt = (vts_tmapt_t *)malloc(sizeof(vts_tmapt_t)); | 1197 vts_tmapt = malloc(sizeof(vts_tmapt_t)); |
1198 if(!vts_tmapt) | 1198 if(!vts_tmapt) |
1199 return 0; | 1199 return 0; |
1200 | 1200 |
1201 ifofile->vts_tmapt = vts_tmapt; | 1201 ifofile->vts_tmapt = vts_tmapt; |
1202 | 1202 |
1212 | 1212 |
1213 CHECK_ZERO(vts_tmapt->zero_1); | 1213 CHECK_ZERO(vts_tmapt->zero_1); |
1214 | 1214 |
1215 info_length = vts_tmapt->nr_of_tmaps * 4; | 1215 info_length = vts_tmapt->nr_of_tmaps * 4; |
1216 | 1216 |
1217 vts_tmap_srp = (uint32_t *)malloc(info_length); | 1217 vts_tmap_srp = malloc(info_length); |
1218 if(!vts_tmap_srp) { | 1218 if(!vts_tmap_srp) { |
1219 free(vts_tmapt); | 1219 free(vts_tmapt); |
1220 ifofile->vts_tmapt = NULL; | 1220 ifofile->vts_tmapt = NULL; |
1221 return 0; | 1221 return 0; |
1222 } | 1222 } |
1236 } | 1236 } |
1237 | 1237 |
1238 | 1238 |
1239 info_length = vts_tmapt->nr_of_tmaps * sizeof(vts_tmap_t); | 1239 info_length = vts_tmapt->nr_of_tmaps * sizeof(vts_tmap_t); |
1240 | 1240 |
1241 vts_tmapt->tmap = (vts_tmap_t *)malloc(info_length); | 1241 vts_tmapt->tmap = malloc(info_length); |
1242 if(!vts_tmapt->tmap) { | 1242 if(!vts_tmapt->tmap) { |
1243 free(vts_tmap_srp); | 1243 free(vts_tmap_srp); |
1244 free(vts_tmapt); | 1244 free(vts_tmapt); |
1245 ifofile->vts_tmapt = NULL; | 1245 ifofile->vts_tmapt = NULL; |
1246 return 0; | 1246 return 0; |
1268 continue; | 1268 continue; |
1269 } | 1269 } |
1270 | 1270 |
1271 info_length = vts_tmapt->tmap[i].nr_of_entries * sizeof(map_ent_t); | 1271 info_length = vts_tmapt->tmap[i].nr_of_entries * sizeof(map_ent_t); |
1272 | 1272 |
1273 vts_tmapt->tmap[i].map_ent = (map_ent_t *)malloc(info_length); | 1273 vts_tmapt->tmap[i].map_ent = malloc(info_length); |
1274 if(!vts_tmapt->tmap[i].map_ent) { | 1274 if(!vts_tmapt->tmap[i].map_ent) { |
1275 ifoFree_VTS_TMAPT(ifofile); | 1275 ifoFree_VTS_TMAPT(ifofile); |
1276 return 0; | 1276 return 0; |
1277 } | 1277 } |
1278 | 1278 |
1316 return 0; | 1316 return 0; |
1317 | 1317 |
1318 if(ifofile->vtsi_mat->vts_c_adt == 0) /* mandatory */ | 1318 if(ifofile->vtsi_mat->vts_c_adt == 0) /* mandatory */ |
1319 return 0; | 1319 return 0; |
1320 | 1320 |
1321 ifofile->vts_c_adt = (c_adt_t *)malloc(sizeof(c_adt_t)); | 1321 ifofile->vts_c_adt = malloc(sizeof(c_adt_t)); |
1322 if(!ifofile->vts_c_adt) | 1322 if(!ifofile->vts_c_adt) |
1323 return 0; | 1323 return 0; |
1324 | 1324 |
1325 if(!ifoRead_C_ADT_internal(ifofile, ifofile->vts_c_adt, | 1325 if(!ifoRead_C_ADT_internal(ifofile, ifofile->vts_c_adt, |
1326 ifofile->vtsi_mat->vts_c_adt)) { | 1326 ifofile->vtsi_mat->vts_c_adt)) { |
1348 sector = ifofile->vtsi_mat->vtsm_c_adt; | 1348 sector = ifofile->vtsi_mat->vtsm_c_adt; |
1349 } else { | 1349 } else { |
1350 return 0; | 1350 return 0; |
1351 } | 1351 } |
1352 | 1352 |
1353 ifofile->menu_c_adt = (c_adt_t *)malloc(sizeof(c_adt_t)); | 1353 ifofile->menu_c_adt = malloc(sizeof(c_adt_t)); |
1354 if(!ifofile->menu_c_adt) | 1354 if(!ifofile->menu_c_adt) |
1355 return 0; | 1355 return 0; |
1356 | 1356 |
1357 if(!ifoRead_C_ADT_internal(ifofile, ifofile->menu_c_adt, sector)) { | 1357 if(!ifoRead_C_ADT_internal(ifofile, ifofile->menu_c_adt, sector)) { |
1358 free(ifofile->menu_c_adt); | 1358 free(ifofile->menu_c_adt); |
1390 if(info_length / sizeof(cell_adr_t) < c_adt->nr_of_vobs) { | 1390 if(info_length / sizeof(cell_adr_t) < c_adt->nr_of_vobs) { |
1391 fprintf(stderr, "libdvdread: *C_ADT nr_of_vobs > avaiable info entries\n"); | 1391 fprintf(stderr, "libdvdread: *C_ADT nr_of_vobs > avaiable info entries\n"); |
1392 c_adt->nr_of_vobs = info_length / sizeof(cell_adr_t); | 1392 c_adt->nr_of_vobs = info_length / sizeof(cell_adr_t); |
1393 } | 1393 } |
1394 | 1394 |
1395 c_adt->cell_adr_table = (cell_adr_t *)malloc(info_length); | 1395 c_adt->cell_adr_table = malloc(info_length); |
1396 if(!c_adt->cell_adr_table) | 1396 if(!c_adt->cell_adr_table) |
1397 return 0; | 1397 return 0; |
1398 | 1398 |
1399 if(info_length && | 1399 if(info_length && |
1400 !(DVDReadBytes(ifofile->file, c_adt->cell_adr_table, info_length))) { | 1400 !(DVDReadBytes(ifofile->file, c_adt->cell_adr_table, info_length))) { |
1450 return 0; | 1450 return 0; |
1451 | 1451 |
1452 if(ifofile->vtsi_mat->vts_vobu_admap == 0) /* mandatory */ | 1452 if(ifofile->vtsi_mat->vts_vobu_admap == 0) /* mandatory */ |
1453 return 0; | 1453 return 0; |
1454 | 1454 |
1455 ifofile->vts_vobu_admap = (vobu_admap_t *)malloc(sizeof(vobu_admap_t)); | 1455 ifofile->vts_vobu_admap = malloc(sizeof(vobu_admap_t)); |
1456 if(!ifofile->vts_vobu_admap) | 1456 if(!ifofile->vts_vobu_admap) |
1457 return 0; | 1457 return 0; |
1458 | 1458 |
1459 if(!ifoRead_VOBU_ADMAP_internal(ifofile, ifofile->vts_vobu_admap, | 1459 if(!ifoRead_VOBU_ADMAP_internal(ifofile, ifofile->vts_vobu_admap, |
1460 ifofile->vtsi_mat->vts_vobu_admap)) { | 1460 ifofile->vtsi_mat->vts_vobu_admap)) { |
1482 sector = ifofile->vtsi_mat->vtsm_vobu_admap; | 1482 sector = ifofile->vtsi_mat->vtsm_vobu_admap; |
1483 } else { | 1483 } else { |
1484 return 0; | 1484 return 0; |
1485 } | 1485 } |
1486 | 1486 |
1487 ifofile->menu_vobu_admap = (vobu_admap_t *)malloc(sizeof(vobu_admap_t)); | 1487 ifofile->menu_vobu_admap = malloc(sizeof(vobu_admap_t)); |
1488 if(!ifofile->menu_vobu_admap) | 1488 if(!ifofile->menu_vobu_admap) |
1489 return 0; | 1489 return 0; |
1490 | 1490 |
1491 if(!ifoRead_VOBU_ADMAP_internal(ifofile, ifofile->menu_vobu_admap, sector)) { | 1491 if(!ifoRead_VOBU_ADMAP_internal(ifofile, ifofile->menu_vobu_admap, sector)) { |
1492 free(ifofile->menu_vobu_admap); | 1492 free(ifofile->menu_vobu_admap); |
1515 /* assert(info_length > 0); | 1515 /* assert(info_length > 0); |
1516 Magic Knight Rayearth Daybreak is mastered very strange and has | 1516 Magic Knight Rayearth Daybreak is mastered very strange and has |
1517 Titles with a VOBS that has no VOBUs. */ | 1517 Titles with a VOBS that has no VOBUs. */ |
1518 CHECK_VALUE(info_length % sizeof(uint32_t) == 0); | 1518 CHECK_VALUE(info_length % sizeof(uint32_t) == 0); |
1519 | 1519 |
1520 vobu_admap->vobu_start_sectors = (uint32_t *)malloc(info_length); | 1520 vobu_admap->vobu_start_sectors = malloc(info_length); |
1521 if(!vobu_admap->vobu_start_sectors) { | 1521 if(!vobu_admap->vobu_start_sectors) { |
1522 return 0; | 1522 return 0; |
1523 } | 1523 } |
1524 if(info_length && | 1524 if(info_length && |
1525 !(DVDReadBytes(ifofile->file, | 1525 !(DVDReadBytes(ifofile->file, |
1567 return 0; | 1567 return 0; |
1568 | 1568 |
1569 if(ifofile->vtsi_mat->vts_pgcit == 0) /* mandatory */ | 1569 if(ifofile->vtsi_mat->vts_pgcit == 0) /* mandatory */ |
1570 return 0; | 1570 return 0; |
1571 | 1571 |
1572 ifofile->vts_pgcit = (pgcit_t *)malloc(sizeof(pgcit_t)); | 1572 ifofile->vts_pgcit = malloc(sizeof(pgcit_t)); |
1573 if(!ifofile->vts_pgcit) | 1573 if(!ifofile->vts_pgcit) |
1574 return 0; | 1574 return 0; |
1575 | 1575 |
1576 if(!ifoRead_PGCIT_internal(ifofile, ifofile->vts_pgcit, | 1576 if(!ifoRead_PGCIT_internal(ifofile, ifofile->vts_pgcit, |
1577 ifofile->vtsi_mat->vts_pgcit * DVD_BLOCK_LEN)) { | 1577 ifofile->vtsi_mat->vts_pgcit * DVD_BLOCK_LEN)) { |
1697 sector = ifofile->vtsi_mat->vtsm_pgci_ut; | 1697 sector = ifofile->vtsi_mat->vtsm_pgci_ut; |
1698 } else { | 1698 } else { |
1699 return 0; | 1699 return 0; |
1700 } | 1700 } |
1701 | 1701 |
1702 ifofile->pgci_ut = (pgci_ut_t *)malloc(sizeof(pgci_ut_t)); | 1702 ifofile->pgci_ut = malloc(sizeof(pgci_ut_t)); |
1703 if(!ifofile->pgci_ut) | 1703 if(!ifofile->pgci_ut) |
1704 return 0; | 1704 return 0; |
1705 | 1705 |
1706 if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN)) { | 1706 if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN)) { |
1707 free(ifofile->pgci_ut); | 1707 free(ifofile->pgci_ut); |
1887 | 1887 |
1888 sector = ifofile->vmgi_mat->vts_atrt; | 1888 sector = ifofile->vmgi_mat->vts_atrt; |
1889 if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN)) | 1889 if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN)) |
1890 return 0; | 1890 return 0; |
1891 | 1891 |
1892 vts_atrt = (vts_atrt_t *)malloc(sizeof(vts_atrt_t)); | 1892 vts_atrt = malloc(sizeof(vts_atrt_t)); |
1893 if(!vts_atrt) | 1893 if(!vts_atrt) |
1894 return 0; | 1894 return 0; |
1895 | 1895 |
1896 ifofile->vts_atrt = vts_atrt; | 1896 ifofile->vts_atrt = vts_atrt; |
1897 | 1897 |
1909 CHECK_VALUE(vts_atrt->nr_of_vtss < 100); //?? | 1909 CHECK_VALUE(vts_atrt->nr_of_vtss < 100); //?? |
1910 CHECK_VALUE((uint32_t)vts_atrt->nr_of_vtss * (4 + VTS_ATTRIBUTES_MIN_SIZE) + | 1910 CHECK_VALUE((uint32_t)vts_atrt->nr_of_vtss * (4 + VTS_ATTRIBUTES_MIN_SIZE) + |
1911 VTS_ATRT_SIZE < vts_atrt->last_byte + 1); | 1911 VTS_ATRT_SIZE < vts_atrt->last_byte + 1); |
1912 | 1912 |
1913 info_length = vts_atrt->nr_of_vtss * sizeof(uint32_t); | 1913 info_length = vts_atrt->nr_of_vtss * sizeof(uint32_t); |
1914 data = (uint32_t *)malloc(info_length); | 1914 data = malloc(info_length); |
1915 if(!data) { | 1915 if(!data) { |
1916 free(vts_atrt); | 1916 free(vts_atrt); |
1917 ifofile->vts_atrt = 0; | 1917 ifofile->vts_atrt = 0; |
1918 return 0; | 1918 return 0; |
1919 } | 1919 } |
1931 B2N_32(data[i]); | 1931 B2N_32(data[i]); |
1932 CHECK_VALUE(data[i] + VTS_ATTRIBUTES_MIN_SIZE < vts_atrt->last_byte + 1); | 1932 CHECK_VALUE(data[i] + VTS_ATTRIBUTES_MIN_SIZE < vts_atrt->last_byte + 1); |
1933 } | 1933 } |
1934 | 1934 |
1935 info_length = vts_atrt->nr_of_vtss * sizeof(vts_attributes_t); | 1935 info_length = vts_atrt->nr_of_vtss * sizeof(vts_attributes_t); |
1936 vts_atrt->vts = (vts_attributes_t *)malloc(info_length); | 1936 vts_atrt->vts = malloc(info_length); |
1937 if(!vts_atrt->vts) { | 1937 if(!vts_atrt->vts) { |
1938 free(data); | 1938 free(data); |
1939 free(vts_atrt); | 1939 free(vts_atrt); |
1940 ifofile->vts_atrt = 0; | 1940 ifofile->vts_atrt = 0; |
1941 return 0; | 1941 return 0; |
1987 | 1987 |
1988 if(!DVDFileSeek_(ifofile->file, | 1988 if(!DVDFileSeek_(ifofile->file, |
1989 ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN)) | 1989 ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN)) |
1990 return 0; | 1990 return 0; |
1991 | 1991 |
1992 txtdt_mgi = (txtdt_mgi_t *)malloc(sizeof(txtdt_mgi_t)); | 1992 txtdt_mgi = malloc(sizeof(txtdt_mgi_t)); |
1993 if(!txtdt_mgi) { | 1993 if(!txtdt_mgi) { |
1994 return 0; | 1994 return 0; |
1995 } | 1995 } |
1996 ifofile->txtdt_mgi = txtdt_mgi; | 1996 ifofile->txtdt_mgi = txtdt_mgi; |
1997 | 1997 |