[libbluray-devel] Split mobj_parse.h

hpi1 git at videolan.org
Tue Dec 2 11:35:22 CET 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Nov 28 14:56:03 2014 +0200| [1137543bd42e262b52c476ebfb7f6ea35e5ef900] | committer: hpi1

Split mobj_parse.h

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

 src/Makefile.am                    |    1 +
 src/examples/mobj_dump.c           |    1 +
 src/libbluray/decoders/ig.h        |    4 +--
 src/libbluray/decoders/ig_decode.c |    1 +
 src/libbluray/hdmv/hdmv_vm.c       |    1 +
 src/libbluray/hdmv/mobj_data.h     |   62 ++++++++++++++++++++++++++++++++++++
 src/libbluray/hdmv/mobj_parse.c    |    2 ++
 src/libbluray/hdmv/mobj_parse.h    |   47 ++++-----------------------
 src/libbluray/hdmv/mobj_print.c    |    5 +--
 9 files changed, 79 insertions(+), 45 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index e48eca1..fd18f07 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -67,6 +67,7 @@ libbluray_la_SOURCES = \
 	libbluray/hdmv/hdmv_insn.h \
 	libbluray/hdmv/hdmv_vm.h \
 	libbluray/hdmv/hdmv_vm.c \
+	libbluray/hdmv/mobj_data.h \
 	libbluray/hdmv/mobj_parse.h \
 	libbluray/hdmv/mobj_parse.c \
 	libbluray/hdmv/mobj_print.c \
diff --git a/src/examples/mobj_dump.c b/src/examples/mobj_dump.c
index 8436c2f..38837d5 100644
--- a/src/examples/mobj_dump.c
+++ b/src/examples/mobj_dump.c
@@ -18,6 +18,7 @@
  */
 
 #include "libbluray/hdmv/mobj_parse.h"
+#include "libbluray/hdmv/mobj_data.h"
 
 #include <stdio.h>
 #include <string.h>
diff --git a/src/libbluray/decoders/ig.h b/src/libbluray/decoders/ig.h
index d2d2ffc..789e59f 100644
--- a/src/libbluray/decoders/ig.h
+++ b/src/libbluray/decoders/ig.h
@@ -25,7 +25,7 @@
 
 #include <stdint.h>
 
-struct bd_mobj_cmd_s;
+struct mobj_cmd;
 
 /*
  *
@@ -64,7 +64,7 @@ typedef struct bd_ig_button_s {
 
     /* navigation commands */
     uint16_t      num_nav_cmds;
-    struct bd_mobj_cmd_s *nav_cmds;
+    struct mobj_cmd *nav_cmds;
 
 } BD_IG_BUTTON;
 
diff --git a/src/libbluray/decoders/ig_decode.c b/src/libbluray/decoders/ig_decode.c
index d87c72f..5eca32b 100644
--- a/src/libbluray/decoders/ig_decode.c
+++ b/src/libbluray/decoders/ig_decode.c
@@ -21,6 +21,7 @@
 
 #include "pg_decode.h"           // pg_decode_*()
 #include "../hdmv/mobj_parse.h"  // mobj_parse_cmd()
+#include "../hdmv/mobj_data.h"   // MOBJ_CMD
 #include "../bdnav/mpls_parse.h" // mpls_parse_uo()
 
 #include "util/macro.h"
diff --git a/src/libbluray/hdmv/hdmv_vm.c b/src/libbluray/hdmv/hdmv_vm.c
index 9ac9038..775edad 100644
--- a/src/libbluray/hdmv/hdmv_vm.c
+++ b/src/libbluray/hdmv/hdmv_vm.c
@@ -20,6 +20,7 @@
 #include "hdmv_vm.h"
 
 #include "mobj_parse.h"
+#include "mobj_data.h"
 #include "hdmv_insn.h"
 #include "../register.h"
 
diff --git a/src/libbluray/hdmv/mobj_data.h b/src/libbluray/hdmv/mobj_data.h
new file mode 100644
index 0000000..b6fcc94
--- /dev/null
+++ b/src/libbluray/hdmv/mobj_data.h
@@ -0,0 +1,62 @@
+/*
+ * This file is part of libbluray
+ * Copyright (C) 2010  Petri Hintukainen <phintuka at users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined(_MOBJ_DATA_H_)
+#define _MOBJ_DATA_H_
+
+#include <stdint.h>
+
+typedef struct {
+    unsigned int sub_grp    : 3;  /* command sub-group */
+    unsigned int op_cnt     : 3;  /* operand count */
+    unsigned int grp        : 2;  /* command group */
+
+    unsigned int branch_opt : 4;  /* branch option */
+    unsigned int reserved1  : 2;
+    unsigned int imm_op2    : 1;  /* I-flag for operand 2 */
+    unsigned int imm_op1    : 1;  /* I-flag for operand 1 */
+
+    unsigned int cmp_opt    : 4;  /* compare option */
+    unsigned int reserved2  : 4;
+
+    unsigned int set_opt    : 5;  /* set option */
+    unsigned int reserved3  : 3;
+} HDMV_INSN;
+
+typedef struct mobj_cmd {
+    HDMV_INSN insn;
+    uint32_t  dst;
+    uint32_t  src;
+} MOBJ_CMD;
+
+typedef struct {
+    uint8_t     resume_intention_flag /*: 1*/;
+    uint8_t     menu_call_mask        /*: 1*/;
+    uint8_t     title_search_mask     /*: 1*/;
+
+    uint16_t    num_cmds;
+    MOBJ_CMD   *cmds;
+} MOBJ_OBJECT;
+
+typedef struct mobj_objects {
+    uint16_t    num_objects;
+    MOBJ_OBJECT *objects;
+} MOBJ_OBJECTS;
+
+#endif // _MOBJ_DATA_H_
diff --git a/src/libbluray/hdmv/mobj_parse.c b/src/libbluray/hdmv/mobj_parse.c
index e50da33..01b8b46 100644
--- a/src/libbluray/hdmv/mobj_parse.c
+++ b/src/libbluray/hdmv/mobj_parse.c
@@ -19,6 +19,8 @@
 
 #include "mobj_parse.h"
 
+#include "mobj_data.h"
+
 #include "file/file.h"
 #include "util/bits.h"
 #include "util/logging.h"
diff --git a/src/libbluray/hdmv/mobj_parse.h b/src/libbluray/hdmv/mobj_parse.h
index 93eea43..a97bbec 100644
--- a/src/libbluray/hdmv/mobj_parse.h
+++ b/src/libbluray/hdmv/mobj_parse.h
@@ -24,48 +24,13 @@
 
 #include <stdint.h>
 
-typedef struct {
-  unsigned int sub_grp    : 3;  /* command sub-group */
-  unsigned int op_cnt     : 3;  /* operand count */
-  unsigned int grp        : 2;  /* command group */
+struct mobj_objects;
+struct mobj_cmd;
 
-  unsigned int branch_opt : 4;  /* branch option */
-  unsigned int reserved1  : 2;
-  unsigned int imm_op2    : 1;  /* I-flag for operand 2 */
-  unsigned int imm_op1    : 1;  /* I-flag for operand 1 */
+BD_PRIVATE struct mobj_objects* mobj_parse(const char *disc_root) BD_ATTR_MALLOC; /* parse MovieObject.bdmv */
+BD_PRIVATE void                 mobj_parse_cmd(uint8_t *buf, struct mobj_cmd *cmd);
+BD_PRIVATE void                 mobj_free(struct mobj_objects **index);
 
-  unsigned int cmp_opt    : 4;  /* compare option */
-  unsigned int reserved2  : 4;
-
-  unsigned int set_opt    : 5;  /* set option */
-  unsigned int reserved3  : 3;
-} HDMV_INSN;
-
-typedef struct bd_mobj_cmd_s {
-    HDMV_INSN insn;
-    uint32_t  dst;
-    uint32_t  src;
-} MOBJ_CMD;
-
-typedef struct {
-    uint8_t     resume_intention_flag /*: 1*/;
-    uint8_t     menu_call_mask        /*: 1*/;
-    uint8_t     title_search_mask     /*: 1*/;
-
-    uint16_t    num_cmds;
-    MOBJ_CMD   *cmds;
-} MOBJ_OBJECT;
-
-typedef struct mobj_objects {
-    uint16_t    num_objects;
-    MOBJ_OBJECT *objects;
-} MOBJ_OBJECTS;
-
-
-BD_PRIVATE MOBJ_OBJECTS* mobj_parse(const char *disc_root) BD_ATTR_MALLOC; /* parse MovieObject.bdmv */
-BD_PRIVATE void          mobj_parse_cmd(uint8_t *buf, MOBJ_CMD *cmd);
-BD_PRIVATE void          mobj_free(MOBJ_OBJECTS **index);
-
-BD_PRIVATE int mobj_sprint_cmd(char *buf, MOBJ_CMD *cmd); /* print MOBJ_CMD to string. buf is expected to be 256 bytes. */
+BD_PRIVATE int mobj_sprint_cmd(char *buf, struct mobj_cmd *cmd); /* print MOBJ_CMD to string. buf is expected to be 256 bytes. */
 
 #endif // _MOBJ_PARSE_H_
diff --git a/src/libbluray/hdmv/mobj_print.c b/src/libbluray/hdmv/mobj_print.c
index 8865892..d74584c 100644
--- a/src/libbluray/hdmv/mobj_print.c
+++ b/src/libbluray/hdmv/mobj_print.c
@@ -17,11 +17,12 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "util/macro.h"
-
+#include "mobj_data.h"
 #include "mobj_parse.h"
 #include "hdmv_insn.h"
 
+#include "util/macro.h"
+
 #include <stdio.h>
 
 static const char * const psr_info[128] = {



More information about the libbluray-devel mailing list