[libbluray-devel] BD-J sound effects
hpi1
git at videolan.org
Thu Apr 30 11:50:19 CEST 2015
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Apr 30 12:04:01 2015 +0300| [1c59092d75a38bcbc9882e175c765a1839075772] | committer: hpi1
BD-J sound effects
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=1c59092d75a38bcbc9882e175c765a1839075772
---
src/libbluray/bdj/java/org/videolan/Libbluray.java | 5 +++++
.../org/videolan/media/content/sound/Handler.java | 19 ++++++++++++++++++-
src/libbluray/bdj/native/org_videolan_Libbluray.c | 11 +++++++++++
src/libbluray/bdj/native/org_videolan_Libbluray.h | 8 ++++++++
src/libbluray/bluray.c | 14 ++++++++++++++
src/libbluray/bluray_internal.h | 1 +
6 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index fcac9d7..7e2d8cc 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -362,6 +362,10 @@ public class Libbluray {
return selectAngleN(nativePointer, angle) == 1 ? true : false;
}
+ public static int soundEffect(int id) {
+ return soundEffectN(nativePointer, id);
+ }
+
public static int getCurrentAngle() {
return readPSR(PSR_ANGLE_NUMBER);
}
@@ -614,6 +618,7 @@ public class Libbluray {
private static native int selectPlaylistN(long np, int playlist, int playitem, int playmark, long time);
private static native int selectTitleN(long np, int title);
private static native int selectAngleN(long np, int angle);
+ private static native int soundEffectN(long np, int id);
private static native long getUOMaskN(long np);
private static native void setUOMaskN(long np, boolean menuCallMask, boolean titleSearchMask);
private static native void setKeyInterestN(long np, int mask);
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/sound/Handler.java b/src/libbluray/bdj/java/org/videolan/media/content/sound/Handler.java
index f2b4306..af04c42 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/sound/Handler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/sound/Handler.java
@@ -44,6 +44,7 @@ import org.videolan.media.content.playlist.PanningControlImpl;
import org.videolan.media.content.BDHandler;
import org.videolan.BDJListeners;
+import org.videolan.Libbluray;
public class Handler extends BDHandler {
public Handler() {
@@ -76,7 +77,23 @@ public class Handler extends BDHandler {
}
protected ControllerErrorEvent doStart(Time at) {
- return super.doStart(at);
+
+ ControllerErrorEvent err = super.doStart(at);
+ if (err != null) {
+ return err;
+ }
+
+ if (!locator.isSoundItem()) {
+ System.err.println("no sound effect in " + locator);
+ } else {
+ int id = locator.getSoundId();
+ Libbluray.soundEffect(id);
+
+ // Trigger end of media event
+ // XXX should use some other event name ...
+ statusEvent(Libbluray.BDJ_EVENT_END_OF_PLAYLIST, id);
+ }
+ return null;
}
protected ControllerErrorEvent doStop() {
diff --git a/src/libbluray/bdj/native/org_videolan_Libbluray.c b/src/libbluray/bdj/native/org_videolan_Libbluray.c
index 05d4a76..c940ec5 100644
--- a/src/libbluray/bdj/native/org_videolan_Libbluray.c
+++ b/src/libbluray/bdj/native/org_videolan_Libbluray.c
@@ -287,6 +287,12 @@ JNIEXPORT jint JNICALL Java_org_videolan_Libbluray_selectAngleN(JNIEnv * env,
return bd_select_angle(bd, angle - 1);
}
+JNIEXPORT jint JNICALL Java_org_videolan_Libbluray_soundEffectN(JNIEnv * env,
+ jclass cls, jlong np, jint id) {
+ BLURAY* bd = (BLURAY*)(intptr_t)np;
+ return bd_bdj_sound_effect(bd, id);
+}
+
JNIEXPORT jlong JNICALL Java_org_videolan_Libbluray_tellTimeN(JNIEnv * env,
jclass cls, jlong np) {
BLURAY* bd = (BLURAY*)(intptr_t)np;
@@ -663,6 +669,11 @@ Java_org_videolan_Libbluray_methods[] =
VC(Java_org_videolan_Libbluray_selectAngleN),
},
{
+ CC("soundEffectN"),
+ CC("(JI)I"),
+ VC(Java_org_videolan_Libbluray_soundEffectN),
+ },
+ {
CC("tellTimeN"),
CC("(J)J"),
VC(Java_org_videolan_Libbluray_tellTimeN),
diff --git a/src/libbluray/bdj/native/org_videolan_Libbluray.h b/src/libbluray/bdj/native/org_videolan_Libbluray.h
index 466359e..d6a9f04 100644
--- a/src/libbluray/bdj/native/org_videolan_Libbluray.h
+++ b/src/libbluray/bdj/native/org_videolan_Libbluray.h
@@ -182,6 +182,14 @@ JNIEXPORT jint JNICALL Java_org_videolan_Libbluray_selectAngleN
/*
* Class: org_videolan_Libbluray
+ * Method: soundEffectN
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL Java_org_videolan_Libbluray_soundEffectN
+ (JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: org_videolan_Libbluray
* Method: tellTimeN
* Signature: (J)J
*/
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 30946ad..44b354f 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -2357,6 +2357,20 @@ int bd_play_playlist_at(BLURAY *bd, int playlist, int playitem, int playmark, in
return result;
}
+
+int bd_bdj_sound_effect(BLURAY *bd, int id)
+{
+ if (bd->sound_effects && id >= bd->sound_effects->num_sounds) {
+ return -1;
+ }
+ if (id < 0 || id > 0xff) {
+ return -1;
+ }
+
+ _queue_event(bd, BD_EVENT_SOUND_EFFECT, id);
+ return 0;
+}
+
#endif /* USING_BDJAVA */
// Select a title for playback
diff --git a/src/libbluray/bluray_internal.h b/src/libbluray/bluray_internal.h
index 1d712f4..69c0394 100644
--- a/src/libbluray/bluray_internal.h
+++ b/src/libbluray/bluray_internal.h
@@ -74,6 +74,7 @@ enum bd_select_rate_reason {
BD_PRIVATE int bd_play_playlist_at(struct bluray *bd, int playlist, int playitem, int playmark, int64_t time);
BD_PRIVATE void bd_select_rate(struct bluray *bd, float rate, int reason);
BD_PRIVATE int bd_bdj_seek(struct bluray *bd, int playitem, int playmark, int64_t time);
+BD_PRIVATE int bd_bdj_sound_effect(struct bluray *bd, int id);
/*
* BD-J overlay
More information about the libbluray-devel
mailing list