[libbluray-devel] emit MediaSelectSuceeded events
hpi1
git at videolan.org
Wed Apr 15 11:09:10 CEST 2015
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Apr 6 17:33:34 2015 +0300| [d5bbaed3525864eedac557cf4746abcd4fb35c56] | committer: hpi1
emit MediaSelectSuceeded events
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=d5bbaed3525864eedac557cf4746abcd4fb35c56
---
.../videolan/media/content/playlist/Handler.java | 50 +++++++++++++++++++-
.../media/content/playlist/PiPControlImpl.java | 4 +-
2 files changed, 50 insertions(+), 4 deletions(-)
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 8bbee93..d898e9f 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
@@ -29,6 +29,7 @@ import javax.media.ControllerErrorEvent;
import javax.media.IncompatibleSourceException;
import javax.media.Time;
import javax.media.protocol.DataSource;
+import javax.tv.locator.Locator;
import javax.tv.locator.InvalidLocatorException;
import javax.tv.service.selection.ServiceContextFactory;
@@ -127,6 +128,7 @@ public class Handler extends BDHandler {
updateTime(new Time(Libbluray.tellTime() * TO_SECONDS));
+ currentLocator = new BDLocator(locator.toExternalForm());
} catch (Throwable e) {
return new ConnectionErrorEvent(this);
}
@@ -193,6 +195,10 @@ public class Handler extends BDHandler {
/* notification from app */
+ private void postMediaSelectSucceeded(BDLocator locator) {
+ ((DVBMediaSelectControlImpl)controls[3]).postMediaSelectSucceededEvent(new Locator[] { locator });
+ }
+
protected void doRateChanged(float rate) {
synchronized (this) {
if (state == Started) {
@@ -206,8 +212,12 @@ public class Handler extends BDHandler {
protected void doChapterReached(int param) {
((PlaybackControlImpl)controls[9]).onChapterReach(param);
}
+
protected void doMarkReached(int param) {
((PlaybackControlImpl)controls[9]).onMarkReach(param);
+
+ if (currentLocator != null)
+ currentLocator.setMarkId(param);
}
protected void doPlaylistStarted(int param) {
@@ -217,6 +227,12 @@ public class Handler extends BDHandler {
((PlaybackControlImpl)controls[9]).onPlayItemReach(param);
((UOMaskTableControlImpl)controls[16]).onPlayItemReach(param);
+
+ if (currentLocator != null) {
+ currentLocator.setPlayItemId(param);
+ postMediaSelectSucceeded(currentLocator);
+ }
+
try {
((TitleContextImpl)ServiceContextFactory.getInstance().getServiceContext(null)).presentationChanged();
} catch (Exception e) {
@@ -237,10 +253,39 @@ public class Handler extends BDHandler {
protected void doSubtitleChanged(int param) {
((SubtitlingControlImpl)controls[15]).onSubtitleChange(param);
+
+ if (currentLocator != null) {
+ currentLocator.setPGTextStreamNumber(param & 0xfff);
+ postMediaSelectSucceeded(currentLocator);
+ }
+ }
+
+ protected void doAudioStreamChanged(int param) {
+ if (currentLocator != null) {
+ locator.setPrimaryAudioStreamNumber(param);
+ postMediaSelectSucceeded(currentLocator);
+ }
+ }
+
+ private void doSecondaryVideoChanged(int stream, boolean enable) {
+ if (currentLocator != null) {
+ locator.setSecondaryVideoStreamNumber(stream);
+ postMediaSelectSucceeded(currentLocator);
+ }
+
+ ((PiPControlImpl)controls[8]).onPiPStatusChange(enable);
+ }
+
+ private void doSecondaryAudioChanged(int stream, boolean enable) {
+ if (currentLocator != null) {
+ locator.setSecondaryAudioStreamNumber(stream);
+ postMediaSelectSucceeded(currentLocator);
+ }
}
- protected void doPiPChanged(int param) {
- ((PiPControlImpl)controls[8]).onPiPChange(param);
+ protected void doSecondaryStreamChanged(int param) {
+ doSecondaryVideoChanged((param & 0xff00) >> 8, (param & 0x80000000) != 0);
+ doSecondaryAudioChanged(param & 0xff, (param & 0x40000000) != 0);
}
protected void doEndOfMediaReached(int playlist) {
@@ -350,4 +395,5 @@ public class Handler extends BDHandler {
}
private PlaylistInfo pi = null;
+ private BDLocator currentLocator = null;
}
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
index caede88..91c0e54 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
@@ -83,8 +83,8 @@ public class PiPControlImpl extends VideoControl implements PiPControl, Asynchro
return false;
}
- protected void onPiPChange(int param) {
- listeners.putCallback(new PiPStatusEvent(param > 0, this));
+ protected void onPiPStatusChange(boolean enable) {
+ listeners.putCallback(new PiPStatusEvent(enable, this));
}
public void addPiPStatusListener(PiPStatusListener listener) {
More information about the libbluray-devel
mailing list