[libbluray-devel] Fix checking for empty disc index

hpi1 git at videolan.org
Sun Sep 2 10:33:04 CEST 2018


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Sep  2 11:29:33 2018 +0300| [c7b971e0cf97f90d25933f3e128b2ea8359ec086] | committer: hpi1

Fix checking for empty disc index

- fixes playback of discs with only first play or top menu title.

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

 src/libbluray/bdnav/index_parse.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/libbluray/bdnav/index_parse.c b/src/libbluray/bdnav/index_parse.c
index 0deb6176..b7cc18ea 100644
--- a/src/libbluray/bdnav/index_parse.c
+++ b/src/libbluray/bdnav/index_parse.c
@@ -105,8 +105,14 @@ static int _parse_index(BITSTREAM *bs, INDX_ROOT *index)
 
     index->num_titles = bs_read(bs, 16);
     if (!index->num_titles) {
-        BD_DEBUG(DBG_CRIT, "empty index\n");
-        return 0;
+        /* no "normal" titles - check for first play and top menu */
+        if ((index->first_play.object_type == indx_object_type_hdmv && index->first_play.hdmv.id_ref == 0xffff) &&
+            (index->top_menu.object_type == indx_object_type_hdmv && index->top_menu.hdmv.id_ref == 0xffff)) {
+
+            BD_DEBUG(DBG_CRIT, "empty index\n");
+            return 0;
+        }
+        return 1;
     }
 
     index->titles = calloc(index->num_titles, sizeof(INDX_TITLE));



More information about the libbluray-devel mailing list