[vlc-devel] [PATCH] bluray: handle libbluray error events

Petri Hintukainen phintuka at gmail.com
Mon Oct 5 10:56:50 CEST 2015


---
 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 bbd6f88..4d1009d 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;
@@ -1772,6 +1773,22 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
         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
      */
     case BD_EVENT_AUDIO_STREAM:
@@ -1913,8 +1930,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;
     }
 
-- 
2.1.4



More information about the vlc-devel mailing list