[libbluray-devel] Emit BD_EVENT_ERROR when title playback fails

hpi1 git at videolan.org
Sun Dec 15 18:16:42 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Dec 15 19:13:10 2013 +0200| [8d5c0ff30ee56cec100fa2d8e34461029c20aefa] | committer: hpi1

Emit BD_EVENT_ERROR when title playback fails

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=8d5c0ff30ee56cec100fa2d8e34461029c20aefa
---

 src/libbluray/bluray.c |   17 +++++++++++++++--
 src/libbluray/bluray.h |    5 +++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index b09b7aa..36ed2e2 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -2691,9 +2691,17 @@ static int _play_bdj(BLURAY *bd, unsigned title)
         return 0;
     }
 
+    int result;
+
     bd->title_type = title_bdj;
 
-    return _start_bdj(bd, title);
+    result = _start_bdj(bd, title);
+    if (result <= 0) {
+        bd->title_type = title_undef;
+        _queue_event(bd, BD_EVENT_ERROR, BD_ERROR_BDJ);
+    }
+
+    return result;
 }
 
 static int _play_hdmv(BLURAY *bd, unsigned id_ref)
@@ -2714,6 +2722,11 @@ static int _play_hdmv(BLURAY *bd, unsigned id_ref)
 
     bd->hdmv_suspended = !hdmv_vm_running(bd->hdmv_vm);
 
+    if (result <= 0) {
+        bd->title_type = title_undef;
+        _queue_event(bd, BD_EVENT_ERROR, BD_ERROR_HDMV);
+    }
+
     return result;
 }
 
@@ -2987,7 +3000,7 @@ static int _run_hdmv(BLURAY *bd)
 
     /* run VM */
     if (hdmv_vm_run(bd->hdmv_vm, &hdmv_ev) < 0) {
-        _queue_event(bd, BD_EVENT_ERROR, 0);
+        _queue_event(bd, BD_EVENT_ERROR, BD_ERROR_HDMV);
         bd->hdmv_suspended = !hdmv_vm_running(bd->hdmv_vm);
         return -1;
     }
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index 5b3760a..485fdad 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -647,6 +647,11 @@ typedef struct {
     uint32_t   param;
 } BD_EVENT;
 
+/* BD_EVENT_ERROR param values */
+#define BD_ERROR_HDMV    1
+#define BD_ERROR_BDJ     2
+
+
 #define BLURAY_TITLE_FIRST_PLAY  0xffff
 #define BLURAY_TITLE_TOP_MENU    0
 /**



More information about the libbluray-devel mailing list