Skip to content
Commits on Source (6)
......@@ -42,7 +42,7 @@ import org.videolan.Logger;
abstract class BDGraphicsBase extends DVBGraphics implements ConstrainableGraphics {
private static final Color DEFAULT_COLOR = Color.BLACK;
private static final Font DEFAULT_FONT = new Font("Dialog", Font.PLAIN, 12);
private static Font DEFAULT_FONT;
private int width;
private int height;
......@@ -126,6 +126,12 @@ abstract class BDGraphicsBase extends DVBGraphics implements ConstrainableGraphi
postInit();
}
private static Font getDefaultFont() {
if (DEFAULT_FONT == null)
DEFAULT_FONT = new Font("Dialog", Font.PLAIN, 12);
return DEFAULT_FONT;
}
private void postInit() {
if (foreground == null)
foreground = DEFAULT_COLOR;
......@@ -136,7 +142,7 @@ abstract class BDGraphicsBase extends DVBGraphics implements ConstrainableGraphi
if (font == null) {
font = GUIManager.getInstance().getDefaultFont();
if (font == null) {
font = DEFAULT_FONT;
font = getDefaultFont();
}
}
fontMetrics = null;
......@@ -209,7 +215,7 @@ abstract class BDGraphicsBase extends DVBGraphics implements ConstrainableGraphi
public Font getFont() {
if (font == null)
return DEFAULT_FONT;
return getDefaultFont();
return font;
}
......
......@@ -27,7 +27,7 @@ import org.videolan.Logger;
class BDGraphicsEnvironment extends GraphicsEnvironment {
private BDGraphicsDevice graphicsDevice;
BDGraphicsEnvironment() {
public BDGraphicsEnvironment() {
graphicsDevice = new BDGraphicsDevice(this);
}
......
......@@ -34,6 +34,7 @@ import java.security.PrivilegedAction;
import org.videolan.BDJClassFileTransformer;
import org.videolan.BDJClassLoaderAdapter;
import org.videolan.BDJXletContext;
import org.videolan.Logger;
import javax.media.ClockStartedError;
......@@ -60,6 +61,10 @@ public class Adapter implements BDJClassLoaderAdapter {
}
public Adapter() throws ClassNotFoundException {
if (BDJXletContext.getCurrentContext() != null)
throw new ClassNotFoundException();
/* relocate classes to avoid runtime package collisions */
final String s1 = "org/videolan/mmbd/Adapter$Xlet";
......
/*
* This file is part of libbluray
* Copyright (C) 2018 VideoLAN
*
* 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 org.videolan.mmbd;
import org.videolan.BDJXletContext;
import org.videolan.BDJLoaderAdapter;
import org.videolan.Logger;
import org.videolan.StrUtil;
import org.videolan.bdjo.AppEntry;
public class LoaderAdapter implements BDJLoaderAdapter {
public LoaderAdapter() throws ClassNotFoundException {
if (BDJXletContext.getCurrentContext() != null)
throw new ClassNotFoundException();
}
public AppEntry[] patchAppTable(AppEntry[] in, int title) {
try {
return patchAppTable0(in, title);
} catch (Throwable t) {
logger.info("" + t);
}
return in;
}
private static long match(byte[] s, int m, long r) {
if ((r += (ll[m].length-(s.length+8)/9)) == 0) {
long[] a = new long[(s.length+8)/9];
for (int j = 0; j < s.length; j++)
a[j/9] |= (long)(s[j]&0x7f) << (7*(j%9));
for (int i = 0; i < a.length; i++)
r |= ll[m][i]-a[i];
}
return r;
}
private static AppEntry[] patchAppTable0(AppEntry[] in, int title) {
int i1, i2;
String xlet;
if (title != 65535)
return in;
for (i1 = 0; i1 < in.length; i1++) {
if (in[i1].getParams() != null &&
in[i1].getParams().length == 1 &&
in[i1].getControlCode() == AppEntry.AUTOSTART &&
match(in[i1].getInitialClass().getBytes(),0,0) == 0 &&
match(in[i1].getParams()[0].substring(0,9).getBytes(),1,0) == 0) {
break;
}
}
if (i1 == in.length)
return in;
xlet = "." + StrUtil.split(in[i1].getParams()[0], ':')[1];
for (i2 = 0; i2 < in.length; i2++) {
if (in[i2].getControlCode() == AppEntry.PRESENT &&
in[i2].getInitialClass().length() > xlet.length() &&
in[i2].getInitialClass().endsWith(xlet)) {
break;
}
}
if (i1 == in.length)
return in;
logger.info("Patching FirstPlay appTable for title Xlet " + in[i2].getInitialClass());
logger.info("Switching applications " +
Integer.toHexString(in[i1].getIdentifier().getOID()) + "." +
Integer.toHexString(in[i1].getIdentifier().getAID()) + " and " +
Integer.toHexString(in[i2].getIdentifier().getOID()) + "." +
Integer.toHexString(in[i2].getIdentifier().getAID()));
in = (AppEntry[])in.clone();
in[i1] = new AppEntry(in[i1]) {
public int getControlCode() {
return AppEntry.PRESENT;
}
};
in[i2] = new AppEntry(in[i2]) {
public int getControlCode() {
return AppEntry.AUTOSTART;
}
};
return in;
}
/* search array */
private static final long[][] ll = {{0x6fe58f0ed5db77e3l,0x64c4bb76fd3cf4f6l,0x64dd8642ee7d7670l,0x65d787473l},{0x3aa916658571212dl}};
private static final Logger logger = Logger.getLogger(LoaderAdapter.class.getName());
}
......@@ -2103,6 +2103,10 @@ static int _preload_textst_subpath(BLURAY *bd)
return 0;
}
if ((unsigned)textst_subpath >= bd->title->sub_path_count) {
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_preload_textst_subpath(): invalid subpath id\n");
return -1;
}
if (textst_subclip >= bd->title->sub_path[textst_subpath].clip_list.count) {
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_preload_textst_subpath(): invalid subclip id\n");
return -1;
......@@ -2219,7 +2223,7 @@ static int _preload_subpaths(BLURAY *bd)
_close_preload(&bd->st_ig);
_close_preload(&bd->st_textst);
if (bd->title->pl->sub_count <= 0) {
if (bd->title->sub_path_count <= 0) {
return 0;
}
......