[libbluray-devel] [Git][videolan/libbluray][master] 2 commits: Use RegisterAccess for PSR names. Drop duplicates from Libbluray.

Petri Hintukainen gitlab at videolan.org
Wed Jan 2 12:03:57 CET 2019


Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
9c88a6aa by hpi1 at 2019-01-02T00:24:38Z
Use RegisterAccess for PSR names. Drop duplicates from Libbluray.

- - - - -
a708c33b by hpi1 at 2019-01-02T11:02:22Z
Improve mmbd detection

- - - - -


9 changed files:

- src/libbluray/bdj/java/org/videolan/Libbluray.java
- src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
- src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
- src/libbluray/bdj/java/org/videolan/media/content/playlist/PrimaryAudioControlImpl.java
- src/libbluray/bdj/java/org/videolan/media/content/playlist/SecondaryAudioControlImpl.java
- src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
- src/libbluray/disc/aacs.c
- src/libbluray/disc/bdplus.c
- src/libbluray/disc/disc.c


Changes:

=====================================
src/libbluray/bdj/java/org/videolan/Libbluray.java
=====================================
@@ -1,7 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010      William Hahne
- * Copyright (C) 2012-2014 Petri Hintukainen <phintuka at users.sourceforge.net>
+ * Copyright (C) 2012-2019 Petri Hintukainen <phintuka at users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -766,40 +766,6 @@ public class Libbluray {
     public  static final int BDJ_EVENT_UO_MASKED                = 17;
     private static final int BDJ_EVENT_MOUSE                    = 18;
 
-    /* TODO: use org/bluray/system/RegisterAccess instead */
-    public static final int PSR_IG_STREAM_ID     = 0;
-    public static final int PSR_PRIMARY_AUDIO_ID = 1;
-    public static final int PSR_PG_STREAM        = 2;
-    public static final int PSR_ANGLE_NUMBER     = 3;
-    public static final int PSR_TITLE_NUMBER     = 4;
-    public static final int PSR_CHAPTER          = 5;
-    public static final int PSR_PLAYLIST         = 6;
-    public static final int PSR_PLAYITEM         = 7;
-    public static final int PSR_TIME             = 8;
-    public static final int PSR_NAV_TIMER        = 9;
-    public static final int PSR_SELECTED_BUTTON_ID = 10;
-    public static final int PSR_MENU_PAGE_ID     = 11;
-    public static final int PSR_STYLE            = 12;
-    public static final int PSR_PARENTAL         = 13;
-    public static final int PSR_SECONDARY_AUDIO_VIDEO = 14;
-    public static final int PSR_AUDIO_CAP        = 15;
-    public static final int PSR_AUDIO_LANG       = 16;
-    public static final int PSR_PG_AND_SUB_LANG  = 17;
-    public static final int PSR_MENU_LANG        = 18;
-    public static final int PSR_COUNTRY          = 19;
-    public static final int PSR_REGION           = 20;
-    public static final int PSR_VIDEO_CAP        = 29;
-    public static final int PSR_TEXT_CAP         = 30;
-    public static final int PSR_PROFILE_VERSION  = 31;
-    public static final int PSR_BACKUP_PSR4      = 36;
-    public static final int PSR_BACKUP_PSR5      = 37;
-    public static final int PSR_BACKUP_PSR6      = 38;
-    public static final int PSR_BACKUP_PSR7      = 39;
-    public static final int PSR_BACKUP_PSR8      = 40;
-    public static final int PSR_BACKUP_PSR10     = 42;
-    public static final int PSR_BACKUP_PSR11     = 43;
-    public static final int PSR_BACKUP_PSR12     = 44;
-
     public static final int AACS_DISC_ID           = 1;
     public static final int AACS_MEDIA_VID         = 2;
     public static final int AACS_MEDIA_PMSN        = 3;


=====================================
src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
=====================================
@@ -1,7 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010      William Hahne
- * Copyright (C) 2012-2014 Petri Hintukainen <phintuka at users.sourceforge.net>
+ * Copyright (C) 2012-2019 Petri Hintukainen <phintuka at users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -138,18 +138,18 @@ public class Handler extends BDHandler {
                 int stream;
                 stream = sourceLocator.getPrimaryAudioStreamNumber();
                 if (stream > 0)
-                    Libbluray.writePSR(Libbluray.PSR_PRIMARY_AUDIO_ID, stream);
+                    Libbluray.writePSR(RegisterAccess.PSR_AUDIO_STN, stream);
                 stream = sourceLocator.getPGTextStreamNumber();
                 if (stream > 0) {
-                    Libbluray.writePSR(Libbluray.PSR_PG_STREAM, stream, 0x00000fff);
+                    Libbluray.writePSR(RegisterAccess.PSR_PG_TXTST_STN, stream, 0x00000fff);
                 }
                 stream = sourceLocator.getSecondaryVideoStreamNumber();
                 if (stream > 0) {
-                    Libbluray.writePSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO, stream << 8, 0x0000ff00);
+                    Libbluray.writePSR(RegisterAccess.PSR_SECONDARY_AUDIO_STN, stream << 8, 0x0000ff00);
                 }
                 stream = sourceLocator.getSecondaryAudioStreamNumber();
                 if (stream > 0) {
-                    Libbluray.writePSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO, stream, 0x000000ff);
+                    Libbluray.writePSR(RegisterAccess.PSR_SECONDARY_AUDIO_STN, stream, 0x000000ff);
                 }
 
                 int plId = sourceLocator.getPlayListId();


=====================================
src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
=====================================
@@ -1,6 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010  William Hahne
+ * Copyright (C) 2013-2019 Petri Hintukainen <phintuka at users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -28,6 +29,7 @@ import org.bluray.media.PiPControl;
 import org.bluray.media.PiPStatusEvent;
 import org.bluray.media.PiPStatusListener;
 import org.bluray.media.StreamNotAvailableException;
+import org.bluray.system.RegisterAccess;
 import org.havi.ui.HScreenRectangle;
 
 import org.videolan.BDJListeners;
@@ -49,19 +51,19 @@ public class PiPControlImpl extends VideoControl implements PiPControl, Asynchro
     }
 
     protected void setStreamNumber(int num) {
-        Libbluray.writePSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO, num << 8, 0x0000ff00);
+        Libbluray.writePSR(RegisterAccess.PSR_SECONDARY_AUDIO_STN, num << 8, 0x0000ff00);
     }
 
     public int getCurrentStreamNumber() {
-        return (Libbluray.readPSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO) & 0x0000FF00) >> 8;
+        return (RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_SECONDARY_AUDIO_STN) & 0x0000FF00) >> 8;
     }
 
     public void setDisplay(boolean value) {
-        Libbluray.writePSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO, value ? 0x80000000 : 0, 0x80000000);
+        Libbluray.writePSR(RegisterAccess.PSR_SECONDARY_AUDIO_STN, value ? 0x80000000 : 0, 0x80000000);
     }
 
     public boolean getDisplay() {
-        return (Libbluray.readPSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO) & 0x80000000) != 0;
+        return (RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_SECONDARY_AUDIO_STN) & 0x80000000) != 0;
     }
 
     public void setFullScreen(boolean value) {


=====================================
src/libbluray/bdj/java/org/videolan/media/content/playlist/PrimaryAudioControlImpl.java
=====================================
@@ -1,6 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010  William Hahne
+ * Copyright (C) 2016-2019 Petri Hintukainen <phintuka at users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -20,6 +21,8 @@
 package org.videolan.media.content.playlist;
 
 import org.bluray.media.PrimaryAudioControl;
+import org.bluray.system.RegisterAccess;
+
 import org.videolan.Libbluray;
 import org.videolan.StreamInfo;
 import org.videolan.TIClip;
@@ -37,15 +40,15 @@ public class PrimaryAudioControlImpl extends StreamControl implements PrimaryAud
     }
 
     protected String getDefaultLanguage() {
-        return languageFromInteger(Libbluray.readPSR(Libbluray.PSR_AUDIO_LANG));
+        return languageFromInteger(RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_LANG_CODE_AUDIO));
     }
 
     public int getCurrentStreamNumber() {
-        return Libbluray.readPSR(Libbluray.PSR_PRIMARY_AUDIO_ID);
+        return RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_AUDIO_STN);
     }
 
     protected void setStreamNumber(int num) {
-        Libbluray.writePSR(Libbluray.PSR_PRIMARY_AUDIO_ID, num);
+        Libbluray.writePSR(RegisterAccess.PSR_AUDIO_STN, num);
     }
 
     private Handler player;


=====================================
src/libbluray/bdj/java/org/videolan/media/content/playlist/SecondaryAudioControlImpl.java
=====================================
@@ -1,6 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010  William Hahne
+ * Copyright (C) 2014-2019 Petri Hintukainen <phintuka at users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -20,6 +21,8 @@
 package org.videolan.media.content.playlist;
 
 import org.bluray.media.SecondaryAudioControl;
+import org.bluray.system.RegisterAccess;
+
 import org.videolan.Libbluray;
 import org.videolan.StreamInfo;
 import org.videolan.TIClip;
@@ -37,15 +40,15 @@ public class SecondaryAudioControlImpl extends StreamControl implements Secondar
     }
 
     protected String getDefaultLanguage() {
-        return languageFromInteger(Libbluray.readPSR(Libbluray.PSR_AUDIO_LANG));
+        return languageFromInteger(RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_LANG_CODE_AUDIO));
     }
 
     public int getCurrentStreamNumber() {
-        return Libbluray.readPSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO) & 0x000000FF;
+        return RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_SECONDARY_AUDIO_STN) & 0x000000FF;
     }
 
     protected void setStreamNumber(int num) {
-        Libbluray.writePSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO, num, 0x000000ff);
+        Libbluray.writePSR(RegisterAccess.PSR_SECONDARY_AUDIO_STN, num, 0x000000ff);
     }
 
     private Handler player;


=====================================
src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
=====================================
@@ -1,6 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010  William Hahne
+ * Copyright (C) 2012-2019 Petri Hintukainen <phintuka at users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,6 +26,7 @@ import org.bluray.media.StreamNotAvailableException;
 import org.bluray.media.SubtitleStyleNotAvailableException;
 import org.bluray.media.SubtitlingControl;
 import org.bluray.media.TextSubtitleNotAvailableException;
+import org.bluray.system.RegisterAccess;
 import org.bluray.ti.CodingType;
 import org.dvb.media.SubtitleAvailableEvent;
 import org.dvb.media.SubtitleListener;
@@ -49,24 +51,24 @@ public class SubtitlingControlImpl extends StreamControl implements SubtitlingCo
     }
 
     protected String getDefaultLanguage() {
-        return languageFromInteger(Libbluray.readPSR(Libbluray.PSR_PG_AND_SUB_LANG));
+        return languageFromInteger(RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_LANG_CODE_PG_TXTST));
     }
 
     public int getCurrentStreamNumber() {
-        return Libbluray.readPSR(Libbluray.PSR_PG_STREAM) & 0x00000FFF;
+        return RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_PG_TXTST_STN) & 0x00000FFF;
     }
 
     protected void setStreamNumber(int num) {
-        Libbluray.writePSR(Libbluray.PSR_PG_STREAM, num, 0x00000fff);
+        Libbluray.writePSR(RegisterAccess.PSR_PG_TXTST_STN, num, 0x00000fff);
     }
 
     public boolean isSubtitlingOn() {
-        return (Libbluray.readPSR(Libbluray.PSR_PG_STREAM) & 0x80000000) != 0;
+        return (RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_PG_TXTST_STN) & 0x80000000) != 0;
     }
 
     public boolean setSubtitling(boolean mode) {
-        boolean oldMode = (Libbluray.readPSR(Libbluray.PSR_PG_STREAM) & 0x80000000) != 0;
-        Libbluray.writePSR(Libbluray.PSR_PG_STREAM, mode ? 0x80000000 : 0, 0x80000000);
+        boolean oldMode = (RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_PG_TXTST_STN) & 0x80000000) != 0;
+        Libbluray.writePSR(RegisterAccess.PSR_PG_TXTST_STN, mode ? 0x80000000 : 0, 0x80000000);
         return oldMode;
     }
 
@@ -75,12 +77,12 @@ public class SubtitlingControlImpl extends StreamControl implements SubtitlingCo
     }
 
     public boolean isPipSubtitleMode() {
-        return (Libbluray.readPSR(Libbluray.PSR_PG_STREAM) & 0x40000000) != 0;
+        return (RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_PG_TXTST_STN) & 0x40000000) != 0;
     }
 
     public boolean setPipSubtitleMode(boolean mode) {
-        boolean oldMode = (Libbluray.readPSR(Libbluray.PSR_PG_STREAM) & 0x40000000) != 0;
-        Libbluray.writePSR(Libbluray.PSR_PG_STREAM, mode ? 0x40000000 : 0, 0x40000000);
+        boolean oldMode = (RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_PG_TXTST_STN) & 0x40000000) != 0;
+        Libbluray.writePSR(RegisterAccess.PSR_PG_TXTST_STN, mode ? 0x40000000 : 0, 0x40000000);
         return oldMode;
     }
 
@@ -90,7 +92,7 @@ public class SubtitlingControlImpl extends StreamControl implements SubtitlingCo
             throw new SubtitleStyleNotAvailableException();
         if (getCurrentSubtitleType() != CodingType.TEXT_SUBTITLE)
             throw new TextSubtitleNotAvailableException();
-        Libbluray.writePSR(Libbluray.PSR_STYLE, style);
+        Libbluray.writePSR(RegisterAccess.PSR_USER_STYLE_NR, style);
     }
 
     public CodingType getCurrentSubtitleType() {
@@ -107,7 +109,7 @@ public class SubtitlingControlImpl extends StreamControl implements SubtitlingCo
         throws TextSubtitleNotAvailableException, SubtitleStyleNotAvailableException {
         if (getCurrentSubtitleType() != CodingType.TEXT_SUBTITLE)
             throw new TextSubtitleNotAvailableException();
-        int style = Libbluray.readPSR(Libbluray.PSR_STYLE);
+        int style = RegisterAccess.getInstance().getPSR(RegisterAccess.PSR_USER_STYLE_NR);
         if ((style <= 0) || ((style > 25) && (style != 255)))
             throw new SubtitleStyleNotAvailableException();
         return style;


=====================================
src/libbluray/disc/aacs.c
=====================================
@@ -101,6 +101,13 @@ static void *_open_libaacs(int *impl_id)
         if (libaacs[ii]) {
             void *handle = dl_dlopen(libaacs[ii], "0");
             if (handle) {
+                /* One more libmmbd check. This is needed if libaacs is just a link to libmmbd ... */
+                fptr_int32 fp;
+                *(void **)(&fp) = dl_dlsym(handle, "bdplus_get_code_date");
+                if (fp && fp(NULL) == 0) {
+                    ii = IMPL_LIBMMBD;
+                }
+
                 *impl_id = ii;
                 BD_DEBUG(DBG_BLURAY, "Using %s for AACS\n", libaacs[ii]);
                 return handle;


=====================================
src/libbluray/disc/bdplus.c
=====================================
@@ -105,6 +105,13 @@ static void *_libbdplus_open(int *impl_id)
         if (libbdplus[ii]) {
             void *handle = dl_dlopen(libbdplus[ii], "0");
             if (handle) {
+                /* One more libmmbd check. This is needed if libbdplus is just a link to libmmbd ... */
+                fptr_int32 fp;
+                *(void **)(&fp) = dl_dlsym(handle, "bdplus_get_code_date");
+                if (fp && fp(NULL) == 0) {
+                    ii = IMPL_LIBMMBD;
+                }
+
                 *impl_id = ii;
                 BD_DEBUG(DBG_BLURAY, "Using %s for BD+\n", libbdplus[ii]);
                 return handle;


=====================================
src/libbluray/disc/disc.c
=====================================
@@ -683,6 +683,15 @@ const uint8_t *disc_get_data(BD_DISC *disc, int type)
     if (disc->dec) {
         return dec_data(disc->dec, type);
     }
+    if (type == 0x1000) {
+        /* this shouldn't cause any extra optical disc access */
+        BD_DIR_H *d = disc->pf_dir_open_bdrom(disc->fs_handle, "MAKEMKV");
+        if (d) {
+            dir_close(d);
+            BD_DEBUG(DBG_FILE, "Detected MakeMKV backup data\n");
+            return (const uint8_t *)"mmbd;backup";
+        }
+    }
     return NULL;
 }
 



View it on GitLab: https://code.videolan.org/videolan/libbluray/compare/0b3f50559b320641dee9052b2618f1d330274982...a708c33bc3a46f46c43e10bee0ef6b3e8f182c7c

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/compare/0b3f50559b320641dee9052b2618f1d330274982...a708c33bc3a46f46c43e10bee0ef6b3e8f182c7c
You're receiving this email because of your account on code.videolan.org.


More information about the libbluray-devel mailing list