[libbluray-devel] Updated selectTitle()

hpi1 git at videolan.org
Fri Sep 14 14:46:09 CEST 2012


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Sep 14 12:47:13 2012 +0300| [7392f612486d3cfe8e991b2a86947c831c6cbe31] | committer: hpi1

Updated selectTitle()
(merge from dslibbluray)

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=7392f612486d3cfe8e991b2a86947c831c6cbe31
---

 src/libbluray/bdj/java/org/videolan/Libbluray.java |   20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index b4c94a2..6c97c2a 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -19,6 +19,10 @@
 
 package org.videolan;
 
+import javax.tv.service.selection.ServiceContextFactory;
+
+import org.bluray.ti.TitleImpl;
+import org.bluray.ti.selection.TitleContext;
 import org.videolan.bdjo.Bdjo;
 
 /**
@@ -93,11 +97,19 @@ public class Libbluray {
         return selectPlaylistN(nativePointer, playlist) == 1 ? true : false;
     }
 
-    public static boolean selectTitle(int title) {
-        if (title < 0)
-            throw new IllegalArgumentException("Title cannot be negative");
+    public static boolean selectTitle(TitleImpl title) {
+        TitleInfo ti = title.getTitleInfo();
+        if (ti.isBdj()) {
+                try {
+                        ((TitleContext)ServiceContextFactory.getInstance().getServiceContext(null)).select(title);
+                        return true;
+                } catch (Exception e) {
+                        e.printStackTrace();
+                        return false;
+                }
+        }
 
-        return selectTitleN(nativePointer, title) == 1 ? true : false;
+        return selectTitleN(nativePointer, title.getTitleNum()) == 1 ? true : false;
     }
 
     public static boolean selectAngle(int angle) {



More information about the libbluray-devel mailing list