[libdvdnav-devel] [Git][videolan/libdvdread][master] 4 commits: Provide compatibility with media having incomplete TT_SRPT and PTT_SRPT
Jean-Baptiste Kempf
gitlab at videolan.org
Sun Jan 14 10:44:56 CET 2018
Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread
Commits:
7433fb13 by Pierre Lamot at 2018-01-14T10:44:41+01:00
Provide compatibility with media having incomplete TT_SRPT and PTT_SRPT
Some media don't provide the last byte field in "Title Search Pointer Table"
(TT_SRPT) and "Video Title Set Part of Title Search Pointer Table"
(VST_PTT_SRPT)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
- - - - -
22f0cd73 by Pierre Lamot at 2018-01-14T10:44:46+01:00
Don't abort if PGC structure can't be read.
Some DVD contains unused invalids PGC (ie: inaccessible location).
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
- - - - -
26cc345d by Pierre Lamot at 2018-01-14T10:44:49+01:00
Update incomplete structures
>From the spec.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
- - - - -
230d8c81 by Pierre Lamot at 2018-01-14T10:44:49+01:00
Don't abort if PGCN or PCN == 0 when reading VTS_PTT_SRPT
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
- - - - -
3 changed files:
- src/dvdread/ifo_types.h
- src/ifo_print.c
- src/ifo_read.c
Changes:
=====================================
src/dvdread/ifo_types.h
=====================================
--- a/src/dvdread/ifo_types.h
+++ b/src/dvdread/ifo_types.h
@@ -215,10 +215,10 @@ typedef struct {
unsigned int interleaved : 1;
unsigned int stc_discontinuity: 1;
unsigned int seamless_angle : 1;
-
+ unsigned int zero_1 : 1;
unsigned int playback_mode : 1; /**< When set, enter StillMode after each VOBU */
unsigned int restricted : 1; /**< ?? drop out of fastforward? */
- unsigned int unknown2 : 6;
+ unsigned int cell_type : 5; /** for karaoke, reserved otherwise */
uint8_t still_time;
uint8_t cell_cmd_nr;
dvd_time_t playback_time;
@@ -316,7 +316,7 @@ typedef struct {
uint8_t entry_id;
unsigned int block_mode : 2;
unsigned int block_type : 2;
- unsigned int unknown1 : 4;
+ unsigned int zero_1 : 4;
uint16_t ptl_id_mask;
uint32_t pgc_start_byte;
pgc_t *pgc;
@@ -578,7 +578,8 @@ typedef struct {
*/
typedef struct {
uint16_t lang_code;
- uint16_t unknown; /* 0x0001, title 1? disc 1? side 1? */
+ uint8_t zero_1;
+ uint8_t char_set; /* 0x00 reserved Unicode, 0x01 ISO 646, 0x10 JIS Roman & JIS Kanji, 0x11 ISO 8859-1, 0x12 Shift JIS Kanji */
uint32_t txtdt_start_byte; /* prt, rel start of vmg_txtdt_mgi */
txtdt_t *txtdt;
} ATTRIBUTE_PACKED txtdt_lu_t;
@@ -588,8 +589,9 @@ typedef struct {
* Text Data Manager Information. (Incomplete)
*/
typedef struct {
- char disc_name[14]; /* how many bytes?? */
- uint16_t nr_of_language_units; /* 32bit?? */
+ char disc_name[12];
+ uint16_t zero_1;
+ uint16_t nr_of_language_units;
uint32_t last_byte;
txtdt_lu_t *lu;
} ATTRIBUTE_PACKED txtdt_mgi_t;
=====================================
src/ifo_print.c
=====================================
--- a/src/ifo_print.c
+++ b/src/ifo_print.c
@@ -702,8 +702,8 @@ static void ifoPrint_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
printf("only still VOBUs ");
if(cell_playback[i].restricted)
printf("restricted cell ");
- if(cell_playback[i].unknown2)
- printf("Unknown 0x%x ", cell_playback[i].unknown2);
+ if(cell_playback[i].cell_type)
+ printf("cell type 0x%x ", cell_playback[i].cell_type);
if(cell_playback[i].still_time)
printf("still time %d ", cell_playback[i].still_time);
if(cell_playback[i].cell_cmd_nr)
=====================================
src/ifo_read.c
=====================================
--- a/src/ifo_read.c
+++ b/src/ifo_read.c
@@ -228,7 +228,7 @@ static void read_pgci_srp(pgci_srp_t *ps) {
ps->entry_id = dvdread_getbits(&state, 8);
ps->block_mode = dvdread_getbits(&state, 2);
ps->block_type = dvdread_getbits(&state, 2);
- ps->unknown1 = dvdread_getbits(&state, 4);
+ ps->zero_1 = dvdread_getbits(&state, 4);
ps->ptl_id_mask = dvdread_getbits(&state, 16);
ps->pgc_start_byte = dvdread_getbits(&state, 32);
}
@@ -245,9 +245,10 @@ static void read_cell_playback(cell_playback_t *cp) {
cp->interleaved = dvdread_getbits(&state, 1);
cp->stc_discontinuity = dvdread_getbits(&state, 1);
cp->seamless_angle = dvdread_getbits(&state, 1);
+ cp->zero_1 = dvdread_getbits(&state, 1);
cp->playback_mode = dvdread_getbits(&state, 1);
cp->restricted = dvdread_getbits(&state, 1);
- cp->unknown2 = dvdread_getbits(&state, 6);
+ cp->cell_type = dvdread_getbits(&state, 5);
cp->still_time = dvdread_getbits(&state, 8);
cp->cell_cmd_nr = dvdread_getbits(&state, 8);
@@ -1048,6 +1049,10 @@ int ifoRead_TT_SRPT(ifo_handle_t *ifofile) {
B2N_16(tt_srpt->nr_of_srpts);
B2N_32(tt_srpt->last_byte);
+ /* E-One releases don't fill this field */
+ if(tt_srpt->last_byte == 0) {
+ tt_srpt->last_byte = tt_srpt->nr_of_srpts * sizeof(title_info_t) - 1 + TT_SRPT_SIZE;
+ }
info_length = tt_srpt->last_byte + 1 - TT_SRPT_SIZE;
tt_srpt->title = calloc(1, info_length);
@@ -1162,6 +1167,10 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
CHECK_VALUE(vts_ptt_srpt->nr_of_srpts != 0);
CHECK_VALUE(vts_ptt_srpt->nr_of_srpts < 100); /* ?? */
+ /* E-One releases don't fill this field */
+ if(vts_ptt_srpt->last_byte == 0) {
+ vts_ptt_srpt->last_byte = vts_ptt_srpt->nr_of_srpts * sizeof(*data) - 1 + VTS_PTT_SRPT_SIZE;
+ }
info_length = vts_ptt_srpt->last_byte + 1 - VTS_PTT_SRPT_SIZE;
data = calloc(1, info_length);
if(!data)
@@ -1254,13 +1263,7 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
CHECK_VALUE(vts_ptt_srpt->title[i].ptt[j].pgcn < 1000); /* ?? */
CHECK_VALUE(vts_ptt_srpt->title[i].ptt[j].pgn != 0);
CHECK_VALUE(vts_ptt_srpt->title[i].ptt[j].pgn < 100); /* ?? */
- if (vts_ptt_srpt->title[i].ptt[j].pgcn == 0 ||
- vts_ptt_srpt->title[i].ptt[j].pgcn >= 1000 ||
- vts_ptt_srpt->title[i].ptt[j].pgn == 0 ||
- vts_ptt_srpt->title[i].ptt[j].pgn >= 100) {
- return 0;
- }
-
+ //don't abort here. E-One DVDs contain PTT with pgcn or pgn == 0
}
}
@@ -1895,7 +1898,7 @@ static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit,
memcpy(&pgcit->pgci_srp[i], ptr, PGCI_SRP_SIZE);
ptr += PGCI_SRP_SIZE;
read_pgci_srp(&pgcit->pgci_srp[i]);
- CHECK_VALUE(pgcit->pgci_srp[i].unknown1 == 0);
+ CHECK_VALUE(pgcit->pgci_srp[i].zero_1 == 0);
}
free(data);
@@ -1920,12 +1923,10 @@ static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit,
pgcit->pgci_srp[i].pgc->ref_count = 1;
if(!ifoRead_PGC(ifofile, pgcit->pgci_srp[i].pgc,
offset + pgcit->pgci_srp[i].pgc_start_byte)) {
- int j;
- for(j = 0; j <= i; j++) {
- ifoFree_PGC(&pgcit->pgci_srp[j].pgc);
- }
+ fprintf(stderr, "libdvdread: Unable to read invalid PCG\n");
+ //E-One releases provide boggus PGC, ie: out of bound start_byte
free(pgcit->pgci_srp[i].pgc);
- goto fail;
+ pgcit->pgci_srp[i].pgc = NULL;
}
}
View it on GitLab: https://code.videolan.org/videolan/libdvdread/compare/74853950580354f0fba0e8bbae643068da9c3fb7...230d8c8140316f1633cb48c11870938d5784b5b7
---
View it on GitLab: https://code.videolan.org/videolan/libdvdread/compare/74853950580354f0fba0e8bbae643068da9c3fb7...230d8c8140316f1633cb48c11870938d5784b5b7
You're receiving this email because of your account on code.videolan.org.
More information about the libdvdnav-devel
mailing list