Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
8a68a5ff by Petri Hintukainen at 2026-01-16T19:35:19+02:00
BD-J: Cache parsed playlists.

Operation is rather expensive compared to memory usage (reading, parsing and 
analyzing multiple files).

- - - - -
3b5cb7f9 by Petri Hintukainen at 2026-01-16T19:35:19+02:00
BD-J: Simplify aspect ratio handling

- - - - -
78abc502 by Masstock at 2026-01-18T22:02:05+02:00
Add UO restriction level setting

- - - - -
5a652116 by Petri Hintukainen at 2026-01-18T22:13:29+02:00
_seek_internal(): propagate _seek_stream() return value

- - - - -
46a30bf5 by Petri Hintukainen at 2026-01-18T22:22:01+02:00
BD-J: silence removal warnings

- - - - -


6 changed files:

- src/libbluray/bdj/build.xml
- src/libbluray/bdj/java/org/videolan/Libbluray.java
- src/libbluray/bdj/java/org/videolan/StreamInfo.java
- 
src/libbluray/bdj/java/org/videolan/media/content/playlist/VideoFormatControlImpl.java
- src/libbluray/bluray.c
- src/libbluray/bluray.h


Changes:

=====================================
src/libbluray/bdj/build.xml
=====================================
@@ -32,6 +32,7 @@
                source="${java_version_bdj}" target="${java_version_bdj}">
                <compilerarg value="-XDignore.symbol.file"/>
                <compilerarg value="-Xlint:-deprecation"/>
+               <compilerarg value="-Xlint:-removal"/>
         </javac>
     </target>
     <target name="dist" depends="compile"


=====================================
src/libbluray/bdj/java/org/videolan/Libbluray.java
=====================================
@@ -449,6 +449,9 @@ public class Libbluray {
         synchronized (bdjoFilesLock) {
             bdjoFiles = null;
         }
+        synchronized (mplsFilesLock) {
+            mplsFiles = null;
+        }
         classLoaderAdapter = null;
         loaderAdapter = null;
         booted = false;
@@ -517,13 +520,32 @@ public class Libbluray {
     /* cache parsed .bdjo files */
     private static Map bdjoFiles = null;
     private static Object bdjoFilesLock = new Object();
+    /* cache parsed .mpls files */
+    private static Map mplsFiles = null;
+    private static Object mplsFilesLock = new Object();
+
 
     public static byte[] getAacsData(int type) {
         return getAacsDataN(nativePointer, type);
     }
 
     public static PlaylistInfo getPlaylistInfo(int playlist) {
-        return getPlaylistInfoN(nativePointer, playlist);
+        PlaylistInfo mpls;
+        synchronized (mplsFilesLock) {
+            if (mplsFiles == null) {
+                mplsFiles = new HashMap();
+            } else {
+                mpls = (PlaylistInfo)mplsFiles.get(playlist);
+                if (mpls != null) {
+                    return mpls;
+                }
+            }
+            mpls = getPlaylistInfoN(nativePointer, playlist);
+            if (mpls != null) {
+                mplsFiles.put(playlist, mpls);
+            }
+            return mpls;
+        }
     }
 
     public static Bdjo getBdjo(String name) {


=====================================
src/libbluray/bdj/java/org/videolan/StreamInfo.java
=====================================
@@ -107,21 +107,8 @@ public class StreamInfo {
         return new Dimension(width, height);
     }
 
-    public Dimension getVideoAspectRatio() {
-        int x, y;
-        switch (aspect) {
-        case (byte)0x02:
-            x = 4;
-            y = 3;
-            break;
-        case (byte)0x03:
-            x = 16;
-            y = 9;
-            break;
-        default:
-                return null;
-        }
-        return new Dimension(x, y);
+    public byte getVideoAspectRatioCode() {
+        return aspect;
     }
 
     public byte getRate() {


=====================================
src/libbluray/bdj/java/org/videolan/media/content/playlist/VideoFormatControlImpl.java
=====================================
@@ -42,14 +42,16 @@ public class VideoFormatControlImpl implements 
VideoFormatControl {
         TIClip ci = player.getCurrentClipInfo();
         if ((ci == null) || (ci.getVideoStreamCount() <= 0))
             return ASPECT_RATIO_UNKNOWN;
-        Dimension aspect = ci.getVideoStreams()[0].getVideoAspectRatio();
-        if (aspect != null) {
-            if ((aspect.width == 4) && (aspect.height == 3))
-                return ASPECT_RATIO_4_3;
-            if ((aspect.width == 16) && (aspect.height == 9))
-                return ASPECT_RATIO_16_9;
+
+        byte aspect = ci.getVideoStreams()[0].getVideoAspectRatioCode();
+        switch (aspect) {
+            case (byte)0x02:
+                return org.dvb.media.VideoFormatControl.ASPECT_RATIO_4_3;
+            case (byte)0x03:
+                return org.dvb.media.VideoFormatControl.ASPECT_RATIO_16_9;
+            default:
+                return org.dvb.media.VideoFormatControl.ASPECT_RATIO_UNKNOWN;
         }
-        return ASPECT_RATIO_UNKNOWN;
     }
 
     public int getActiveFormatDefinition() {


=====================================
src/libbluray/bluray.c
=====================================
@@ -143,6 +143,7 @@ struct bluray {
      */
     uint8_t         end_of_playlist; /* 1 - reached. 3 - processed . */
     uint8_t         app_scr;         /* 1 if application provides presentation 
timetamps */
+    uint8_t         uo_restriction_level; /* 0 to ignore UO restrictions */
 
     /* HDMV */
     HDMV_VM        *hdmv_vm;
@@ -1509,6 +1510,8 @@ BLURAY *bd_init(void)
         return NULL;
     }
 
+    bd->uo_restriction_level = BLURAY_PLAYER_SETTING_UO_RESTRICTION_RELAXED;
+
     bd_mutex_init(&bd->mutex);
     bd_mutex_init(&bd->argb_buffer_mutex);
 
@@ -1695,10 +1698,13 @@ static void _playmark_reached(BLURAY *bd)
  * seeking and current position
  */
 
-static void _seek_internal(BLURAY *bd,
+static int64_t _seek_internal(BLURAY *bd,
                            const NAV_CLIP *clip, uint32_t title_pkt, uint32_t 
clip_pkt)
 {
-    if (_seek_stream(bd, &bd->st0, clip, clip_pkt) >= 0) {
+    int64_t result;
+
+    result = _seek_stream(bd, &bd->st0, clip, clip_pkt);
+    if (result >= 0) {
         uint32_t media_time;
 
         /* update title position */
@@ -1725,7 +1731,10 @@ static void _seek_internal(BLURAY *bd,
         }
 
         BD_DEBUG(DBG_BLURAY, "Seek to %" PRIu64 "\n", bd->s_pos);
+        return bd->s_pos;
     }
+
+    return result;
 }
 
 /* _change_angle() should be used only before call to _seek_internal() ! */
@@ -2988,6 +2997,18 @@ int bd_set_player_setting(BLURAY *bd, uint32_t idx, 
uint32_t value)
         return 1;
     }
 
+    if (idx == BLURAY_PLAYER_SETTING_UO_RESTRICTION_LEVEL) {
+        if (BLURAY_PLAYER_SETTING_UO_RESTRICTION_COMPLIANT < value) {
+            BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Invalid UO restriction level\n");
+            return 0;
+        }
+
+        bd_mutex_lock(&bd->mutex);
+        bd->uo_restriction_level = value;
+        bd_mutex_unlock(&bd->mutex);
+        return 1;
+    }
+
     for (i = 0; i < sizeof(map) / sizeof(map[0]); i++) {
         if (idx == map[i].idx) {
             bd_mutex_lock(&bd->mutex);


=====================================
src/libbluray/bluray.h
=====================================
@@ -716,14 +716,23 @@ typedef enum {
     BLURAY_PLAYER_SETTING_TEXT_CAP       = 30,    /**< Text Subtitle 
capability.    Bit mask. */
     BLURAY_PLAYER_SETTING_PLAYER_PROFILE = 31,    /**< Player profile and 
version. */
 
-    BLURAY_PLAYER_SETTING_DECODE_PG          = 0x100, /**< Enable/disable PG 
(subtitle) decoder. Integer. Default: disabled. */
-    BLURAY_PLAYER_SETTING_PERSISTENT_STORAGE = 0x101, /**< Enable/disable BD-J 
persistent storage. Integer. Default: enabled. */
+    BLURAY_PLAYER_SETTING_DECODE_PG            = 0x100, /**< Enable/disable PG 
(subtitle) decoder. Integer. Default: disabled. */
+    BLURAY_PLAYER_SETTING_PERSISTENT_STORAGE   = 0x101, /**< Enable/disable 
BD-J persistent storage. Integer. Default: enabled. */
+    BLURAY_PLAYER_SETTING_UO_RESTRICTION_LEVEL = 0x102, /**< Set User 
Operations (UO) restriction mask enforcement level. 
bd_player_setting_uo_restriction_level value. Default: 
BLURAY_PLAYER_SETTING_UO_RESTRICTION_RELAXED. */
 
     BLURAY_PLAYER_PERSISTENT_ROOT            = 0x200, /**< Root path to the 
BD_J persistent storage location. String. */
     BLURAY_PLAYER_CACHE_ROOT                 = 0x201, /**< Root path to the 
BD_J cache storage location. String. */
     BLURAY_PLAYER_JAVA_HOME                  = 0x202, /**< Location of JRE. 
String. Default: NULL (autodetect). */
 } bd_player_setting;
 
+/** Player User Operation (UO) restriction mask enforcement level. */
+typedef enum {
+    BLURAY_PLAYER_SETTING_UO_RESTRICTION_DISABLED  =  0, /**< Executes all UOs 
unconditionally. May break the playback. */
+    BLURAY_PLAYER_SETTING_UO_RESTRICTION_RELAXED   =  5, /**< Allows most UOs, 
performs some sanity checks to reduce playback issues. */
+    BLURAY_PLAYER_SETTING_UO_RESTRICTION_SAFE      = 10, /**< Mostly 
compliant, however allows some UOs which should not cause playback issues. */
+    BLURAY_PLAYER_SETTING_UO_RESTRICTION_COMPLIANT = 20, /**< Compliant UO 
restriction enforcement. */
+} bd_player_setting_uo_restriction_level;
+
 /**
  *
  *  Update player setting



View it on GitLab: 
https://code.videolan.org/videolan/libbluray/-/compare/9353a3c0a7493457aed7b8d3a083532939e6c17e...46a30bf5eb702d7b909b44fdfd91d5573623d3fc

-- 
View it on GitLab: 
https://code.videolan.org/videolan/libbluray/-/compare/9353a3c0a7493457aed7b8d3a083532939e6c17e...46a30bf5eb702d7b909b44fdfd91d5573623d3fc
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
libbluray-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/libbluray-devel

Reply via email to