vlc | branch: master | Francois Cartegnie <[email protected]> | Fri Feb 21 15:59:13 2020 +0100| [601cac14a6d2ac34246f8111d34025c6ff788f8e] | committer: Francois Cartegnie
access: dvdnav: skip cell on lost VOBU syncro Corrupted titles for dvdread fun > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=601cac14a6d2ac34246f8111d34025c6ff788f8e --- modules/access/dvdread.c | 49 ++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c index 109a529dd8..65d087c330 100644 --- a/modules/access/dvdread.c +++ b/modules/access/dvdread.c @@ -1167,26 +1167,39 @@ static void DvdReadHandleDSI( demux_t *p_demux, uint8_t *p_data ) { demux_sys_t *p_sys = p_demux->p_sys; - navRead_DSI( &p_sys->dsi_pack, &p_data[DSI_START_BYTE] ); - - /* - * Determine where we go next. These values are the ones we mostly - * care about. - */ - p_sys->i_cur_block = p_sys->dsi_pack.dsi_gi.nv_pck_lbn; - p_sys->i_pack_len = p_sys->dsi_pack.dsi_gi.vobu_ea; - + /* Check we are really on a DSI packet + * http://www.mpucoder.com/DVD/dsi_pkt.html + * Some think it's funny to fill with 0x42 */ + const uint8_t dsiheader[7] = { 0x00, 0x00, 0x01, 0xbf, 0x03, 0xfa, 0x01 }; + if(!memcmp(&p_data[DSI_START_BYTE-7], dsiheader, 7)) + { + navRead_DSI( &p_sys->dsi_pack, &p_data[DSI_START_BYTE] ); - /* - * If we're not at the end of this cell, we can determine the next - * VOBU to display using the VOBU_SRI information section of the - * DSI. Using this value correctly follows the current angle, - * avoiding the doubled scenes in The Matrix, and makes our life - * really happy. - */ + /* + * Determine where we go next. These values are the ones we mostly + * care about. + */ + p_sys->i_cur_block = p_sys->dsi_pack.dsi_gi.nv_pck_lbn; + p_sys->i_pack_len = p_sys->dsi_pack.dsi_gi.vobu_ea; - p_sys->i_next_vobu = p_sys->i_cur_block + - ( p_sys->dsi_pack.vobu_sri.next_vobu & 0x7fffffff ); + /* + * If we're not at the end of this cell, we can determine the next + * VOBU to display using the VOBU_SRI information section of the + * DSI. Using this value correctly follows the current angle, + * avoiding the doubled scenes in The Matrix, and makes our life + * really happy. + */ + + p_sys->i_next_vobu = p_sys->i_cur_block + + ( p_sys->dsi_pack.vobu_sri.next_vobu & 0x7fffffff ); + } + else + { + /* resync after decoy/corrupted titles */ + msg_Warn(p_demux, "Invalid DSI packet in VOBU %d found, skipping Cell %d / %d", + p_sys->i_next_vobu, p_sys->i_cur_cell, p_sys->i_title_end_cell); + p_sys->dsi_pack.vobu_sri.next_vobu = SRI_END_OF_CELL; + } if( p_sys->dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL && p_sys->i_angle > 1 ) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
