libbluray | branch: master | hpi1 <[email protected]> | Mon Feb 8 12:13:21 2016 +0200| [11dffdbce321446de6b8c41dd19b2c5d06ff667f] | committer: hpi1
Add bd_open_files() This deprecates old per-process file system access hooks. > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=11dffdbce321446de6b8c41dd19b2c5d06ff667f --- src/file/filesystem.h | 2 ++ src/libbluray/bluray.c | 13 +++++++++++++ src/libbluray/bluray.h | 16 ++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/file/filesystem.h b/src/file/filesystem.h index 8ec6f85..3fe54c8 100644 --- a/src/file/filesystem.h +++ b/src/file/filesystem.h @@ -71,6 +71,7 @@ typedef BD_DIR_H* (*BD_DIR_OPEN) (const char* dirname); * @param p function pointer * @return previous function pointer registered */ +/* deprecated - use bd_open_files() instead */ BD_FILE_OPEN bd_register_file(BD_FILE_OPEN p); /** @@ -80,6 +81,7 @@ BD_FILE_OPEN bd_register_file(BD_FILE_OPEN p); * @param p function pointer * @return previous function pointer registered */ +/* deprecated - use bd_open_files() instead */ BD_DIR_OPEN bd_register_dir(BD_DIR_OPEN p); #ifdef __cplusplus diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c index f030f53..e3342e4 100644 --- a/src/libbluray/bluray.c +++ b/src/libbluray/bluray.c @@ -1470,6 +1470,19 @@ int bd_open_stream(BLURAY *bd, return _bd_open(bd, NULL, NULL, &fs); } +int bd_open_files(BLURAY *bd, + void *handle, + struct bd_dir_s *(*open_dir)(void *handle, const char *rel_path), + struct bd_file_s *(*open_file)(void *handle, const char *rel_path)) +{ + if (!open_dir || !open_file) { + return 0; + } + + fs_access fs = { handle, NULL, open_dir, open_file }; + return _bd_open(bd, NULL, NULL, &fs); +} + BLURAY *bd_open(const char *device_path, const char *keyfile_path) { BLURAY *bd; diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h index 11e2eb6..41ba978 100644 --- a/src/libbluray/bluray.h +++ b/src/libbluray/bluray.h @@ -335,6 +335,22 @@ int bd_open_stream(BLURAY *bd, int (*read_blocks)(void *handle, void *buf, int lba, int num_blocks)); /** + * Open BluRay disc + * + * @param bd BLURAY object + * @param handle opaque handle for open_dir and open_file + * @param open_dir function used to open a directory + * @param open_file function used to open a file + * @return 1 on success, 0 if error + */ +struct bd_dir_s; +struct bd_file_s; +int bd_open_files(BLURAY *bd, + void *handle, + struct bd_dir_s *(*open_dir)(void *handle, const char *rel_path), + struct bd_file_s *(*open_file)(void *handle, const char *rel_path)); + +/** * Close BluRay disc * * @param bd BLURAY object _______________________________________________ libbluray-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libbluray-devel
