From b238d8e22673cbc1d485ee9637c5f73ed2ecb32f Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Mon, 5 Oct 2015 11:56:50 +0300 Subject: [PATCH] bluray: handle libbluray error events Signed-off-by: Jean-Baptiste Kempf --- modules/access/bluray.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/access/bluray.c b/modules/access/bluray.c index cbb4734c8ac7..611b08e81f22 100644 --- a/modules/access/bluray.c +++ b/modules/access/bluray.c @@ -142,6 +142,7 @@ struct demux_sys_t /* Menus */ bluray_overlay_t *p_overlays[MAX_OVERLAY]; + bool b_fatal_error; bool b_menu; bool b_menu_open; bool b_popup_available; @@ -1771,6 +1772,22 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e) /* TODO: show / hide pop-up menu button in gui ? */ break; + /* + * Errors + */ + case BD_EVENT_ERROR: + /* fatal error (with menus) */ + dialog_Fatal(p_demux, _("Blu-ray error"), "Playback with BluRay menus failed"); + p_sys->b_fatal_error = true; + break; + case BD_EVENT_ENCRYPTED: + dialog_Fatal(p_demux, _("Blu-ray error"), "This disc seems to be encrypted"); + p_sys->b_fatal_error = true; + break; + case BD_EVENT_READ_ERROR: + msg_Err(p_demux, "bluray: read error\n"); + break; + /* * stream selection events */ @@ -1899,8 +1916,10 @@ static int blurayDemux(demux_t *p_demux) if (nread <= 0) { block_Release(p_block); - if (nread < 0) + if (p_sys->b_fatal_error || nread < 0) { + msg_Err(p_demux, "bluray: stopping playback after fatal error\n"); return VLC_DEMUXER_EGENERIC; + } return VLC_DEMUXER_SUCCESS; }