[libbluray-devel] HDMV: do not call API function from internal function.

hpi1 git at videolan.org
Sun Feb 13 16:25:17 CET 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Feb 13 17:21:47 2011 +0200| [20739ede2fcadd67b35a1553b9ee9372de21f9f7] | committer: hpi1

HDMV: do not call API function from internal function.
This simplifies locking implementation.

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

 src/libbluray/hdmv/hdmv_vm.c |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/src/libbluray/hdmv/hdmv_vm.c b/src/libbluray/hdmv/hdmv_vm.c
index dd7ccd2..c8f590c 100644
--- a/src/libbluray/hdmv/hdmv_vm.c
+++ b/src/libbluray/hdmv/hdmv_vm.c
@@ -313,14 +313,17 @@ static int _resume_object(HDMV_VM *p)
 
 static int _jump_object(HDMV_VM *p, int object)
 {
-    if (object < 0 || object > p->movie_objects->num_objects) {
+    if (object < 0 || object >= p->movie_objects->num_objects) {
         DEBUG(DBG_HDMV|DBG_CRIT, "_jump_object(): invalid object %d\n", object);
         return -1;
     }
 
     DEBUG(DBG_HDMV, "_jump_object(): jumping to object %d\n", object);
 
-    hdmv_vm_select_object(p, object);
+    _free_ig_object(p);
+
+    p->pc     = 0;
+    p->object = &p->movie_objects->objects[object];
 
     return 0;
 }
@@ -882,19 +885,9 @@ static int _hdmv_step(HDMV_VM *p)
 
 int hdmv_vm_select_object(HDMV_VM *p, int object)
 {
-    if (object >= 0) {
-        if (object >= p->movie_objects->num_objects) {
-            DEBUG(DBG_HDMV|DBG_CRIT, "hdmv_vm_select_object(): invalid object reference (%d) !\n", object);
-            return -1;
-        }
-
-        _free_ig_object(p);
-
-        p->pc     = 0;
-        p->object = &p->movie_objects->objects[object];
-    }
-
-    return 0;
+    int result;
+    result = _jump_object(p, object);
+    return result;
 }
 
 int hdmv_vm_set_object(HDMV_VM *p, int num_nav_cmds, void *nav_cmds)



More information about the libbluray-devel mailing list