[libbluray-devel] hdmv: check for missing VM

hpi1 git at videolan.org
Wed Jan 22 12:49:42 CET 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Jan 21 10:26:52 2014 +0200| [b731942fb97e9e4717eab765309bd300233e03f3] | committer: hpi1

hdmv: check for missing VM

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

 src/libbluray/hdmv/hdmv_vm.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/src/libbluray/hdmv/hdmv_vm.c b/src/libbluray/hdmv/hdmv_vm.c
index f188cf9..9e34dcd 100644
--- a/src/libbluray/hdmv/hdmv_vm.c
+++ b/src/libbluray/hdmv/hdmv_vm.c
@@ -1085,6 +1085,11 @@ static int _hdmv_step(HDMV_VM *p)
 int hdmv_vm_select_object(HDMV_VM *p, int object)
 {
     int result;
+
+    if (!p) {
+        return -1;
+    }
+
     bd_mutex_lock(&p->mutex);
 
     result = _jump_object(p, object);
@@ -1121,6 +1126,11 @@ static int _set_object(HDMV_VM *p, int num_nav_cmds, void *nav_cmds)
 int hdmv_vm_set_object(HDMV_VM *p, int num_nav_cmds, void *nav_cmds)
 {
     int result = -1;
+
+    if (!p) {
+        return -1;
+    }
+
     bd_mutex_lock(&p->mutex);
 
     p->object = NULL;
@@ -1150,6 +1160,11 @@ int hdmv_vm_get_event(HDMV_VM *p, HDMV_EVENT *ev)
 int hdmv_vm_running(HDMV_VM *p)
 {
     int result;
+
+    if (!p) {
+        return 0;
+    }
+
     bd_mutex_lock(&p->mutex);
 
     result = !!p->object;
@@ -1163,6 +1178,10 @@ uint32_t hdmv_vm_get_uo_mask(HDMV_VM *p)
     uint32_t     mask = 0;
     MOBJ_OBJECT *o    = NULL;
 
+    if (!p) {
+        return 0;
+    }
+
     bd_mutex_lock(&p->mutex);
 
     if ((o = p->object ? p->object : (p->playing_object ? p->playing_object : p->suspended_object))) {
@@ -1177,6 +1196,11 @@ uint32_t hdmv_vm_get_uo_mask(HDMV_VM *p)
 int hdmv_vm_resume(HDMV_VM *p)
 {
     int result;
+
+    if (!p) {
+        return -1;
+    }
+
     bd_mutex_lock(&p->mutex);
 
     result = _resume_from_play_pl(p);
@@ -1188,6 +1212,11 @@ int hdmv_vm_resume(HDMV_VM *p)
 int hdmv_vm_suspend_pl(HDMV_VM *p)
 {
     int result = -1;
+
+    if (!p) {
+        return -1;
+    }
+
     bd_mutex_lock(&p->mutex);
 
     if (p->object || p->ig_object) {
@@ -1277,6 +1306,11 @@ static int _vm_run(HDMV_VM *p, HDMV_EVENT *ev)
 int hdmv_vm_run(HDMV_VM *p, HDMV_EVENT *ev)
 {
     int result;
+
+    if (!p) {
+        return -1;
+    }
+
     bd_mutex_lock(&p->mutex);
 
     result = _vm_run(p, ev);



More information about the libbluray-devel mailing list