[libbluray-devel] [Git][videolan/libbluray][master] 5 commits: Add hooks for BDJLoader fixups
Petri Hintukainen
gitlab at videolan.org
Wed Jan 2 00:45:31 CET 2019
Petri Hintukainen pushed to branch master at VideoLAN / libbluray
Commits:
fff34e45 by hpi1 at 2019-01-01T23:14:30Z
Add hooks for BDJLoader fixups
- - - - -
b05ba084 by hpi1 at 2019-01-01T23:18:23Z
CacheDir: shorter dir/file names
- - - - -
233f94da by hpi1 at 2019-01-01T23:20:19Z
CacheDir: improve unique temp file name creation
- - - - -
8b5b5918 by hpi1 at 2019-01-01T23:21:28Z
BDJLoader: use org.bluray.system.RegisterAccess for PSR numbers
- - - - -
0b3f5055 by hpi1 at 2019-01-01T23:42:56Z
AppEntry: add copy constructor
- - - - -
6 changed files:
- src/libbluray/bdj/java/org/videolan/BDJLoader.java
- + src/libbluray/bdj/java/org/videolan/BDJLoaderAdapter.java
- src/libbluray/bdj/java/org/videolan/CacheDir.java
- src/libbluray/bdj/java/org/videolan/Libbluray.java
- src/libbluray/bdj/java/org/videolan/VFSCache.java
- src/libbluray/bdj/java/org/videolan/bdjo/AppEntry.java
Changes:
=====================================
src/libbluray/bdj/java/org/videolan/BDJLoader.java
=====================================
@@ -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);
=====================================
src/libbluray/bdj/java/org/videolan/BDJLoaderAdapter.java
=====================================
@@ -0,0 +1,32 @@
+/*
+ * 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);
+}
=====================================
src/libbluray/bdj/java/org/videolan/CacheDir.java
=====================================
@@ -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()) {
=====================================
src/libbluray/bdj/java/org/videolan/Libbluray.java
=====================================
@@ -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;
}
/*
=====================================
src/libbluray/bdj/java/org/videolan/VFSCache.java
=====================================
@@ -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()) {
=====================================
src/libbluray/bdj/java/org/videolan/bdjo/AppEntry.java
=====================================
@@ -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,
View it on GitLab: https://code.videolan.org/videolan/libbluray/compare/64e2488634232e5ec5e896d77fbf114b3eca9e69...0b3f50559b320641dee9052b2618f1d330274982
--
View it on GitLab: https://code.videolan.org/videolan/libbluray/compare/64e2488634232e5ec5e896d77fbf114b3eca9e69...0b3f50559b320641dee9052b2618f1d330274982
You're receiving this email because of your account on code.videolan.org.
More information about the libbluray-devel
mailing list