[libbluray-devel] Fix SubtitlingControl events
hpi1
git at videolan.org
Mon Apr 6 16:43:24 CEST 2015
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Apr 6 17:25:10 2015 +0300| [4d2703ad17e7a76e9a9b1551f3bf5fc7f76669b6] | committer: hpi1
Fix SubtitlingControl events
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=4d2703ad17e7a76e9a9b1551f3bf5fc7f76669b6
---
.../videolan/media/content/playlist/Handler.java | 7 +++++++
.../content/playlist/SubtitlingControlImpl.java | 19 ++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
index 87e6085..8bbee93 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
@@ -222,6 +222,13 @@ public class Handler extends BDHandler {
} catch (Exception e) {
System.err.println("" + e + "\n" + Logger.dumpStack(e));
}
+
+ if (pi != null) {
+ TIClip[] clips = pi.getClips();
+ if (clips != null && param >= 0 && param < clips.length) {
+ ((SubtitlingControlImpl)controls[15]).onSubtitleAvailable(clips[param].getPgStreamCount() > 0);
+ }
+ }
}
protected void doAngleChanged(int param) {
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
index f9ca37d..3d5f1d5 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
@@ -26,7 +26,11 @@ import org.bluray.media.SubtitleStyleNotAvailableException;
import org.bluray.media.SubtitlingControl;
import org.bluray.media.TextSubtitleNotAvailableException;
import org.bluray.ti.CodingType;
+import org.dvb.media.SubtitleAvailableEvent;
import org.dvb.media.SubtitleListener;
+import org.dvb.media.SubtitleNotAvailableEvent;
+import org.dvb.media.SubtitleNotSelectedEvent;
+import org.dvb.media.SubtitleSelectedEvent;
import org.videolan.BDJListeners;
import org.videolan.Libbluray;
import org.videolan.StreamInfo;
@@ -118,8 +122,21 @@ public class SubtitlingControlImpl extends StreamControl implements SubtitlingCo
}
protected void onSubtitleChange(int param) {
- listeners.putCallback(new EventObject(this));
+ if ((param & 0x80000000) != 0) {
+ listeners.putCallback(new SubtitleSelectedEvent(this));
+ } else {
+ listeners.putCallback(new SubtitleNotSelectedEvent(this));
+ }
}
+ protected void onSubtitleAvailable(boolean param) {
+ if (param) {
+ listeners.putCallback(new SubtitleAvailableEvent(this));
+ } else {
+ listeners.putCallback(new SubtitleNotAvailableEvent(this));
+ }
+ }
+
+
private BDJListeners listeners = new BDJListeners();
}
More information about the libbluray-devel
mailing list