Skip to content
Commits on Source (12)
- Add support for compiling .jar file with Java 9+ compiler.
2017-12-01: Version 1.0.2
- Add initial support for UHD BluRay discs (without BD-J menus).
- Detect JRE (from the Java Applet plugin) on MacOS.
......
......@@ -226,6 +226,18 @@ pkginclude_HEADERS = \
if USING_BDJAVA_BUILD_JAR
if USING_JAVAC_9
java_versions = -Djava_version_asm=1.6 -Djava_version_bdj=1.6
else
java_versions = -Djava_version_asm=1.5 -Djava_version_bdj=1.4
endif
if BDJ_J2SE
awt_src = java-$(BDJ_TYPE):java-build-support
else
awt_src = java-$(BDJ_TYPE)
endif
jardir=$(datadir)/java/
jar_DATA = \
$(top_builddir)/.libs/libbluray-$(BDJ_TYPE)-$(VERSION).jar \
......@@ -237,7 +249,8 @@ all-local:
ant -f $(top_srcdir)/src/libbluray/bdj/build.xml \
-Dbuild='$(abs_builddir)/src/libbluray/bdj/build' \
-Ddist='$(abs_builddir)/.libs' \
-Dsrc_awt=:java-$(BDJ_TYPE) \
-Dsrc_awt=:$(awt_src) \
$(java_versions) \
-Dbootclasspath="$(BDJ_BOOTCLASSPATH)" \
-Dversion='$(BDJ_TYPE)-$(VERSION)'
......
......@@ -112,6 +112,9 @@ AC_ARG_WITH([bdj-bootclasspath],
[BDJ_BOOTCLASSPATH=$withval],
[BDJ_BOOTCLASSPATH=])
AC_ARG_WITH([java9],
[AS_HELP_STRING([--with-java9], [build with Java 9+ (drop support for Java <1.6) @<:@default=without@:>@])])
dnl required programs
AC_PROG_CC
AM_PROG_CC_C_O
......@@ -228,14 +231,35 @@ AS_IF([test "x${JDK_HOME}" != "x"], [
BDJAVA_CFLAGS='-I${abs_top_srcdir}/jni -I${abs_top_srcdir}/jni/'"${java_os}"
])
AC_CHECK_PROG(HAVE_ANT, [ant], yes, no)
if test "x$use_bdjava_jar" = "xyes" && test "x$HAVE_ANT" = "xno"; then
AC_MSG_ERROR([BD-J requires ANT, but ant was not found. Please install it.])
fi
AS_IF([test "x$use_bdjava_jar" = "xyes"], [
dnl check for ant
AC_CHECK_PROG(HAVE_ANT, [ant], yes, no)
AS_IF([test "x$HAVE_ANT" = "xno"], [
AC_MSG_ERROR([BD-J requires ANT, but ant was not found. Install ant or disable jar file building (--disable-bdjava-jar)])
])
AS_IF([test "x$with_java9" = "x" -a "$BDJ_TYPE" != "j2me"], [
dnl check for javac
AS_IF([test "x${JAVA_HOME}" != "x"],
[AC_PATH_PROG(JAVAC, javac, none, ["${JAVA_HOME}/bin"])],
[AC_PATH_PROG(JAVAC, javac, none)])
AS_IF([test x"$JAVAC" = x"none"],
[AC_MSG_WARN([javac not found. Disable jar file building (--disable-bdjava-jar), set JAVA_HOME or javac type with --with[out]-java9 option.])])
dnl check for Java 9+
javac_version=`"$JAVAC" -version 2>&1 | head -n 1`
[with_java9=`echo "$javac_version" | grep -E -q '^javac\ (9|1[0-9])' && echo yes`]
])
AS_IF([test "x$with_java9" = "xyes" -a "$BDJ_TYPE" != "j2me"], [java_code_version=1.6], [java_code_version=1.4])
])
AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$java_arch"], ["Defines the architecture of the java vm."])
AC_DEFINE_UNQUOTED([JDK_HOME], ["$JDK_HOME"], [""])
AM_CONDITIONAL([USING_BDJAVA_BUILD_JAR], [ test $use_bdjava_jar = "yes" ])
AM_CONDITIONAL([USING_JAVAC_9], [ test x"$with_java9" = x"yes" ])
dnl BD-J type
if test "$BDJ_TYPE" = "j2me"; then
......@@ -244,6 +268,7 @@ else
BDJ_TYPE=j2se
fi
AC_SUBST(BDJ_TYPE)
AM_CONDITIONAL([BDJ_J2SE], [ test x"$BDJ_TYPE" != x"j2me" ])
dnl bootclasspath
AC_SUBST(BDJ_BOOTCLASSPATH)
......@@ -286,6 +311,12 @@ echo " Summary:"
echo " --------"
echo " BD-J type: $BDJ_TYPE"
echo " build JAR: $use_bdjava_jar"
if test "x$use_bdjava_jar" = "xyes"; then
if test "x$javac_version" != "x"; then
echo " javac version: $javac_version"
fi
echo " Java binary version: $java_code_version"
fi
if test x"$BDJ_BOOTCLASSPATH" != x""; then
echo " BD-J bootclasspath: $BDJ_BOOTCLASSPATH"
fi
......
/*
* This file is part of libbluray
* Copyright (C) 2010 William Hahne
* Copyright (C) 2012 Petri Hintukainen <phintuka@users.sourceforge.net>
* Copyright (C) 2012-2019 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -743,18 +743,18 @@ int bdj_jvm_available(BDJ_STORAGE *storage)
void* jvm_lib = _load_jvm(&java_home);
if (!jvm_lib) {
BD_DEBUG(DBG_BDJ | DBG_CRIT, "BD-J check: Failed to load JVM library\n");
return 0;
return BDJ_CHECK_NO_JVM;
}
dl_dlclose(jvm_lib);
if (!_find_libbluray_jar(storage)) {
BD_DEBUG(DBG_BDJ | DBG_CRIT, "BD-J check: Failed to load libbluray.jar\n");
return 1;
return BDJ_CHECK_NO_JAR;
}
BD_DEBUG(DBG_BDJ, "BD-J check: OK\n");
return 2;
return BDJ_CHECK_OK;
}
static int _find_jvm(void *jvm_lib, JNIEnv **env, JavaVM **jvm)
......
/*
* This file is part of libbluray
* Copyright (C) 2010 William Hahne
* Copyright (C) 2012-2019 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -80,7 +81,13 @@ BD_PRIVATE BDJAVA* bdj_open(const char *path, struct bluray *bd,
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. */
enum {
BDJ_CHECK_OK = 0,
BDJ_CHECK_NO_JVM = 1,
BDJ_CHECK_NO_JAR = 2,
};
BD_PRIVATE int bdj_jvm_available(BDJ_STORAGE *storage); /* rreturn: BDJ_CHECK_* */
BD_PRIVATE void bdj_storage_cleanup(BDJ_STORAGE *);
......
......@@ -10,6 +10,8 @@
<property name="src_asm" value="../../../contrib/asm/src/"/>
<property name="bootclasspath" value=""/>
<property name="version" value=""/>
<property name="java_version_asm" value="1.5"/>
<property name="java_version_bdj" value="1.4"/>
<target name="init">
<tstamp/>
......@@ -21,13 +23,13 @@
description="compile the source " >
<javac srcdir="${src_asm}" destdir="${build}" debug="yes"
bootclasspath="${bootclasspath}"
source="1.5" target="1.5">
source="${java_version_asm}" target="${java_version_asm}">
<compilerarg value="-XDignore.symbol.file"/>
<compilerarg value="-Xlint:-deprecation"/>
</javac>
<javac srcdir="${src}${src_awt}" destdir="${build}" debug="yes"
bootclasspath="${bootclasspath}"
source="1.4" target="1.4">
source="${java_version_bdj}" target="${java_version_bdj}">
<compilerarg value="-XDignore.symbol.file"/>
<compilerarg value="-Xlint:-deprecation"/>
</javac>
......@@ -41,6 +43,9 @@
<jar jarfile="${dist}/libbluray-awt-${version}.jar" basedir="${build}">
<include name="java/awt/**" />
<include name="sun/**" />
<!-- following classes are used only at build time -->
<exclude name="sun/awt/CausedFocusEvent**" />
<exclude name="java/awt/event/FocusEvent**" />
</jar>
</target>
......
/*
* This file is part of libbluray
* Copyright (C) 2019 libbluray
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
package java.awt.event;
import java.awt.Component;
public class FocusEvent extends ComponentEvent {
/*
* Dummy class used during compilation
*
* This class is used at compile time to hide Java 8 / Java 9 differences in
* java.awt.peer.*, java.awt.FocusEvent and sun.awt.CausedFocusEvent.
*
* This allows compiling special version of BDFramePeer
* that will work both in Java < 9 and Java > 9.
* Correct methods and dependencies are automatically selected at run time,
* thanks to Java on-demand linking.
*
* NOTE:
* This class is not complete and should not be included at runtime.
*
*/
static {
if (System.getProperty("does_not_exist") == null)
throw new Error("This class should not be included at run time");
}
public class /* enum */ Cause {
}
/* Needed when compiling for HaVi */
public static final int FOCUS_FIRST = 1004;
public static final int FOCUS_LAST = 1005;
public static final int FOCUS_GAINED = FOCUS_FIRST;
public static final int FOCUS_LOST = 1 + FOCUS_FIRST;
public FocusEvent(Component src, int id, boolean t) {
super(src, id);
}
public FocusEvent(Component src, int id) {
super(src, id);
}
}
/*
* This file is part of libbluray
* Copyright (C) 2019 libbluray
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
package sun.awt;
import java.awt.event.FocusEvent;
import java.awt.Component;
public class CausedFocusEvent extends FocusEvent {
/*
* Dummy class used during compilation
*
* This class is used at compile time to hide Java 8 / Java 9 differences in
* java.awt.peer.*, java.awt.FocusEvent and sun.awt.CausedFocusEvent.
*
* This allows compiling special version of BDFramePeer
* that will work both in Java < 9 and Java > 9.
* Correct methods and dependencies are automatically selected at run time,
* thanks to Java on-demand linking.
*
* NOTE:
* This class is not complete and should not be included at runtime.
*
*/
static {
if (System.getProperty("does_not_exist") == null)
throw new Error("This class should not be included at run time");
}
public class /* enum */ Cause {
};
public CausedFocusEvent(Component src, int id) {
super(src, id);
}
}
/*
* This file is part of libbluray
* Copyright (C) 2012 Petri Hintukainen <phintuka@users.sourceforge.net>
* Copyright (C) 2012-2019 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -173,7 +173,20 @@ public class BDFramePeer extends BDComponentPeer implements FramePeer
return ((BDToolkit)BDToolkit.getDefaultToolkit()).createImage((Component)null, width, height);
}
/* Java >= 9 */
public boolean requestFocus(Component c/*lightweightChild*/, boolean a/*temporary*/,
boolean b/*focusedWindowChangeAllowed*/, long l/*time*/,
java.awt.event.FocusEvent.Cause cause
) {
return requestFocusHelper(c, a, b, l);
}
/* Java < 9 */
public boolean requestFocus(Component c, boolean a, boolean b, long l, sun.awt.CausedFocusEvent.Cause d) {
return requestFocusHelper(c, a, b, l);
}
private boolean requestFocusHelper(Component c, boolean a, boolean b, long l) {
if (c == null) {
return true;
}
......
/*
* This file is part of libbluray
* Copyright (C) 2010 William Hahne
* Copyright (C) 2019 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -19,14 +20,26 @@
package org.havi.ui;
import org.blurayx.s3d.ui.HBackgroundConfigTemplateS3D;
import org.blurayx.uhd.ui.HBackgroundConfigurationTemplateUHD;
import java.awt.Color;
public class HBackgroundDevice extends HScreenDevice {
protected HBackgroundDevice() {
boolean is_p6 = isProfile6();
boolean is_p5 = isProfile5();
int length = HScreenConfigTemplate.defaultConfig.length;
hbcArray = new HBackgroundConfiguration[length];
for (int i = 0; i < length; i++) {
HBackgroundConfigTemplate hbct = new HBackgroundConfigTemplate();
HBackgroundConfigTemplate hbct;
if (is_p6) {
hbct = new HBackgroundConfigurationTemplateUHD();
} else if (is_p5) {
hbct = new HBackgroundConfigTemplateS3D();
} else {
hbct = new HBackgroundConfigTemplate();
}
HScreenConfigTemplate.initDefaultConfigTemplate(hbct, i);
hbcArray[i] = new HStillImageBackgroundConfiguration(hbct, new Color(0, 0, 0, 0));
}
......
/*
* This file is part of libbluray
* Copyright (C) 2010 William Hahne
* Copyright (C) 2019 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -19,6 +20,9 @@
package org.havi.ui;
import org.blurayx.s3d.ui.HGraphicsConfigTemplateS3D;
import org.blurayx.uhd.ui.HGraphicsConfigurationTemplateUHD;
import java.awt.Dimension;
import org.videolan.GUIManager;
......@@ -26,10 +30,19 @@ import org.videolan.Logger;
public class HGraphicsDevice extends HScreenDevice {
protected HGraphicsDevice() {
boolean is_p6 = isProfile6();
boolean is_p5 = isProfile5();
int length = HScreenConfigTemplate.defaultConfig.length;
hgcArray = new HGraphicsConfiguration[length];
for (int i = 0; i < length; i++) {
HGraphicsConfigTemplate hgct = new HGraphicsConfigTemplate();
HGraphicsConfigTemplate hgct;
if (is_p6) {
hgct = new HGraphicsConfigurationTemplateUHD();
} else if (is_p5) {
hgct = new HGraphicsConfigTemplateS3D();
} else {
hgct = new HGraphicsConfigTemplate();
}
HScreenConfigTemplate.initDefaultConfigTemplate(hgct, i);
hgcArray[i] = new HGraphicsConfiguration(hgct);
}
......
/*
* This file is part of libbluray
* Copyright (C) 2010 William Hahne
* Copyright (C) 2019 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -38,6 +39,15 @@ public class HScreenDevice implements ResourceProxy, ResourceServer {
HScreenDevice() {
}
protected boolean isProfile5() {
String p = System.getProperty("bluray.profile.5");
return (p != null && p.equals("YES"));
}
protected boolean isProfile6() {
String p = System.getProperty("bluray.profile.6");
return (p != null && p.equals("YES"));
}
public String getIDstring() {
return "HAVi Screen Device";
}
......
/*
* This file is part of libbluray
* Copyright (C) 2010 William Hahne
* Copyright (C) 2019 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -19,12 +20,24 @@
package org.havi.ui;
import org.blurayx.s3d.ui.HVideoConfigTemplateS3D;
import org.blurayx.uhd.ui.HVideoConfigurationTemplateUHD;
public class HVideoDevice extends HScreenDevice {
protected HVideoDevice() {
boolean is_p6 = isProfile6();
boolean is_p5 = isProfile5();
int length = HScreenConfigTemplate.defaultConfig.length;
hvcArray = new HVideoConfiguration[length];
for (int i = 0; i < length; i++) {
HVideoConfigTemplate hvct = new HVideoConfigTemplate();
HVideoConfigTemplate hvct;
if (is_p6) {
hvct = new HVideoConfigurationTemplateUHD();
} else if (is_p5) {
hvct = new HVideoConfigTemplateS3D();
} else {
hvct = new HVideoConfigTemplate();
}
HScreenConfigTemplate.initDefaultConfigTemplate(hvct, i);
hvcArray[i] = new HVideoConfiguration(hvct);
}
......
......@@ -195,6 +195,55 @@ static int _parse_header(BITSTREAM *bs,
return 1;
}
static int _parse_indx_extension_hevc(BITSTREAM *bs, INDX_ROOT *index)
{
uint32_t len;
unsigned unk0, unk1, unk2, unk3, unk4;
len = bs_read(bs, 32);
if (len < 8) {
BD_DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv: unsupported extension 3.1 length (%d)\n", len);
return 0;
}
index->disc_type = bs_read(bs, 4);
unk0 = bs_read(bs, 3);
index->exist_4k_flag = bs_read(bs, 1);
unk1 = bs_read(bs, 8);
unk2 = bs_read(bs, 6);
index->hdr_flags = bs_read(bs, 2);
unk3 = bs_read(bs, 8);
unk4 = bs_read(bs, 32);
BD_DEBUG(DBG_NAV, "UHD disc type: %d, 4k: %d, HDR: %d\n",
index->disc_type, index->exist_4k_flag, index->hdr_flags);
if (unk0 | unk1 | unk2 | unk3 | unk4) {
BD_DEBUG(DBG_CRIT|DBG_NAV,
"index.bdmv: unknown data in extension 3.1: "
"0x%02x 0x%02x 0x%02x 0x%02x 0x%08x\n", unk0, unk1, unk2, unk3, unk4);
}
return 1;
}
static int
_parse_indx_extension(BITSTREAM *bits, int id1, int id2, void *handle)
{
INDX_ROOT *index = (INDX_ROOT *)handle;
(void)bits;
if (id1 == 3) {
if (id2 == 1) {
return _parse_indx_extension_hevc(bits, index);
}
}
BD_DEBUG(DBG_NAV | DBG_CRIT, "_parse_indx_extension(): unknown extension %d.%d\n", id1, id2);
return 0;
}
static INDX_ROOT *_indx_parse(BD_FILE_H *fp)
{
BITSTREAM bs;
......@@ -230,7 +279,10 @@ static INDX_ROOT *_indx_parse(BD_FILE_H *fp)
}
if (extension_data_start) {
BD_DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv: unknown extension data at %u\n", (unsigned)extension_data_start);
bdmv_parse_extension_data(&bs,
extension_data_start,
_parse_indx_extension,
index);
}
return index;
......
......@@ -114,6 +114,11 @@ typedef struct indx_root_s {
INDX_TITLE *titles;
uint32_t indx_version;
/* UHD extension */
uint8_t disc_type;
uint8_t exist_4k_flag;
uint8_t hdr_flags;
} INDX_ROOT;
......
......@@ -45,11 +45,11 @@
*/
static uint32_t
_pl_duration(MPLS_PL *pl)
_pl_duration(const MPLS_PL *pl)
{
unsigned ii;
uint32_t duration = 0;
MPLS_PI *pi;
const MPLS_PI *pi;
for (ii = 0; ii < pl->list_count; ii++) {
pi = &pl->play_item[ii];
......@@ -59,7 +59,7 @@ _pl_duration(MPLS_PL *pl)
}
static uint32_t
_pl_chapter_count(MPLS_PL *pl)
_pl_chapter_count(const MPLS_PL *pl)
{
unsigned ii, chapters = 0;
......@@ -77,7 +77,7 @@ _pl_chapter_count(MPLS_PL *pl)
* Check if two playlists are the same
*/
static int _stream_cmp(MPLS_STREAM *a, MPLS_STREAM *b)
static int _stream_cmp(const MPLS_STREAM *a, const MPLS_STREAM *b)
{
if (a->stream_type == b->stream_type &&
a->coding_type == b->coding_type &&
......@@ -93,7 +93,7 @@ static int _stream_cmp(MPLS_STREAM *a, MPLS_STREAM *b)
return 1;
}
static int _streams_cmp(MPLS_STREAM *s1, MPLS_STREAM *s2, unsigned count)
static int _streams_cmp(const MPLS_STREAM *s1, const MPLS_STREAM *s2, unsigned count)
{
unsigned ii;
for (ii = 0; ii < count; ii++) {
......@@ -104,7 +104,7 @@ static int _streams_cmp(MPLS_STREAM *s1, MPLS_STREAM *s2, unsigned count)
return 0;
}
static int _pi_cmp(MPLS_PI *pi1, MPLS_PI *pi2)
static int _pi_cmp(const MPLS_PI *pi1, const MPLS_PI *pi2)
{
if (memcmp(pi1->clip[0].clip_id, pi2->clip[0].clip_id, 5) != 0 ||
pi1->in_time != pi2->in_time ||
......@@ -133,7 +133,7 @@ static int _pi_cmp(MPLS_PI *pi1, MPLS_PI *pi2)
return 0;
}
static int _pm_cmp(MPLS_PLM *pm1, MPLS_PLM *pm2)
static int _pm_cmp(const MPLS_PLM *pm1, const MPLS_PLM *pm2)
{
if (pm1->mark_type == pm2->mark_type &&
pm1->play_item_ref == pm2->play_item_ref &&
......@@ -146,7 +146,7 @@ static int _pm_cmp(MPLS_PLM *pm1, MPLS_PLM *pm2)
return 1;
}
static int _pl_cmp(MPLS_PL *pl1, MPLS_PL *pl2)
static int _pl_cmp(const MPLS_PL *pl1, const MPLS_PL *pl2)
{
unsigned ii;
......@@ -182,7 +182,7 @@ static int _pl_cmp(MPLS_PL *pl1, MPLS_PL *pl2)
*/
/* return 0 if duplicate playlist */
static int _filter_dup(MPLS_PL *pl_list[], unsigned count, MPLS_PL *pl)
static int _filter_dup(MPLS_PL *pl_list[], unsigned count, const MPLS_PL *pl)
{
unsigned ii;
......@@ -195,12 +195,12 @@ static int _filter_dup(MPLS_PL *pl_list[], unsigned count, MPLS_PL *pl)
}
static unsigned int
_find_repeats(MPLS_PL *pl, const char *m2ts, uint32_t in_time, uint32_t out_time)
_find_repeats(const MPLS_PL *pl, const char *m2ts, uint32_t in_time, uint32_t out_time)
{
unsigned ii, count = 0;
for (ii = 0; ii < pl->list_count; ii++) {
MPLS_PI *pi;
const MPLS_PI *pi;
pi = &pl->play_item[ii];
// Ignore titles with repeated segments
......@@ -214,12 +214,12 @@ _find_repeats(MPLS_PL *pl, const char *m2ts, uint32_t in_time, uint32_t out_time
}
static int
_filter_repeats(MPLS_PL *pl, unsigned repeats)
_filter_repeats(const MPLS_PL *pl, unsigned repeats)
{
unsigned ii;
for (ii = 0; ii < pl->list_count; ii++) {
MPLS_PI *pi;
const MPLS_PI *pi;
pi = &pl->play_item[ii];
// Ignore titles with repeated segments
......@@ -236,7 +236,7 @@ _filter_repeats(MPLS_PL *pl, unsigned repeats)
#define DBG_MAIN_PL DBG_NAV
static void _video_props(MPLS_STN *s, int *format, int *codec)
static void _video_props(const MPLS_STN *s, int *format, int *codec)
{
unsigned ii;
*codec = 0;
......@@ -261,7 +261,7 @@ static void _video_props(MPLS_STN *s, int *format, int *codec)
}
}
static void _audio_props(MPLS_STN *s, int *hd_audio)
static void _audio_props(const MPLS_STN *s, int *hd_audio)
{
unsigned ii;
*hd_audio = 0;
......@@ -274,8 +274,8 @@ static void _audio_props(MPLS_STN *s, int *hd_audio)
static int _cmp_video_props(const MPLS_PL *p1, const MPLS_PL *p2)
{
MPLS_STN *s1 = &p1->play_item[0].stn;
MPLS_STN *s2 = &p2->play_item[0].stn;
const MPLS_STN *s1 = &p1->play_item[0].stn;
const MPLS_STN *s2 = &p2->play_item[0].stn;
int format1, format2, codec1, codec2;
_video_props(s1, &format1, &codec1);
......@@ -291,8 +291,8 @@ static int _cmp_video_props(const MPLS_PL *p1, const MPLS_PL *p2)
static int _cmp_audio_props(const MPLS_PL *p1, const MPLS_PL *p2)
{
MPLS_STN *s1 = &p1->play_item[0].stn;
MPLS_STN *s2 = &p2->play_item[0].stn;
const MPLS_STN *s1 = &p1->play_item[0].stn;
const MPLS_STN *s2 = &p2->play_item[0].stn;
int hda1, hda2;
_audio_props(s1, &hda1);
......@@ -302,7 +302,7 @@ static int _cmp_audio_props(const MPLS_PL *p1, const MPLS_PL *p2)
return hda2 - hda1;
}
static int _pl_guess_main_title(MPLS_PL *p1, MPLS_PL *p2,
static int _pl_guess_main_title(const MPLS_PL *p1, const MPLS_PL *p2,
const char *mpls_id1, const char *mpls_id2,
const char *known_mpls_ids)
{
......@@ -512,12 +512,12 @@ uint8_t nav_lookup_aspect(NAV_CLIP *clip, int pid)
}
static void
_fill_mark(NAV_TITLE *title, NAV_MARK *mark, int entry)
_fill_mark(const NAV_TITLE *title, NAV_MARK *mark, int entry)
{
MPLS_PL *pl = title->pl;
MPLS_PLM *plm;
MPLS_PI *pi;
NAV_CLIP *clip;
const MPLS_PL *pl = title->pl;
const MPLS_PLM *plm;
const MPLS_PI *pi;
const NAV_CLIP *clip;
plm = &pl->play_mark[entry];
......@@ -547,9 +547,9 @@ _extrapolate_title(NAV_TITLE *title)
uint32_t duration = 0;
uint32_t pkt = 0;
unsigned ii, jj;
MPLS_PL *pl = title->pl;
MPLS_PI *pi;
MPLS_PLM *plm;
const MPLS_PL *pl = title->pl;
const MPLS_PI *pi;
const MPLS_PLM *plm;
NAV_MARK *mark, *prev = NULL;
NAV_CLIP *clip;
......@@ -599,7 +599,7 @@ _extrapolate_title(NAV_TITLE *title)
}
static void _fill_clip(NAV_TITLE *title,
MPLS_CLIP *mpls_clip,
const MPLS_CLIP *mpls_clip,
uint8_t connection_condition, uint32_t in_time, uint32_t out_time,
unsigned pi_angle_count,
NAV_CLIP *clip,
......@@ -733,7 +733,7 @@ NAV_TITLE* nav_title_open(BD_DISC *disc, const char *playlist, unsigned angle)
}
title->packets = 0;
for (ii = 0; ii < title->pl->list_count; ii++) {
MPLS_PI *pi;
const MPLS_PI *pi;
NAV_CLIP *clip;
pi = &title->pl->play_item[ii];
......@@ -771,7 +771,7 @@ NAV_TITLE* nav_title_open(BD_DISC *disc, const char *playlist, unsigned angle)
pos = time = 0;
for (ii = 0; ii < sub_path->clip_list.count; ii++) {
MPLS_SUB_PI *pi = &title->pl->sub_path[ss].sub_play_item[ii];
const MPLS_SUB_PI *pi = &title->pl->sub_path[ss].sub_play_item[ii];
NAV_CLIP *clip = &sub_path->clip_list.clip[ii];
_fill_clip(title, pi->clip, pi->connection_condition, pi->in_time, pi->out_time, 0,
......@@ -944,7 +944,7 @@ uint32_t nav_angle_change_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *time)
NAV_CLIP* nav_time_search(NAV_TITLE *title, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt)
{
uint32_t pos, len;
MPLS_PI *pi = NULL;
const MPLS_PI *pi = NULL;
NAV_CLIP *clip;
unsigned ii;
......@@ -1040,7 +1040,7 @@ NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle)
// Find length in packets and end_pkt for each clip
title->packets = 0;
for (ii = 0; ii < title->pl->list_count; ii++) {
MPLS_PI *pi;
const MPLS_PI *pi;
NAV_CLIP *cl;
pi = &title->pl->play_item[ii];
......
/*
* This file is part of libbluray
* Copyright (C) 2010 hpi1
* Copyright (C) 2010-2019 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -23,6 +23,8 @@
#include "sound_parse.h"
#include "bdmv_parse.h"
#include "disc/disc.h"
#include "file/file.h"
......@@ -33,26 +35,16 @@
#include <stdlib.h>
#define BCLK_SIG1 ('B' << 24 | 'C' << 16 | 'L' << 8 | 'K')
#define BCLK_SIG2A ('0' << 24 | '2' << 16 | '0' << 8 | '0')
#define BCLK_SIG2B ('0' << 24 | '1' << 16 | '0' << 8 | '0')
static int _bclk_parse_header(BITSTREAM *bs, uint32_t *data_start, uint32_t *extension_data_start)
{
uint32_t sig1, sig2;
if (bs_seek_byte(bs, 0) < 0) {
if (!bdmv_parse_header(bs, BCLK_SIG1, NULL)) {
return 0;
}
sig1 = bs_read(bs, 32);
sig2 = bs_read(bs, 32);
if (sig1 != BCLK_SIG1 ||
(sig2 != BCLK_SIG2A &&
sig2 != BCLK_SIG2B)) {
BD_DEBUG(DBG_NAV, "sound.bdmv failed signature match: expected BCLK0100 got %8.8s\n", bs->buf);
return 0;
if (bs_avail(bs) < 2 * 32) {
BD_DEBUG(DBG_NAV | DBG_CRIT, "_parse_header: unexpected end of file\n");
return 0;
}
*data_start = bs_read(bs, 32);
......
......@@ -903,10 +903,13 @@ static void _check_bdj(BLURAY *bd)
/* Check if jvm + jar can be loaded ? */
switch (bdj_jvm_available(&bd->bdjstorage)) {
case 2: bd->disc_info.bdj_handled = 1;
case BDJ_CHECK_OK:
bd->disc_info.bdj_handled = 1;
/* fall thru */
case 1: bd->disc_info.libjvm_detected = 1;
default:;
case BDJ_CHECK_NO_JAR:
bd->disc_info.libjvm_detected = 1;
/* fall thru */
default:;
}
}
}
......@@ -1059,9 +1062,6 @@ static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info)
bd->disc_info.top_menu = titles[0];
}
/* populate title names */
bd_get_meta(bd);
/* no BD-J menu support for profile 6 */
if (bd->disc_info.num_bdj_titles) {
// XXX actually, should check from bdjo files ...
......@@ -1072,6 +1072,9 @@ static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info)
}
indx_free(&index);
/* populate title names */
bd_get_meta(bd);
}
#if 0
......@@ -1095,9 +1098,7 @@ static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info)
const BLURAY_DISC_INFO *bd_get_disc_info(BLURAY *bd)
{
if (!bd->disc) {
BD_ENC_INFO enc_info;
memset(&enc_info, 0, sizeof(enc_info));
_fill_disc_info(bd, &enc_info);
_fill_disc_info(bd, NULL);
}
return &bd->disc_info;
}
......