[libbluray-devel] commit: Splitted hdmv_vm_select_object(). (hpi1 )

git at videolan.org git at videolan.org
Thu Aug 19 14:27:15 CEST 2010


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Aug 19 15:26:18 2010 +0300| [dad0d86ccba74d846a79347707bac2e55ffa1ba5] | committer: hpi1 

Splitted hdmv_vm_select_object().
Cache copy of IG stream object in hdmv_vm.

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

 src/libbluray/bluray.c       |    2 +-
 src/libbluray/hdmv/hdmv_vm.c |   29 +++++++++++++++++++++++++++--
 src/libbluray/hdmv/hdmv_vm.h |    3 ++-
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 84259c6..da22cc8 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1268,7 +1268,7 @@ static int _play_hdmv(BLURAY *bd, unsigned id_ref)
     }
     bd->hdmv_suspended = 0;
 
-    return hdmv_vm_select_object(bd->hdmv_vm, id_ref, NULL);
+    return hdmv_vm_select_object(bd->hdmv_vm, id_ref);
 }
 
 #define TITLE_FIRST_PLAY 0xffff   /* 10.4.3.2 (E) */
diff --git a/src/libbluray/hdmv/hdmv_vm.c b/src/libbluray/hdmv/hdmv_vm.c
index 3398425..6d3bb61 100644
--- a/src/libbluray/hdmv/hdmv_vm.c
+++ b/src/libbluray/hdmv/hdmv_vm.c
@@ -240,6 +240,11 @@ void hdmv_vm_free(HDMV_VM *p)
 {
     mobj_free(p->movie_objects);
 
+    if (p->ig_object) {
+        X_FREE(p->ig_object->cmds);
+        X_FREE(p->ig_object);
+    }
+
     X_FREE(p);
 }
 
@@ -834,8 +839,10 @@ static int _hdmv_step(HDMV_VM *p)
  * interface
  */
 
-int hdmv_vm_select_object(HDMV_VM *p, int object, void *ig_object)
+int hdmv_vm_select_object(HDMV_VM *p, int object)
 {
+    p->object = NULL;
+
     if (object >= 0) {
         if (object >= p->movie_objects->num_objects) {
             DEBUG(DBG_HDMV|DBG_CRIT, "hdmv_vm_select_program(): invalid object reference (%d) !\n", object);
@@ -844,7 +851,25 @@ int hdmv_vm_select_object(HDMV_VM *p, int object, void *ig_object)
         p->pc     = 0;
         p->object = &p->movie_objects->objects[object];
     }
-    if (ig_object) {
+
+    return 0;
+}
+
+int hdmv_vm_set_object(HDMV_VM *p, int num_nav_cmds, void *nav_cmds)
+{
+    p->object = NULL;
+
+    if (p->ig_object) {
+        X_FREE(p->ig_object->cmds);
+        X_FREE(p->ig_object);
+    }
+
+    if (nav_cmds && num_nav_cmds > 0) {
+        MOBJ_OBJECT *ig_object = calloc(1, sizeof(MOBJ_OBJECT));
+        ig_object->num_cmds = num_nav_cmds;
+        ig_object->cmds     = calloc(num_nav_cmds, sizeof(MOBJ_CMD));
+        memcpy(ig_object->cmds, nav_cmds, num_nav_cmds * sizeof(MOBJ_CMD));
+
 #if 0
         /* ??? */
         if (!p->ig_object && p->object) {
diff --git a/src/libbluray/hdmv/hdmv_vm.h b/src/libbluray/hdmv/hdmv_vm.h
index 927186f..2fcc616 100644
--- a/src/libbluray/hdmv/hdmv_vm.h
+++ b/src/libbluray/hdmv/hdmv_vm.h
@@ -66,7 +66,8 @@ typedef struct hdmv_vm_s HDMV_VM;
 BD_PRIVATE HDMV_VM *hdmv_vm_init(const char *disc_root, struct bd_registers_s *regs);
 BD_PRIVATE void     hdmv_vm_free(HDMV_VM *p);
 
-BD_PRIVATE int      hdmv_vm_select_object(HDMV_VM *p, int object, void *ig_object);
+BD_PRIVATE int      hdmv_vm_select_object(HDMV_VM *p, int object);
+BD_PRIVATE int      hdmv_vm_set_object(HDMV_VM *p, int num_nav_cmds, void *nav_cmds);
 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);
 



More information about the libbluray-devel mailing list