[libbluray-devel] commit: Splitted mobj_parse_cmd() from _mobj_parse_object(). Added name for MOBJ_CMD struct. (hpi1 )
git at videolan.org
git at videolan.org
Fri Aug 13 23:58:40 CEST 2010
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Aug 13 23:41:27 2010 +0300| [8ec9ee03722c87b43c059bb8a8bbb77d7c6d5c4c] | committer: hpi1
Splitted mobj_parse_cmd() from _mobj_parse_object(). Added name for MOBJ_CMD struct.
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=8ec9ee03722c87b43c059bb8a8bbb77d7c6d5c4c
---
src/libbluray/hdmv/mobj_parse.c | 47 ++++++++++++++++++++++----------------
src/libbluray/hdmv/mobj_parse.h | 3 +-
2 files changed, 29 insertions(+), 21 deletions(-)
diff --git a/src/libbluray/hdmv/mobj_parse.c b/src/libbluray/hdmv/mobj_parse.c
index b211ef2..05105c1 100644
--- a/src/libbluray/hdmv/mobj_parse.c
+++ b/src/libbluray/hdmv/mobj_parse.c
@@ -50,6 +50,30 @@ static int _mobj_parse_header(BITSTREAM *bs, int *extension_data_start)
return 1;
}
+void mobj_parse_cmd(uint8_t *buf, MOBJ_CMD *cmd)
+{
+ BITBUFFER bb;
+ bb_init(&bb, buf, 12);
+
+ cmd->insn.op_cnt = bb_read(&bb, 3);
+ cmd->insn.grp = bb_read(&bb, 2);
+ cmd->insn.sub_grp = bb_read(&bb, 3);
+
+ cmd->insn.imm_op1 = bb_read(&bb, 1);
+ cmd->insn.imm_op2 = bb_read(&bb, 1);
+ bb_skip(&bb, 2); /* reserved */
+ cmd->insn.branch_opt = bb_read(&bb, 4);
+
+ bb_skip(&bb, 4); /* reserved */
+ cmd->insn.cmp_opt = bb_read(&bb, 4);
+
+ bb_skip(&bb, 3); /* reserved */
+ cmd->insn.set_opt = bb_read(&bb, 5);
+
+ cmd->dst = bb_read(&bb, 32);
+ cmd->src = bb_read(&bb, 32);
+}
+
static int _mobj_parse_object(BITSTREAM *bs, MOBJ_OBJECT *obj)
{
int i;
@@ -64,26 +88,9 @@ static int _mobj_parse_object(BITSTREAM *bs, MOBJ_OBJECT *obj)
obj->cmds = calloc(obj->num_cmds, sizeof(MOBJ_CMD));
for (i = 0; i < obj->num_cmds; i++) {
-
- HDMV_INSN *insn = &obj->cmds[i].insn;
-
- insn->op_cnt = bs_read(bs, 3);
- insn->grp = bs_read(bs, 2);
- insn->sub_grp = bs_read(bs, 3);
-
- insn->imm_op1 = bs_read(bs, 1);
- insn->imm_op2 = bs_read(bs, 1);
- bs_skip(bs, 2); /* reserved */
- insn->branch_opt = bs_read(bs, 4);
-
- bs_skip(bs, 4); /* reserved */
- insn->cmp_opt = bs_read(bs, 4);
-
- bs_skip(bs, 3); /* reserved */
- insn->set_opt = bs_read(bs, 5);
-
- obj->cmds[i].dst = bs_read(bs, 32);
- obj->cmds[i].src = bs_read(bs, 32);
+ uint8_t buf[12];
+ bs_read_bytes(bs, buf, 12);
+ mobj_parse_cmd(buf, &obj->cmds[i]);
}
return 1;
diff --git a/src/libbluray/hdmv/mobj_parse.h b/src/libbluray/hdmv/mobj_parse.h
index ac3dafd..e52aeb3 100644
--- a/src/libbluray/hdmv/mobj_parse.h
+++ b/src/libbluray/hdmv/mobj_parse.h
@@ -41,7 +41,7 @@ typedef struct {
uint8_t set_opt : 5; /* set option */
} HDMV_INSN;
-typedef struct {
+typedef struct bd_mobj_cmd_s {
HDMV_INSN insn;
uint32_t dst;
uint32_t src;
@@ -63,6 +63,7 @@ typedef struct {
BD_PRIVATE MOBJ_OBJECTS* mobj_parse(const char *path); /* 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. */
More information about the libbluray-devel
mailing list