libbluray | branch: master | hpi1 <[email protected]> | Thu Mar 27 12:59:19 2014 +0200| [2d5ca72116959c59f2ea229bdfeae5e506385141] | committer: hpi1
index_parse: take path to disc root instead of path to index.bdmv > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=2d5ca72116959c59f2ea229bdfeae5e506385141 --- src/libbluray/bdnav/index_parse.c | 30 +++++++++++++++--------------- src/libbluray/bdnav/index_parse.h | 2 +- src/libbluray/bluray.c | 19 +------------------ 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/libbluray/bdnav/index_parse.c b/src/libbluray/bdnav/index_parse.c index 981024b..f07c261 100644 --- a/src/libbluray/bdnav/index_parse.c +++ b/src/libbluray/bdnav/index_parse.c @@ -21,6 +21,7 @@ #include "util/bits.h" #include "util/logging.h" #include "util/macro.h" +#include "util/strutl.h" #include "index_parse.h" #include <stdlib.h> @@ -193,24 +194,23 @@ static INDX_ROOT *_indx_parse(const char *file_name) return NULL; } -INDX_ROOT *indx_parse(const char *file_name) +INDX_ROOT *indx_parse(const char *disc_root) { - INDX_ROOT *indx = _indx_parse(file_name); - - /* if failed, try backup file */ - if (!indx) { - size_t len = strlen(file_name); - char *backup = malloc(len + 8); - - strcpy(backup, file_name); - strcpy(backup + len - 10, "BACKUP/index.bdmv"); - - indx = _indx_parse(backup); - - X_FREE(backup); + INDX_ROOT *index; + char *file; + + file = str_printf("%s/BDMV/index.bdmv", disc_root); + index = _indx_parse(file); + X_FREE(file); + if (index) { + return index; } - return indx; + /* try backup */ + file = str_printf("%s/BDMV/BACKUP/index.bdmv", disc_root); + index = _indx_parse(file); + X_FREE(file); + return index; } void indx_free(INDX_ROOT **p) diff --git a/src/libbluray/bdnav/index_parse.h b/src/libbluray/bdnav/index_parse.h index e32cf14..c26bb42 100644 --- a/src/libbluray/bdnav/index_parse.h +++ b/src/libbluray/bdnav/index_parse.h @@ -115,7 +115,7 @@ typedef struct indx_root_s { } INDX_ROOT; -BD_PRIVATE INDX_ROOT* indx_parse(const char *path); /* parse index.bdmv */ +BD_PRIVATE INDX_ROOT* indx_parse(const char *disc_root); /* parse index.bdmv */ BD_PRIVATE void indx_free(INDX_ROOT **index); #endif // _INDX_PARSE_H_ diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c index 6ff98ed..76a535f 100644 --- a/src/libbluray/bluray.c +++ b/src/libbluray/bluray.c @@ -897,23 +897,6 @@ static int _libbdplus_init(BLURAY *bd) } /* - * index open - */ - -static int _index_open(BLURAY *bd) -{ - if (!bd->index) { - char *file; - - file = str_printf("%s/BDMV/index.bdmv", bd->device_path); - bd->index = indx_parse(file); - X_FREE(file); - } - - return !!bd->index; -} - -/* * meta open */ @@ -1370,7 +1353,7 @@ BLURAY *bd_open(const char* device_path, const char* keyfile_path) _libbdplus_init(bd); - _index_open(bd); + bd->index = indx_parse(bd->device_path); _fill_disc_info(bd); _______________________________________________ libbluray-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libbluray-devel
