[libbluray-devel] MovieObject.bdmv: accept version 0300 files

hpi1 git at videolan.org
Tue Sep 5 10:25:05 CEST 2017


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Sep  5 09:49:11 2017 +0300| [011a0dc652bb8ddbbd40b3b6f6e073ecd9d471fd] | committer: hpi1

MovieObject.bdmv: accept version 0300 files

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

 src/libbluray/hdmv/mobj_data.h  |  3 ++-
 src/libbluray/hdmv/mobj_parse.c | 35 +++++++++++------------------------
 2 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/src/libbluray/hdmv/mobj_data.h b/src/libbluray/hdmv/mobj_data.h
index b6fcc94f..3601fdd2 100644
--- a/src/libbluray/hdmv/mobj_data.h
+++ b/src/libbluray/hdmv/mobj_data.h
@@ -1,6 +1,6 @@
 /*
  * This file is part of libbluray
- * Copyright (C) 2010  Petri Hintukainen <phintuka at users.sourceforge.net>
+ * Copyright (C) 2010-2017  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
@@ -55,6 +55,7 @@ typedef struct {
 } MOBJ_OBJECT;
 
 typedef struct mobj_objects {
+    uint32_t    mobj_version;
     uint16_t    num_objects;
     MOBJ_OBJECT *objects;
 } MOBJ_OBJECTS;
diff --git a/src/libbluray/hdmv/mobj_parse.c b/src/libbluray/hdmv/mobj_parse.c
index e407364b..e33f7e7d 100644
--- a/src/libbluray/hdmv/mobj_parse.c
+++ b/src/libbluray/hdmv/mobj_parse.c
@@ -1,6 +1,6 @@
 /*
  * This file is part of libbluray
- * Copyright (C) 2010  Petri Hintukainen <phintuka at users.sourceforge.net>
+ * Copyright (C) 2010-2017  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
@@ -25,6 +25,7 @@
 
 #include "mobj_data.h"
 
+#include "bdnav/bdmv_parse.h"
 #include "disc/disc.h"
 
 #include "file/file.h"
@@ -37,27 +38,13 @@
 #include <string.h>
 
 #define MOBJ_SIG1  ('M' << 24 | 'O' << 16 | 'B' << 8 | 'J')
-#define MOBJ_SIG2A ('0' << 24 | '2' << 16 | '0' << 8 | '0')
-#define MOBJ_SIG2B ('0' << 24 | '1' << 16 | '0' << 8 | '0')
 
-static int _mobj_parse_header(BITSTREAM *bs, int *extension_data_start)
+static int _mobj_parse_header(BITSTREAM *bs, int *extension_data_start, uint32_t *mobj_version)
 {
-    uint32_t sig1, sig2;
-
-    if (bs_seek_byte(bs, 0) < 0) {
+    if (!bdmv_parse_header(bs, MOBJ_SIG1, mobj_version)) {
         return 0;
     }
 
-    sig1 = bs_read(bs, 32);
-    sig2 = bs_read(bs, 32);
-
-    if (sig1 != MOBJ_SIG1 ||
-       (sig2 != MOBJ_SIG2A &&
-        sig2 != MOBJ_SIG2B)) {
-     BD_DEBUG(DBG_NAV, "MovieObject.bdmv failed signature match: expected MOBJ0100 got %8.8s\n", bs->buf);
-     return 0;
-    }
-
     *extension_data_start = bs_read(bs, 32);
 
     return 1;
@@ -151,7 +138,13 @@ static MOBJ_OBJECTS *_mobj_parse(BD_FILE_H *fp)
         goto error;
     }
 
-    if (!_mobj_parse_header(&bs, &extension_data_start)) {
+    objects = calloc(1, sizeof(MOBJ_OBJECTS));
+    if (!objects) {
+        BD_DEBUG(DBG_CRIT, "out of memory\n");
+        goto error;
+    }
+
+    if (!_mobj_parse_header(&bs, &extension_data_start, &objects->mobj_version)) {
         BD_DEBUG(DBG_NAV | DBG_CRIT, "MovieObject.bdmv: invalid header\n");
         goto error;
     }
@@ -172,12 +165,6 @@ static MOBJ_OBJECTS *_mobj_parse(BD_FILE_H *fp)
         goto error;
     }
 
-    objects = calloc(1, sizeof(MOBJ_OBJECTS));
-    if (!objects) {
-        BD_DEBUG(DBG_CRIT, "out of memory\n");
-        goto error;
-    }
-
     bs_skip(&bs, 32); /* reserved */
     num_objects = bs_read(&bs, 16);
 



More information about the libbluray-devel mailing list