From 0a9ddd2a521fcd9ebd3f8065486388e0c2647582 Mon Sep 17 00:00:00 2001 From: Francois Cartegnie Date: Mon, 19 Nov 2018 16:16:30 +0100 Subject: [PATCH] access: bluray: workaround BDJO update checks --- modules/access/bluray.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/modules/access/bluray.c b/modules/access/bluray.c index 36a22a7dff..6e8125f4c0 100644 --- a/modules/access/bluray.c +++ b/modules/access/bluray.c @@ -133,6 +133,78 @@ static const char * bluray_event_debug_strings[] = # define blurayDebugEvent(e, v) #endif +#ifdef BLURAY_HAS_BDJO_DATA_H +/* System version check menu freeze. See + * https://code.videolan.org/videolan/libbluray/issues/1 + * To be removed with fix[ed,able] libbluray */ +# include +# include +static int BDJO_FileSelect( const char *psz_filename ) +{ + int i_len = strlen( psz_filename ); + if ( i_len <= 5 ) + return 0; + else + return ! strcasecmp( &psz_filename[i_len - 5], ".bdjo" ); +} + +static bool BDJO_IsBlacklisted(demux_t *p_demux, const char *psz_bd_path) +{ + const char * rgsz_class_blacklist[] = + { + "com.macrovision.bdplus.Handshake", + }; + + bool b_ret = false; + char *psz_bdjo_dir; + if(-1 == asprintf(&psz_bdjo_dir, "%s/BDMV/BDJO", psz_bd_path)) + return false; + + char **ppsz_filenames = NULL; + int i_files = vlc_scandir(psz_bdjo_dir, &ppsz_filenames, BDJO_FileSelect, NULL); + if(i_files < 1) + { + free(psz_bdjo_dir); + return false; + } + + for( int i=0; iapp_table.num_app && !b_ret; j++) + for(size_t k=0; kapp_table.app[j].initial_class)); +#ifdef DEBUG_BLURAY + if(b_ret) + msg_Warn("Found blacklisted class %s in %s", rgsz_class_blacklist[k], + ppsz_filenames[i]); +#else + VLC_UNUSED(p_demux); +#endif + bd_free_bdjo(bdjo); + } + free(psz_bdjo_file); + } + } + + free(psz_bdjo_dir); + + for( int i=0; ib_menu = false; } + if(disc_info->bdj_detected &&p_sys->b_menu && + BDJO_IsBlacklisted(p_demux, p_sys->psz_bd_path)) + { + p_sys->b_menu = vlc_dialog_wait_question( p_demux, + VLC_DIALOG_QUESTION_NORMAL, + _("Play without Menus"), + _("Try anyway"), + NULL, + _("BDJO Menu check"), + "%s", + _("Incompatible Java Menu detected")); + } + /* Get titles and chapters */ blurayInitTitles(p_demux, disc_info->num_hdmv_titles + disc_info->num_bdj_titles + 1/*Top Menu*/ + 1/*First Play*/); -- 2.11.4.GIT