Skip to content
Commits on Source (5)
......@@ -26,6 +26,7 @@ import java.util.Enumeration;
import org.videolan.Logger;
import org.bluray.net.BDLocator;
import org.bluray.system.RegisterAccess;
import org.bluray.ti.TitleImpl;
import org.davic.media.MediaLocator;
import org.dvb.application.AppID;
......@@ -240,6 +241,14 @@ public class BDJLoader {
vfsCache.add(bdjo.getAppCaches());
}
try {
BDJLoaderAdapter a = Libbluray.getLoaderAdapter();
if (a != null)
appTable = a.patchAppTable(appTable, title.getTitleNum());
} catch (Throwable t) {
logger.error("" + t);
}
// initialize appProxys
for (int i = 0; i < appTable.length; i++) {
if (proxys[i] == null) {
......@@ -259,7 +268,7 @@ public class BDJLoader {
}
// change psr
Libbluray.writePSR(Libbluray.PSR_TITLE_NUMBER, title.getTitleNum());
Libbluray.writePSR(RegisterAccess.PSR_TITLE_NR, title.getTitleNum());
// notify AppsDatabase
((BDJAppsDatabase)BDJAppsDatabase.getAppsDatabase()).newDatabase(bdjo, proxys);
......
/*
* 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;
import org.videolan.bdjo.AppEntry;
public interface BDJLoaderAdapter {
/*
* Modify BDJO at run time
*/
/* patch application table */
public abstract AppEntry[] patchAppTable(AppEntry[] in, int title);
}
......@@ -84,7 +84,7 @@ class CacheDir {
cleanupCache();
for (int i = 0; i < 100; i++) {
File tmpDir = new File(baseDir, "" + System.nanoTime());
File tmpDir = new File(baseDir, Long.toHexString(System.nanoTime() + i));
tmpDir = new File(tmpDir.getCanonicalPath());
if (tmpDir.mkdirs()) {
......
......@@ -75,21 +75,36 @@ public class Libbluray {
*/
private static BDJClassLoaderAdapter classLoaderAdapter = null;
private static BDJLoaderAdapter loaderAdapter = null;
protected static BDJClassLoaderAdapter getClassLoaderAdapter() {
return classLoaderAdapter;
}
protected static BDJLoaderAdapter getLoaderAdapter() {
return loaderAdapter;
}
private static void loadAdapter(String pkg) {
if (pkg == null)
return;
if (pkg.indexOf(';') > 0) {
pkg = pkg.substring(0, pkg.indexOf(';'));
}
try {
final Object obj = Class.forName("org.videolan." + pkg + ".Adapter").newInstance();
if (!((obj instanceof BDJClassLoaderAdapter) ||
(obj instanceof BDJLoaderAdapter))) {
System.err.println("Unsupported interface in " + obj);
return;
}
if (obj instanceof BDJLoaderAdapter) {
loaderAdapter = (BDJLoaderAdapter)obj;
}
if (obj instanceof BDJClassLoaderAdapter) {
classLoaderAdapter = (BDJClassLoaderAdapter)obj;
} else {
System.err.println("Unsupported interface in " + obj);
}
} catch (ClassNotFoundException ce) {
System.out.println("" + ce); /* not really an error */
} catch (Exception e) {
System.err.println("" + e);
}
......@@ -364,6 +379,7 @@ public class Libbluray {
bdjoFiles = null;
}
classLoaderAdapter = null;
loaderAdapter = null;
}
/*
......
......@@ -225,7 +225,7 @@ class VFSCache {
// copy stream to tmp file in fontRoot. freetype can not read streams.
File tmpFile = null;
for (int i = 0; i < 100; i++) {
tmpFile = new File(fontRoot + System.nanoTime() + ".otf");
tmpFile = new File(fontRoot + Long.toHexString(System.nanoTime() + i) + ".otf");
try {
tmpFile = new File(tmpFile.getCanonicalPath());
if (!tmpFile.exists()) {
......
......@@ -148,6 +148,28 @@ public class AppEntry implements AppAttributes {
return ((binding & DISC_BOUND) != 0);
}
public AppEntry(AppEntry a) {
try {
this.icon = new AppIcon(new BDLocator(a.icon.getLocator().toExternalForm()),
(BitSet)a.icon.getIconFlags().clone());
} catch (Throwable t) {
/* may be null */
}
this.controlCode = a.controlCode;
this.type = a.type;
this.appid = new AppID(a.appid.getOID(), a.appid.getAID());
this.profiles = (AppProfile[])a.profiles.clone();
this.priority = a.priority;
this.binding = a.binding;
//this.visibility = visibility;
this.names = (String[][])a.names.clone();
this.basePath = a.basePath;
this.classpathExt = a.classpathExt;
this.initialClass = a.initialClass;
this.params = (String[])a.params.clone();
}
public AppEntry(int controlCode, int type, int orgId,
short appId, AppProfile[] profiles, short priority,
int binding, int visibility, String[][] names,
......