libbluray | branch: master | hpi1 <[email protected]> | Tue Jun 6 11:04:27 2017 +0300| [ba3594235d134d73c3e0fd26278688aef5e1464a] | committer: hpi1
Improve bdj_test > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=ba3594235d134d73c3e0fd26278688aef5e1464a --- src/devtools/bdj_test.c | 59 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/src/devtools/bdj_test.c b/src/devtools/bdj_test.c index 870d6197..655adfa7 100644 --- a/src/devtools/bdj_test.c +++ b/src/devtools/bdj_test.c @@ -1,6 +1,7 @@ /* * This file is part of libbluray * Copyright (C) 2010 William Hahne + * Copyright (C) 2011-2017 Petri Hintukainen <[email protected]> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -29,6 +30,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <assert.h> #include "bluray.h" @@ -43,25 +45,72 @@ static void _usage(void) { int main(int argc, char** argv) { + int major, minor, micro; + const BLURAY_DISC_INFO *di; + BLURAY *bd; + + bd_get_version(&major, &minor, µ); + printf("Using libbluray version %d.%d.%d\n", major, minor, micro); + if (argc < 3) { _usage(); return 0; } - printf("%s %s\n", argv[1], argv[2]); + printf("Strating BD-J object %s from %s\n", argv[2], argv[1]); + + bd = bd_init(); + if (!bd) { + return -1; + } + + /* disable persistent storage */ + bd_set_player_setting(bd, BLURAY_PLAYER_SETTING_PERSISTENT_STORAGE, 0); - BLURAY* bd = bd_open(argv[1], NULL); + /* initialize event queue */ + bd_get_event(bd, NULL); + + /* check BD-J config */ + + di = bd_get_disc_info(bd); + assert(di != NULL); + + if (!di->libjvm_detected) { + fprintf(stderr, "JVM not found\n"); + goto fail; + } + if (!di->bdj_handled) { + fprintf(stderr, "libbluray.jar not found\n"); + goto fail; + } + + /* open disc */ + + if (!bd_open_disc(bd, argv[1], NULL)) { + fprintf(stderr, "bd_open_disc() failed\n"); + return -1; + } bd_get_titles(bd, TITLES_ALL, 0); if (!bd_start_bdj(bd, argv[2])) { printf("Failed to start BD-J application.\n"); - } else { - while (1) { sleep(20); } - bd_stop_bdj(bd); + goto fail; } + while (1) { + BD_EVENT ev; + while (bd_get_event(bd, &ev)) { + } + sleep(20); + } + + bd_stop_bdj(bd); bd_close(bd); return 0; + + fail: + bd_close(bd); + return -1; } _______________________________________________ libbluray-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libbluray-devel
