[libbluray-devel] org.bluray.ti: improve compatibility
hpi1
git at videolan.org
Fri Apr 15 12:27:14 CEST 2016
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Apr 13 14:32:53 2016 +0300| [8d5b21ff8286b4e6afa2462723b71c5e05b38cd4] | committer: hpi1
org.bluray.ti: improve compatibility
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=8d5b21ff8286b4e6afa2462723b71c5e05b38cd4
---
.../bdj/java/org/bluray/ti/CodingType.java | 2 ++
.../bdj/java/org/bluray/ti/DiscEjectedEvent.java | 2 --
.../bdj/java/org/bluray/ti/DiscInsertedEvent.java | 2 --
.../bdj/java/org/bluray/ti/DiscManager.java | 21 ++++++++++----------
.../bdj/java/org/bluray/ti/PlayItemImpl.java | 10 +++++-----
.../bdj/java/org/bluray/ti/PlayListImpl.java | 8 ++++----
.../bdj/java/org/bluray/ti/TitleComponentImpl.java | 14 ++++++-------
.../bdj/java/org/bluray/ti/TitleImpl.java | 15 ++++++++++++++
8 files changed, 43 insertions(+), 31 deletions(-)
diff --git a/src/libbluray/bdj/java/org/bluray/ti/CodingType.java b/src/libbluray/bdj/java/org/bluray/ti/CodingType.java
index b6c72b5..d7e24f3 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/CodingType.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/CodingType.java
@@ -22,6 +22,8 @@ package org.bluray.ti;
public class CodingType {
protected CodingType(String name) {
this.name = name;
+ if (name == null)
+ throw new NullPointerException("name is null");
}
public String toString() {
diff --git a/src/libbluray/bdj/java/org/bluray/ti/DiscEjectedEvent.java b/src/libbluray/bdj/java/org/bluray/ti/DiscEjectedEvent.java
index 4ef56f4..9861598 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/DiscEjectedEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/DiscEjectedEvent.java
@@ -23,6 +23,4 @@ public class DiscEjectedEvent extends DiscStatusEvent {
public DiscEjectedEvent(Object source) {
super(source);
}
-
- private static final long serialVersionUID = -5165934355777383590L;
}
diff --git a/src/libbluray/bdj/java/org/bluray/ti/DiscInsertedEvent.java b/src/libbluray/bdj/java/org/bluray/ti/DiscInsertedEvent.java
index c4a499c..c9d2fb3 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/DiscInsertedEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/DiscInsertedEvent.java
@@ -23,6 +23,4 @@ public class DiscInsertedEvent extends DiscStatusEvent {
public DiscInsertedEvent(Object source) {
super(source);
}
-
- private static final long serialVersionUID = -474637357700362624L;
}
diff --git a/src/libbluray/bdj/java/org/bluray/ti/DiscManager.java b/src/libbluray/bdj/java/org/bluray/ti/DiscManager.java
index 02ea654..a5feddd 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/DiscManager.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/DiscManager.java
@@ -21,8 +21,11 @@ package org.bluray.ti;
import java.util.LinkedList;
+import org.videolan.BDJListeners;
+
public class DiscManager {
+ private static DiscManager instance;
private static final Object instanceLock = new Object();
public static DiscManager getDiscManager() {
@@ -38,30 +41,26 @@ public class DiscManager {
}
public Disc getCurrentDisc() {
- return disc;
+ return new DiscImpl(discId);
}
public void addDiscStatusEventListener(DiscStatusListener listener) {
- synchronized(listeners) {
- listeners.add(listener);
- }
+ listeners.add(listener);
}
public void removeDiscStatusEventListener(DiscStatusListener listener) {
- synchronized(listeners) {
- listeners.remove(listener);
- }
+ listeners.remove(listener);
}
+ // XXX not allowed to add new public methods -- should be done in Impl class
public void setCurrentDisc(String id) {
if (org.videolan.BDJXletContext.getCurrentContext() == null) {
- disc = new DiscImpl(id);
+ discId = id;
} else {
System.err.println("Ignoring disc ID (from Xlet)");
}
}
- private LinkedList listeners = new LinkedList();
- private static DiscManager instance;
- private DiscImpl disc = null;
+ private BDJListeners listeners = new BDJListeners();
+ private String discId = null;
}
diff --git a/src/libbluray/bdj/java/org/bluray/ti/PlayItemImpl.java b/src/libbluray/bdj/java/org/bluray/ti/PlayItemImpl.java
index 3e64e1c..05eda8c 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/PlayItemImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/PlayItemImpl.java
@@ -51,7 +51,7 @@ public class PlayItemImpl implements PlayItem {
public Locator getLocator() {
int title = Libbluray.getCurrentTitle();
try {
- return new BDLocator("bd://" + title + ".PLAYLIST:" + playlistId + ".ITEM:" + playitemId);
+ return new BDLocator("bd://" + Integer.toHexString(title) + ".PLAYLIST:" + playlistId + ".ITEM:" + playitemId);
} catch (InvalidLocatorException e) {
return null;
}
@@ -95,8 +95,8 @@ public class PlayItemImpl implements PlayItem {
return components;
}
- int playlistId;
- int playitemId;
- TIClip clip;
- Title service;
+ private int playlistId;
+ private int playitemId;
+ private TIClip clip;
+ private Title service;
}
diff --git a/src/libbluray/bdj/java/org/bluray/ti/PlayListImpl.java b/src/libbluray/bdj/java/org/bluray/ti/PlayListImpl.java
index 8a4359d..1300d25 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/PlayListImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/PlayListImpl.java
@@ -75,8 +75,8 @@ public class PlayListImpl implements PlayList {
return null;
}
- String filename;
- PlaylistInfo playlist;
- int id;
- Title service;
+ private String filename;
+ private PlaylistInfo playlist;
+ private int id;
+ private Title service;
}
diff --git a/src/libbluray/bdj/java/org/bluray/ti/TitleComponentImpl.java b/src/libbluray/bdj/java/org/bluray/ti/TitleComponentImpl.java
index 6b28f98..da2c2f7 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/TitleComponentImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/TitleComponentImpl.java
@@ -111,11 +111,11 @@ public class TitleComponentImpl implements TitleComponent {
return stream.getSubPathId();
}
- int stream_number;
- StreamInfo stream;
- StreamType type;
- boolean primary;
- int playlistId;
- int playitemId;
- Title service;
+ private int stream_number;
+ private StreamInfo stream;
+ private StreamType type;
+ private boolean primary;
+ private int playlistId;
+ private int playitemId;
+ private Title service;
}
diff --git a/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java b/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
index a63f2d1..e4f216e 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
@@ -52,6 +52,12 @@ public class TitleImpl implements Title {
}
public String getName() {
+ if (titleNum == 0)
+ return "Top Menu";
+ if (titleNum == 65535)
+ return "First Playback";
+ if (titleNum == 65534)
+ return "Suspended Title";
return "Title " + titleNum;
}
@@ -69,6 +75,15 @@ public class TitleImpl implements Title {
return TitleType.UNKNOWN;
}
+ public boolean equals(Object obj) {
+ if (!(obj instanceof TitleImpl)) {
+ return false;
+ }
+ TitleImpl other = (TitleImpl)obj;
+ int otherNum = other.getTitleNum();
+ return otherNum == titleNum;
+ }
+
public boolean hasMultipleInstances() {
return false;
}
More information about the libbluray-devel
mailing list