[libbluray-devel] [PATCH] API: add function to check whether BD-J is functional.
Andreas Zelend
ace at kodi.tv
Fri Apr 21 15:34:20 CEST 2017
2017-04-10 12:16 GMT+02:00 Petri Hintukainen <phintuka at users.sourceforge.net
>:
> Hello,
>
> We can add this to API if it would be useful. Maybe it would be more
> generic if it would return ex. bit mask of available features (BD-J,
> JVM, JAR, UDF, metadata, ...). Would there be any real use for the
> other flags ?
>
> Do you need to know BD-J status before opening the disc ? vlc/xine do
> similar check between bd_open() and bd_play() , and pop up a message or
> play the disc without menus if BD-J or some other required feature is
> missing.
>
Currently we have a similar check/pop-up when a user tries to start a disc
with a menu.
Our use case is as follows: Kodi has a setting for Blu-ray "discs" to
a) play the main title
b) show a simplified menu
c) show/play the disc's menu
If a user selects c) I would like to add a check and show a message if
something does not work.
Most probably that will be bd-j because of a missing/wrong jre.
>
> We could also make existing API to work without opening the disc. This
> information is in BLURAY_DISC_INFO. Something like:
> BLURAY *bd = bd_init();
> const BLURAY_DISC_INFO *info = bd_get_disc_info(bd);
> if (!info->bdj_handled) {
> ...
> }
> Currently these fields are not initialized if bd_open*() was not
> called, but that's easy to fix.
>
> Yes, that would be another way to achieve my goal.
>
> Before adding new API for this I'd like to discuss about simplifying
> the build configuration. I think we could unconditionally build BD-J
> and UDF support into the library. That does not add any new
> dependencies, and code size increase is not that big. Any opinions ?
>
Sure. I've planned to replace our udf code with your libudfread for some
time now, but my free-time is quite limited.
Bd-j menus from isos, e.g., do not work currently, since we use our own vfs.
>
> su, 2017-04-09 kello 13:13 +0200, Andreas Zelend kirjoitti:
> > From: ace20022 <ace20022 at ymail.com>
> >
> > ---
> > src/libbluray/bdj/bdj.c | 14 ++++++++++++++
> > src/libbluray/bdj/bdj.h | 1 +
> > src/libbluray/bluray.c | 10 ++++++++++
> > src/libbluray/bluray.h | 13 +++++++++++++
> > 4 files changed, 38 insertions(+)
> >
> > diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
> > index eeb3040f..8c6708f0 100644
> > --- a/src/libbluray/bdj/bdj.c
> > +++ b/src/libbluray/bdj/bdj.c
> > @@ -631,6 +631,20 @@ static int _bdj_init(JNIEnv *env, struct bluray
> > *bd, const char *disc_root, cons
> > return 1;
> > }
> >
> > +int bdj_functional()
> > +{
> > + BDJ_STORAGE* bds = calloc(1, sizeof(BDJ_STORAGE));
> > + if (!bds) {
> > + BD_DEBUG(DBG_CRIT, "out of memory\n");
> > + return 0;
> > + }
> > +
> > + int ret = bdj_jvm_available(bds);
> > + X_FREE(bds);
> > +
> > + return ret;
> > +}
> > +
> > int bdj_jvm_available(BDJ_STORAGE *storage)
> > {
> > const char *java_home;
> > diff --git a/src/libbluray/bdj/bdj.h b/src/libbluray/bdj/bdj.h
> > index 789e7fee..748c9917 100644
> > --- a/src/libbluray/bdj/bdj.h
> > +++ b/src/libbluray/bdj/bdj.h
> > @@ -81,5 +81,6 @@ BD_PRIVATE void bdj_close(BDJAVA *bdjava);
> > BD_PRIVATE int bdj_process_event(BDJAVA *bdjava, unsigned ev,
> > unsigned param);
> >
> > BD_PRIVATE int bdj_jvm_available(BDJ_STORAGE *storage); /* 0: no.
> > 1: only jvm. 2: jvm + libbluray.jar. */
> > +BD_PRIVATE int bdj_functional(); /* wrapper for bdj_jvm_available
> > without a specific disc*/
> >
> > #endif
> > diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
> > index 4eddac0f..9dd2577c 100644
> > --- a/src/libbluray/bluray.c
> > +++ b/src/libbluray/bluray.c
> > @@ -3862,3 +3862,13 @@ void bd_free_bdjo(struct bdjo_data *obj)
> > (void)obj;
> > #endif
> > }
> > +
> > +int bd_bdj_functional()
> > +{
> > +#ifdef USING_BDJAVA
> > + return bdj_functional();
> > +#else
> > + return -1;
> > +#endif
> > +
> > +}
> > diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
> > index e53a9779..53ea1abe 100644
> > --- a/src/libbluray/bluray.h
> > +++ b/src/libbluray/bluray.h
> > @@ -1086,6 +1086,19 @@ void bd_stop_bdj(BLURAY *bd); // shutdown BD-J
> > and clean up resources
> > */
> > int bd_read_file(BLURAY *, const char *path, void **data, int64_t
> > *size);
> >
> > +/**
> > +*
> > +* Check if BD-J is functional
> > +*
> > +* Checks whether BD-J support was compiled in and if so
> > +* whether jvm and/or libbluray.jar is usable or not.
> > +*
> > +* @return -1 if BD-J support was not compiled in,
> > +* 0: JVM library could not be loaded
> > +* 1: only the JVM library could be loaded
> > +* 2: the JVM library and the libbluray.jar could be loaded
> > +*/
> > +int bd_bdj_functional();
> >
> > #ifdef __cplusplus
> > }
> _______________________________________________
> libbluray-devel mailing list
> libbluray-devel at videolan.org
> https://mailman.videolan.org/listinfo/libbluray-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libbluray-devel/attachments/20170421/5b517c68/attachment.html>
More information about the libbluray-devel
mailing list