[libbluray-devel] Check movie object title search and menu call masks before allowing user operation

hpi1 git at videolan.org
Wed Apr 27 14:08:46 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Apr 27 15:07:21 2011 +0300| [8b866642a667c81cbad475308686484af8ea864b] | committer: hpi1

Check movie object title search and menu call masks before allowing user operation

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

 src/libbluray/bluray.c       |   14 ++++++++++++++
 src/libbluray/hdmv/hdmv_vm.c |   16 ++++++++++++++++
 src/libbluray/hdmv/hdmv_vm.h |    5 +++++
 3 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 4298aca..38d1ee1 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1875,6 +1875,13 @@ int bd_play_title(BLURAY *bd, unsigned title)
         return 0;
     }
 
+    if (bd->title_type == title_hdmv) {
+        if (hdmv_vm_get_uo_mask(bd->hdmv_vm) & HDMV_TITLE_SEARCH_MASK) {
+            BD_DEBUG(DBG_BLURAY|DBG_CRIT, "title search masked by movie object\n");
+            return 0;
+        }
+    }
+
     return _play_title(bd, title);
 }
 
@@ -1889,6 +1896,13 @@ int bd_menu_call(BLURAY *bd, int64_t pts)
         return 0;
     }
 
+    if (bd->title_type == title_hdmv) {
+        if (hdmv_vm_get_uo_mask(bd->hdmv_vm) & HDMV_MENU_CALL_MASK) {
+            BD_DEBUG(DBG_BLURAY|DBG_CRIT, "menu call masked by movie object\n");
+            return 0;
+        }
+    }
+
     return _play_title(bd, BLURAY_TITLE_TOP_MENU);
 }
 
diff --git a/src/libbluray/hdmv/hdmv_vm.c b/src/libbluray/hdmv/hdmv_vm.c
index 4d685f9..3453d2f 100644
--- a/src/libbluray/hdmv/hdmv_vm.c
+++ b/src/libbluray/hdmv/hdmv_vm.c
@@ -947,6 +947,22 @@ int hdmv_vm_running(HDMV_VM *p)
     return result;
 }
 
+uint32_t hdmv_vm_get_uo_mask(HDMV_VM *p)
+{
+    uint32_t     mask = 0;
+    MOBJ_OBJECT *o    = NULL;
+
+    bd_mutex_lock(&p->mutex);
+
+    if ((o = p->object ? p->object : p->suspended_object)) {
+        mask |= o->menu_call_mask;
+        mask |= o->title_search_mask << 1;
+    }
+
+    bd_mutex_unlock(&p->mutex);
+    return mask;
+}
+
 int hdmv_vm_resume(HDMV_VM *p)
 {
     int result;
diff --git a/src/libbluray/hdmv/hdmv_vm.h b/src/libbluray/hdmv/hdmv_vm.h
index 5d7376c..9c0d945 100644
--- a/src/libbluray/hdmv/hdmv_vm.h
+++ b/src/libbluray/hdmv/hdmv_vm.h
@@ -74,6 +74,11 @@ BD_PRIVATE int      hdmv_vm_run(HDMV_VM *p, HDMV_EVENT *ev);
 BD_PRIVATE int      hdmv_vm_get_event(HDMV_VM *p, HDMV_EVENT *ev);
 
 BD_PRIVATE int      hdmv_vm_running(HDMV_VM *p);
+
+#define HDMV_MENU_CALL_MASK     0x01
+#define HDMV_TITLE_SEARCH_MASK  0x02
+BD_PRIVATE uint32_t hdmv_vm_get_uo_mask(HDMV_VM *p);
+
 BD_PRIVATE int      hdmv_vm_suspend(HDMV_VM *p);
 BD_PRIVATE int      hdmv_vm_resume(HDMV_VM *p);
 



More information about the libbluray-devel mailing list