[libbluray-devel] Provide PMSN for BD-J
hpi1
git at videolan.org
Tue Jan 8 22:11:55 CET 2013
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Jan 8 22:17:22 2013 +0200| [ff917d5090349e28a5b2e8d5300b602ef307c8fe] | committer: hpi1
Provide PMSN for BD-J
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=ff917d5090349e28a5b2e8d5300b602ef307c8fe
---
.../com/aacsla/bluray/online/MediaAttribute.java | 14 +++++++++----
src/libbluray/bdj/java/org/videolan/Libbluray.java | 5 +++++
src/libbluray/bdj/native/org_videolan_Libbluray.c | 21 ++++++++++++++++++++
src/libbluray/bdj/native/org_videolan_Libbluray.h | 9 +++++++++
src/libbluray/bluray.c | 17 ++++++++++++++++
src/libbluray/bluray_internal.h | 1 +
6 files changed, 63 insertions(+), 4 deletions(-)
diff --git a/src/libbluray/bdj/java/com/aacsla/bluray/online/MediaAttribute.java b/src/libbluray/bdj/java/com/aacsla/bluray/online/MediaAttribute.java
index 9b45760..c6fc8a4 100644
--- a/src/libbluray/bdj/java/com/aacsla/bluray/online/MediaAttribute.java
+++ b/src/libbluray/bdj/java/com/aacsla/bluray/online/MediaAttribute.java
@@ -27,13 +27,19 @@ public class MediaAttribute {
}
public byte[] getPMSN() {
- // TODO
- logger.unimplemented("getPMSN");
- return null;
+ byte pmsn[] = Libbluray.getPMSN();
+ if (pmsn == null) {
+ logger.warning("getPMSN() failed");
+ }
+ return pmsn;
}
public byte[] getVolumeID() {
- return Libbluray.getVolumeID();
+ byte vid[] = Libbluray.getVolumeID();
+ if (vid == null) {
+ logger.warning("getVolumeID() failed");
+ }
+ return vid;
}
private static final Logger logger = Logger.getLogger(MediaAttribute.class.getName());
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 16387a1..c68e5d4 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -134,6 +134,10 @@ public class Libbluray {
return getVolumeIDN(nativePointer);
}
+ public static byte[] getPMSN() {
+ return getPMSNN(nativePointer);
+ }
+
public static int getTitles() {
return getTitlesN(nativePointer);
}
@@ -388,6 +392,7 @@ public class Libbluray {
public static final int PSR_BACKUP_PSR12 = 44;
private static native byte[] getVolumeIDN(long np);
+ private static native byte[] getPMSNN(long np);
private static native TitleInfo getTitleInfoN(long np, int title);
private static native PlaylistInfo getPlaylistInfoN(long np, int playlist);
private static native int getTitlesN(long np);
diff --git a/src/libbluray/bdj/native/org_videolan_Libbluray.c b/src/libbluray/bdj/native/org_videolan_Libbluray.c
index 4c30478..2ed132e 100644
--- a/src/libbluray/bdj/native/org_videolan_Libbluray.c
+++ b/src/libbluray/bdj/native/org_videolan_Libbluray.c
@@ -192,6 +192,22 @@ JNIEXPORT jbyteArray JNICALL Java_org_videolan_Libbluray_getVolumeIDN
}
static
+JNIEXPORT jbyteArray JNICALL Java_org_videolan_Libbluray_getPMSNN
+ (JNIEnv * env, jclass cls, jlong np)
+{
+ BDJAVA* bdj = (BDJAVA*)(intptr_t)np;
+ const uint8_t *pmsn = bd_get_pmsn(bdj->bd);
+
+ static const uint8_t empty[16] = {0};
+ if (!pmsn || !memcmp(pmsn, empty, sizeof(empty))) {
+ return NULL;
+ }
+ jbyteArray array = (*env)->NewByteArray(env, 16);
+ (*env)->SetByteArrayRegion(env, array, 0, 16, (const jbyte *)pmsn);
+ return array;
+}
+
+static
JNIEXPORT jint JNICALL Java_org_videolan_Libbluray_getTitlesN(JNIEnv * env,
jclass cls, jlong np) {
BDJAVA* bdj = (BDJAVA*)(intptr_t)np;
@@ -374,6 +390,11 @@ Java_org_videolan_Libbluray_methods[] =
Java_org_videolan_Libbluray_getVolumeIDN,
},
{
+ CC("getPMSNN"),
+ CC("(J)[B"),
+ Java_org_videolan_Libbluray_getPMSNN,
+ },
+ {
CC("getTitleInfoN"),
CC("(JI)Lorg/videolan/TitleInfo;"),
Java_org_videolan_Libbluray_getTitleInfoN,
diff --git a/src/libbluray/bdj/native/org_videolan_Libbluray.h b/src/libbluray/bdj/native/org_videolan_Libbluray.h
index a650c9a..5301483 100644
--- a/src/libbluray/bdj/native/org_videolan_Libbluray.h
+++ b/src/libbluray/bdj/native/org_videolan_Libbluray.h
@@ -98,6 +98,15 @@ JNIEXPORT jbyteArray JNICALL Java_org_videolan_Libbluray_getVolumeIDN
/*
* Class: org_videolan_Libbluray
+ * Method: getPMSNN
+ * Signature: (J)[B
+ */
+static
+JNIEXPORT jbyteArray JNICALL Java_org_videolan_Libbluray_getPMSNN
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_videolan_Libbluray
* Method: getTitleInfoN
* Signature: (JI)Lorg/videolan/TitleInfo;
*/
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 5dca951..a409525 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -808,6 +808,23 @@ const uint8_t *bd_get_vid(BLURAY *bd)
return NULL;
}
+const uint8_t *bd_get_pmsn(BLURAY *bd)
+{
+ /* internal function. Used by BD-J. */
+ if (bd->aacs) {
+ fptr_p_void fptr;
+ *(void **)(&fptr) = dl_dlsym(bd->h_libaacs, "aacs_get_pmsn");
+ if (fptr) {
+ return (const uint8_t*)fptr(bd->aacs);
+ }
+ BD_DEBUG(DBG_BLURAY, "aacs_get_vid() dlsym failed! (%p)", bd);
+ return NULL;
+ }
+
+ BD_DEBUG(DBG_BLURAY, "_libaacs_get_vid(): libaacs not initialized! (%p)", bd);
+ return NULL;
+}
+
static void _libbdplus_close(BLURAY *bd)
{
if (bd->bdplus) {
diff --git a/src/libbluray/bluray_internal.h b/src/libbluray/bluray_internal.h
index e300ec4..82c24d2 100644
--- a/src/libbluray/bluray_internal.h
+++ b/src/libbluray/bluray_internal.h
@@ -27,5 +27,6 @@
#include <stdint.h>
BD_PRIVATE const uint8_t *bd_get_vid(BLURAY *bd);
+BD_PRIVATE const uint8_t *bd_get_pmsn(BLURAY *bd);
#endif /* _BLURAY_INTERNAL_H_ */
More information about the libbluray-devel
mailing list